summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-12-06 21:11:53 +0000
committerKarl Berry <karl@freefriends.org>2023-12-06 21:11:53 +0000
commit62a2bdd5eb64d7adaa6a8a646e280349ef3713b4 (patch)
treecf0414dce2ddd992c09d56a165ef19692aafef2f /Master/texmf-dist/source
parent90d5d7cf25bff5004450146b49c61230485c7d87 (diff)
spacingtricks (6dec23)
git-svn-id: svn://tug.org/texlive/trunk@69048 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/spacingtricks/spacingtricks.dtx63
1 files changed, 38 insertions, 25 deletions
diff --git a/Master/texmf-dist/source/latex/spacingtricks/spacingtricks.dtx b/Master/texmf-dist/source/latex/spacingtricks/spacingtricks.dtx
index f6c14e621c1..5a75a47aa6c 100644
--- a/Master/texmf-dist/source/latex/spacingtricks/spacingtricks.dtx
+++ b/Master/texmf-dist/source/latex/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.