summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/spacingtricks
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-12-07 03:00:45 +0000
committerNorbert Preining <norbert@preining.info>2023-12-07 03:00:45 +0000
commitd1c8f933dea4fce5c8b5628fe829cadf0b33b43d (patch)
tree5b152bf88f12fcde263af23542df43d609a18aa9 /macros/latex/contrib/spacingtricks
parent517bc0ad712becd89c09bdc30e6b5cdb135fcd83 (diff)
CTAN sync 202312070300
Diffstat (limited to 'macros/latex/contrib/spacingtricks')
-rw-r--r--macros/latex/contrib/spacingtricks/spacingtricks.dtx63
-rw-r--r--macros/latex/contrib/spacingtricks/spacingtricks.pdfbin182079 -> 182798 bytes
2 files changed, 38 insertions, 25 deletions
diff --git a/macros/latex/contrib/spacingtricks/spacingtricks.dtx b/macros/latex/contrib/spacingtricks/spacingtricks.dtx
index f6c14e621c..5a75a47aa6 100644
--- a/macros/latex/contrib/spacingtricks/spacingtricks.dtx
+++ b/macros/latex/contrib/spacingtricks/spacingtricks.dtx
@@ -20,7 +20,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
\ProvidesPackage{spacingtricks}
- [2023/07/28 v1.7 .dtx spacingtricks file]
+ [2023/12/06 v1.8 .dtx spacingtricks file]
%</package>
%<*driver>
\documentclass{ltxdoc}
@@ -58,7 +58,7 @@
%</driver>
% \fi
%
-% \CheckSum{246}
+% \CheckSum{261}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -114,13 +114,16 @@
%
% \changes{v1.7}{2023/07/27}{
% - Minor adjustments in the documentation}
+
+% \changes{v1.8}{2023/12/05}{
+% - New macro cstrut}
%
% \GetFileInfo{spacingtricks.sty}
%
% \title{The \textsf{spacingtricks} package\thanks{This document
% corresponds to \textsf{spacingtricks}~\fileversion, dated \filedate.}}
% \author{Antoine Missier \\ \texttt{antoine.missier@ac-toulouse.fr}}
-% \date{July 28, 2023}
+% \date{December 6, 2023}
% \maketitle
%
% \section{Introduction}
@@ -132,7 +135,8 @@
% \item \hyperlink{footnote}{\texttt{\bslash footnote}} has been redefined
% to avoid unsuitable spacing in certain cases.
% \item \hyperlink{vstrut}{\texttt{\bslash vstrut}} generates a strut
-% with variable height or depth for maintaining consistent vertical spacing.
+% with variable height or depth for maintaining consistent vertical spacing,
+% and \hyperlink{cstrut}{\texttt{\bslash cstrut}} being symmetric around the mathematical axis.
% \item \hyperlink{indent}{\texttt{\bslash indent}} has been redefined
% to indent a line at the beginning
% of a particular paragraph even if "\parindent" has been set to 0.
@@ -341,8 +345,8 @@
%
% \begin{juxtapose}
% \begin{verbatim}
-%\[\frac{\sqrt{0.5p}}{10} =
-%\frac{\sqrt{\vstrut{1.7ex} 0.5p}}{10}\]
+%\[\frac{\sqrt{0.5p}}{10}
+% = \frac{\sqrt{\vstrut{1.7ex} 0.5p}}{10}\]
% \end{verbatim}
% \otherside
% \[\frac{\sqrt{0.5p}}{10} = \frac{\sqrt{\vstrut{1.7ex} 0.5p}}{10}\]
@@ -352,19 +356,21 @@
% \fbox{\vstrut{2ex}$\sigma(X)=1$}
% better than \fbox{$\sigma(X)=1$}.
%
+% % \hypertarget{cstrut}{}
% \medskip
-% \noindent
-% Adjusting the height using "\vstrut" is done by trial and error.
-% While a vertical phantom box would provide a good result,
-% for example "\vphantom{\bar{t}}" in the previous square root,
-% it's not obvious to know what to put in the phantom box.
-% Moreover, "\vstrut" allows a finer tuning.
+% \DescribeMacro{\cstrut}
+% The "\cstrut" macro is a alternative of "\vstrut" that adds a symmetric strut in height
+% and depth relative to the mathematical center line, which is halfway the height of an `x'.
+% It takes a single parameter "\cstrut"\marg{height}.
+% It's useful in \texttt{array} environments as it maintains
+% the mathematical axis at the center of the cell with \meta{height}
+% above and under.
%
% In a table, using
% "\renewcommand{\arraystretch}"\marg{stretch}
% allows you to increase the height of all rows, but it
-% has a global effect, whereas "\vstrut" allows to adjust the height of each row individually,
-% as in the following table:
+% has a global effect, whereas "\cstrut" (or "\vstrut") allows to adjust the height
+% of each row individually, as in the following table:
% \[
% \begin{array}{|c|}
% \hline
@@ -382,10 +388,10 @@
% \hline
% \multicolumn{2}{|c|}{\text{good}}\\
% \hline
-% \displaystyle\lim_{\substack{x \to 1\\x>1}} \ln\left(\dfrac{x^2}{x-1}\right)\vstrut{3.8ex}
-% & \mbox{obtained with } "\vstrut{3.8ex}" \\
+% \displaystyle\lim_{\substack{x \to 1\\x>1}} \ln\left(\dfrac{x^2}{x-1}\right)\cstrut{3.8ex}
+% & \mbox{obtained with } "\cstrut{3.8ex}" \\
% \hline
-% \dfrac{a}{b} \vstrut[2ex]{3ex} & "\vstrut[2ex]{3ex}" \\
+% \dfrac{a}{b} \cstrut{2.5ex} & "\cstrut{2.5ex}" \\
% \hline
% \displaystyle\int_{1}^{X} \frac{1}{t} \, \mathrm{d} t \vstrut[2.5ex]{4.2ex}
% & "\vstrut[2.5ex]{4.2ex}" \\
@@ -394,10 +400,7 @@
%\]
% However, for tables, we have the \textsf{arraycols} package~\cite{ARCOL},
% which is based on \textsf{cellspace}~\cite{CELLSP} and it allows to automatically adjust
-% row heights. Nevertheless, "\vstrut" can be useful for fine adjustments.
-%
-% In a text line "\vstrut" can be used to increase line space,
-% and is better than "\vspace".
+% row heights. Nevertheless, "\cstrut" and "\vstrut" can be useful for fine adjustments.
%
% \hypertarget{indent}{}
% \medskip
@@ -740,11 +743,21 @@
\newcommand*{\vstrut}[2][0pt]{%
\setlength{\strutheight}{#2}%
\addtolength{\strutheight}{#1}%
- \unskip
- \ensuremath{\rule[-#1]{0pt}{\strutheight}}%
+ \unskip%
+ \rule[-#1]{0pt}{\strutheight}%
\ignorespaces%
}
+\newlength{\strutdepth}
+\newcommand*{\cstrut}[1]{%
+ \setlength\strutdepth{#1}%
+ \setlength\strutheight{2\strutdepth}% total height
+ \addtolength{\strutdepth}{-0.5ex}%
+ \unskip%
+ \rule[-\strutdepth]{0pt}{\strutheight}%
+ \ignorespaces%
+}
+
\newlength{\parindentlength}
\setlength{\parindentlength}{\parindent}
\renewcommand{\indent}{\hspace{\parindentlength}}
@@ -854,9 +867,9 @@
% \bibitem{MAFR} \emph{La distribution \textsf{mafr}}, Christian Obrecht,
% CTAN, v1.0 17/09/2006.
% \bibitem{ARCOL} \emph{The \textsf{arraycols} package}, Antoine Missier, CTAN,
-% v1.2 2021/09/20.
+% v1.4 2031/09/13.
% \bibitem{MSMATH} \emph{\textsf{mismath} -- Miscellaneous mathematical macros},
-% Antoine Missier, CTAN, v2.5 2023/02/24.
+% Antoine Missier, CTAN, v2.8 2023/07/27.
% \bibitem{FVERB} \emph{The \textsf{‘fancyvrb’} package -- Fancy Verbatims in \LaTeX},
% Timothy Van Zandt, CTAN, v4.5a 2023/01/19.
% \bibitem{MKCELL} \emph{The \textsf{makecell} package}, Olga Lapko, CTAN, v0.1e 2009/08/03.
diff --git a/macros/latex/contrib/spacingtricks/spacingtricks.pdf b/macros/latex/contrib/spacingtricks/spacingtricks.pdf
index b2a9b54e38..417fafc0d8 100644
--- a/macros/latex/contrib/spacingtricks/spacingtricks.pdf
+++ b/macros/latex/contrib/spacingtricks/spacingtricks.pdf
Binary files differ