texlive[69048] Master/texmf-dist: spacingtricks (6dec23)

commits+karl at tug.org commits+karl at tug.org
Wed Dec 6 22:11:53 CET 2023


Revision: 69048
          https://tug.org/svn/texlive?view=revision&revision=69048
Author:   karl
Date:     2023-12-06 22:11:53 +0100 (Wed, 06 Dec 2023)
Log Message:
-----------
spacingtricks (6dec23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/spacingtricks/spacingtricks.pdf
    trunk/Master/texmf-dist/source/latex/spacingtricks/spacingtricks.dtx
    trunk/Master/texmf-dist/tex/latex/spacingtricks/spacingtricks.sty

Modified: trunk/Master/texmf-dist/doc/latex/spacingtricks/spacingtricks.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/spacingtricks/spacingtricks.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/spacingtricks/spacingtricks.dtx	2023-12-06 21:11:44 UTC (rev 69047)
+++ trunk/Master/texmf-dist/source/latex/spacingtricks/spacingtricks.dtx	2023-12-06 21:11:53 UTC (rev 69048)
@@ -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,6 +114,9 @@
 %
 % \changes{v1.7}{2023/07/27}{
 %    - Minor adjustments in the documentation}
+
+% \changes{v1.8}{2023/12/05}{
+%    - New macro cstrut}
 %
 % \GetFileInfo{spacingtricks.sty}
 %
@@ -120,7 +123,7 @@
 % \title{The \textsf{spacingtricks} package\thanks{This document
 % corresponds to \textsf{spacingtricks}~\fileversion, dated \filedate.}}
 % \author{Antoine Missier \\ \texttt{antoine.missier at 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,11 +400,8 @@
 %\]
 % 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. 
+% row heights. Nevertheless, "\cstrut" and "\vstrut" can be useful for fine adjustments. 
 %
-% In a text line "\vstrut" can be used to increase line space, 
-% and is better than "\vspace".
-%
 % \hypertarget{indent}{}
 % \medskip
 % \DescribeMacro{\indent} 
@@ -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.

Modified: trunk/Master/texmf-dist/tex/latex/spacingtricks/spacingtricks.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/spacingtricks/spacingtricks.sty	2023-12-06 21:11:44 UTC (rev 69047)
+++ trunk/Master/texmf-dist/tex/latex/spacingtricks/spacingtricks.sty	2023-12-06 21:11:53 UTC (rev 69048)
@@ -22,8 +22,9 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}[2005/12/01]
 \ProvidesPackage{spacingtricks}
-    [2023/07/28 v1.7 .dtx spacingtricks file]
+    [2023/12/06 v1.8 .dtx spacingtricks file]
 
+
 \newif\ifspacingtricks at pifont
 \DeclareOption{pifont}{\spacingtricks at pifonttrue}
 \ProcessOptions \relax
@@ -51,11 +52,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}}



More information about the tex-live-commits mailing list.