1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
%%
%% This is file `eqparbox.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% eqparbox.dtx (with options: `package')
%%
%% This is a generated file.
%%
%% Copyright (C) 2010 Scott Pakin <scott+eqp@pakin.org>
%% -------------------------------------------------------
%%
%% This package may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.2
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{eqparbox}
[2010/01/01 v3.1 Create equal-widthed boxes]
\newlength{\eqp@tempdima} \newlength{\eqp@tempdimb}
\def\eqp@taglist{}
\newif\ifeqp@must@rerun
\AtEndDocument{%
\begingroup
\def\@elt#1{%
\eqp@tempdima\csname eqp@this@#1\endcsname\relax
\eqp@tempdimb\csname eqp@next@#1\endcsname\relax
\ifdim\eqp@tempdima=\eqp@tempdimb
\else
\@latex@warning@no@line{Rerun to correct the width of eqparbox `#1'}%
\fi
\immediate\write\@auxout{%
\string\expandafter\string\gdef\string\csname\space
eqp@this@#1\string\endcsname{%
\csname eqp@next@#1\endcsname
}%
^^J%
\string\expandafter\string\gdef\string\csname\space
eqp@next@#1\string\endcsname{0pt}%
}%
}%
\eqp@taglist
\endgroup
\ifeqp@must@rerun
\@latex@warning@no@line{Rerun to correct eqparbox widths}
\fi
}
\newcommand*{\eqp@storefont}{%
\xdef\eqp@restorefont{%
\noexpand\usefont{\f@encoding}{\f@family}{\f@series}{\f@shape}%
\noexpand\fontsize{\f@size}{\f@baselineskip}%
\noexpand\selectfont
}%
}
\RequirePackage{array}
\newcommand{\eqp@settowidth}[2]{%
\settowidth{#1}{{%
\eqp@storefont
\begin{tabular}{@{}>{\eqp@restorefont}l<{\eqp@storefont}@{}}%
#2%
\end{tabular}%
}}%
}
\DeclareRobustCommand{\eqparbox}{%
\@ifnextchar[%]
{\eqparbox@i}%
{\eqparbox@iii[c][\relax][s]}%
}
\def\eqparbox@i[#1]{%
\@ifnextchar[%]
{\eqparbox@ii[#1]}%
{\eqparbox@iii[#1][\relax][s]}%
}
\def\eqparbox@ii[#1][#2]{%
\@ifnextchar[%]
{\eqparbox@iii[#1][#2]}%
{\eqparbox@iii[#1][#2][#1]}%
}
\def\eqparbox@iii[#1][#2][#3]{%
\gdef\eqp@produce@box##1##2{%
\parbox[#1][#2][#3]{##1}{##2}%
}%
\eqp@compute@width
}
\DeclareRobustCommand{\eqmakebox}{%
\@ifnextchar[%]
{\eqlrbox@i\makebox}%
{\makebox}%
}
\DeclareRobustCommand{\eqframebox}{%
\@ifnextchar[%]
{\eqlrbox@i\framebox}%
{\framebox}%
}
\DeclareRobustCommand{\eqsavebox}[1]{%
\@ifnextchar[%]
{\eqlrbox@i{\savebox{#1}}}%
{\savebox{#1}}%
}
\def\eqlrbox@i#1[#2]{%
\@ifnextchar[%]
{\eqlrbox@ii{#1}[#2]}%
{\eqlrbox@ii{#1}[#2][c]}%
}
\def\eqlrbox@ii#1[#2][#3]{%
\gdef\eqp@produce@box##1##2{%
#1[##1][#3]{##2}%
}%
\eqp@compute@width{#2}%
}
\def\eqp@compute@width#1#2{%
\eqp@settowidth{\eqp@tempdimb}{#2}%
\expandafter
\ifx\csname eqp@this@#1\endcsname\relax
\global\eqp@must@reruntrue
\expandafter\xdef\csname eqp@this@#1\endcsname{\the\eqp@tempdimb}%
\expandafter\xdef\csname eqp@next@#1\endcsname{\the\eqp@tempdimb}%
\else
\eqp@tempdima=\csname eqp@this@#1\endcsname\relax
\ifdim\eqp@tempdima<\eqp@tempdimb
\expandafter\xdef\csname eqp@this@#1\endcsname{\the\eqp@tempdimb}%
\global\eqp@must@reruntrue
\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}}%
}{}%
\eqp@tempdima=\csname eqp@this@#1\endcsname\relax
\eqp@produce@box{\eqp@tempdima}{#2}%
}
\newcommand*{\eqboxwidth}[1]{%
\@ifundefined{eqp@this@#1}{0pt}{\csname eqp@this@#1\endcsname}%
}
\endinput
%%
%% End of file `eqparbox.sty'.
|