From 458a507406076f4746ce1440eca59f981949e0ab Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 4 Sep 2017 21:45:19 +0000 Subject: eqparbox (4sep17) git-svn-id: svn://tug.org/texlive/trunk@45215 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/eqparbox/eqparbox.dtx | 101 +++++++++++++++------ 1 file changed, 74 insertions(+), 27 deletions(-) (limited to 'Master/texmf-dist/source/latex/eqparbox/eqparbox.dtx') diff --git a/Master/texmf-dist/source/latex/eqparbox/eqparbox.dtx b/Master/texmf-dist/source/latex/eqparbox/eqparbox.dtx index 3a91ea1b2e5..b8987df56f2 100644 --- a/Master/texmf-dist/source/latex/eqparbox/eqparbox.dtx +++ b/Master/texmf-dist/source/latex/eqparbox/eqparbox.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2013 Scott Pakin +% Copyright (C) 2017 Scott Pakin % ---------------------------------------------------- % % This package may be distributed and/or modified under the @@ -20,7 +20,7 @@ %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{eqparbox} %<*package> - [2013/03/15 v4.0 Create equal-widthed boxes] + [2017/09/03 v4.1 Create equal-widthed boxes] % % %<*driver> @@ -62,7 +62,7 @@ % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% \CheckSum{474} +% \CheckSum{536} % % \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 @@ -88,17 +88,14 @@ % % \GetFileInfo{eqparbox.dtx} % -% \DoNotIndex{\\} -% \DoNotIndex{\@auxout,\@cons,\@ifnextchar,\@ifundefined,\@ne} -% \DoNotIndex{\@tempdima,\@tempboxa} -% \DoNotIndex{\advance,\begin,\begingroup,\bgroup,\box} -% \DoNotIndex{\csname,\DeclareRobustCommand,\def} -% \DoNotIndex{\egroup,\else,\end,\endcsname,\endgroup,\expandafter} -% \DoNotIndex{\fi,\gdef,\global} -% \DoNotIndex{\hbox,\ifdim,\ifx,\immediate,\let,\m@ne,\mbox} -% \DoNotIndex{\newcommand,\newdimen,\newif,\newlength,\noexpand} -% \DoNotIndex{\relax,\romannumeral} -% \DoNotIndex{\sbox,\setbox,\space,\string,\the,\wd,\xdef,\z@} +% \DoNotIndex{\@auxout,\@cons,\@ifnextchar,\@ifundefined,\@ne,\@tempboxa} +% \DoNotIndex{\@tempdima,\DeclareRobustCommand,\\,\advance,\begin} +% \DoNotIndex{\begingroup,\bgroup,\box,\csname,\def,\egroup,\else,\end} +% \DoNotIndex{\endcsname,\endgroup,\expandafter,\fi,\gdef,\global,\hbox} +% \DoNotIndex{\ifdim,\ifnum,\ifx,\immediate,\let,\long,\m@ne,\mbox} +% \DoNotIndex{\newcommand,\newdimen,\newif,\newlength,\noexpand,\relax} +% \DoNotIndex{\renewcommand,\renewenvironment,\romannumeral,\sbox,\setbox} +% \DoNotIndex{\space,\string,\the,\wd,\xdef,\z@} % % ^^A The following environment, which typesets a declaration of a command % ^^A in a box set out into the margin, was copied almost verbatim from @@ -346,7 +343,7 @@ % various box widths to stabilize. % % \begin{decl} -% |\eqboxwidth| +% |\eqboxwidth| \marg{tag} % \end{decl} % % It is sometimes useful to take the width of a box produced by one of @@ -500,7 +497,7 @@ % \begin{tabular}{c|c} % \textbf{Meeting date} & \textbf{Topics discussed} \\ % \hline -% 2013-02-22 +% 2017-02-22 % & \eqparbox{topiclist}{^^A % \begin{enumerate} % \item Hardware upgrades @@ -509,7 +506,7 @@ % \end{enumerate} % }^^A % \\ \hline -% 2013-03-01 +% 2017-03-01 % & \eqparbox{topiclist}{^^A % \begin{enumerate} % \item Printer low on toner @@ -517,7 +514,7 @@ % \end{enumerate} % }^^A % \\ \hline -% 2013-03-08 +% 2017-03-08 % & \eqparbox{topiclist}{^^A % \begin{enumerate} % \item Product to ship next week @@ -529,7 +526,7 @@ % \end{table} % % \begin{verbatim} -% 2013-02-22 & \eqparbox{topiclist}{% +% 2017-02-22 & \eqparbox{topiclist}{% % \begin{enumerate} % \item Hardware upgrades % \item Barbara's retirement @@ -1052,9 +1049,9 @@ }% % \end{macrocode} % To measure the width of a |list| we introduce a single-column -% |tabular| that includes |\eqp@list@indent|'s worth of padding ($\sum$ -% |\leftmargin|~$+$ |\rightmargin|~$+$ |\itemindent|) to mimic the width -% of the original |list| environment. +% |tabular| that includes |\eqp@list@indent|'s worth of padding +% ($=$~|\leftmargin|~$+$ |\rightmargin|~$+$ |\itemindent|) +% to mimic the width of the original |list| environment. % \begin{macrocode} \hspace*{-\eqp@list@indent}% \advance\eqp@list@indent by \leftmargin @@ -1114,7 +1111,7 @@ % |\eqp@next@|\meta{tag} works the same way but is always initialized % to~|0.0pt|. It represents the maximum width to assume in % \emph{subsequent} |latex| runs. It is needed to detect whether the -% dest text with tag \meta{tag} has been removed/shrunk. At the end of +% widest text with tag \meta{tag} has been removed/shrunk. At the end of % a run, \pkgname{eqparbox} prepares the next run (via the~|.aux| file) % to initialize |\eqp@this@|\meta{tag} to the final value of % |\eqp@next@|\meta{tag}. @@ -1146,10 +1143,11 @@ \expandafter \ifx\csname eqp@this@#1\endcsname\relax % \end{macrocode} -% If we get here, then we've never encountered tag \meta{tag}, even in a -% previous |latex| run. We request that the user re-run |latex| This is -% not always necessary (e.g.,~when all uses of the |\eqparbox| with tag -% \meta{tag} are left-justified), but it's better to be safe than sorry. +% If we get here, then we've never encountered tag \meta{tag}, even in +% a previous |latex| run. We request that the user re-run |latex|. +% This is not always necessary (e.g.,~when all uses of the |\eqparbox| +% with tag \meta{tag} are left-justified), but it's better to be safe +% than sorry. % \begin{macrocode} \global\eqp@must@reruntrue \expandafter\xdef\csname eqp@this@#1\endcsname{\the\eqp@tempdimb}% @@ -1194,6 +1192,47 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\eqp@set@min@width} +% Given a tag and a textual length, ensure that |\eqp@this@|\meta{tag} +% represents a width of at least \meta{length}. +% \changes{v4.1}{2017/09/03}{Introduced this helper macro for +% \texttt{\string\string\string\eqsetminwidth} and +% \texttt{\string\string\string\eqsetminwidthto}} +% \begin{macrocode} +\def\eqp@set@min@width#1#2{% + \expandafter\ifx\csname eqp@this@#1\endcsname\relax +% \end{macrocode} +% If we get here, then we've never encountered tag \meta{tag}, even in +% a previous |latex| run. We assign a value to \meta{tag} and request +% that the user re-run |latex|. +% \begin{macrocode} + \global\eqp@must@reruntrue + \expandafter\xdef\csname eqp@this@#1\endcsname{#2}% + \expandafter\xdef\csname eqp@next@#1\endcsname{#2}% + \else +% \end{macrocode} +% If we get here, then we \emph{have} previously seen tag \meta{tag}. +% We ensure its width is at least~|#2|. +% \begin{macrocode} + \eqp@tempdima=\csname eqp@this@#1\endcsname\relax + \eqp@tempdimb=#2\relax + \ifdim\eqp@tempdima<\eqp@tempdimb + \expandafter\xdef\csname eqp@this@#1\endcsname{\the\eqp@tempdimb}% + \fi + \eqp@tempdima=\csname eqp@next@#1\endcsname\relax + \ifdim\eqp@tempdima<\eqp@tempdimb + \expandafter\xdef\csname eqp@next@#1\endcsname{\the\eqp@tempdimb}% + \fi + \fi + \@ifundefined{eqp@seen@#1}{% + \expandafter\gdef\csname eqp@seen@#1\endcsname{}% + \@cons\eqp@taglist{{#1}}% + }{}% +} +% \end{macrocode} +% \end{macro} +% +% % \subsection{Author macros} % % \begin{macro}{\eqparbox} @@ -1459,10 +1498,14 @@ % the user wants the associated box to be no narrower than the given % length. % \changes{v4.0}{2013/03/04}{Introduced this macro} +% \changes{v4.1}{2017/09/03}{Define +% \texttt{\string\string\string\eqp@this@}\meta{tag} and +% \texttt{\string\string\string\eqp@next@}\meta{tag} appropriately} % \begin{macrocode} \newcommand{\eqsetminwidth}[2]{% \@tempdima=#2\relax \expandafter\xdef\csname eqp@minwd@#1\endcsname{\the\@tempdima}% + \eqp@set@min@width{#1}{\csname eqp@minwd@#1\endcsname}% } % \end{macrocode} % \end{macro} @@ -1485,10 +1528,14 @@ % records that the user wants the associated box to be no narrower than % the text, typeset at its natural width. % \changes{v4.0}{2013/03/04}{Introduced this macro} +% \changes{v4.1}{2017/09/03}{Define +% \texttt{\string\string\string\eqp@this@}\meta{tag} and +% \texttt{\string\string\string\eqp@next@}\meta{tag} appropriately} % \begin{macrocode} \newcommand{\eqsetminwidthto}[2]{% \eqp@settowidth{\@tempdima}{#2}% \expandafter\xdef\csname eqp@minwd@#1\endcsname{\the\@tempdima}% + \eqp@set@min@width{#1}{\csname eqp@minwd@#1\endcsname}% } % \end{macrocode} % \end{macro} -- cgit v1.2.3