summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-03-14 23:48:11 +0000
committerKarl Berry <karl@freefriends.org>2011-03-14 23:48:11 +0000
commitf7db5e8d7c1b9d95af75c77d2d69b659ae17cb63 (patch)
treec4dbe30463ea8a7e107e5ccc1ca84ef07744dfe5 /Master/texmf-dist/tex
parent9c1c061b5f034069229ffbede2fc7663e895367d (diff)
finstrut 0.5 (14mar11)
git-svn-id: svn://tug.org/texlive/trunk@21719 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/finstrut/finstrut.sty62
1 files changed, 54 insertions, 8 deletions
diff --git a/Master/texmf-dist/tex/latex/finstrut/finstrut.sty b/Master/texmf-dist/tex/latex/finstrut/finstrut.sty
index 102384df2d5..6f261c6181b 100644
--- a/Master/texmf-dist/tex/latex/finstrut/finstrut.sty
+++ b/Master/texmf-dist/tex/latex/finstrut/finstrut.sty
@@ -1,5 +1,5 @@
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesPackage{finstrut}[2011/02/12 v0.4 vmode final strut (DA/UL)]
+\ProvidesPackage{finstrut}[2011/03/14 v0.5 vmode final strut (DA/UL)]
%% Copyright (C) 2010 2011 Uwe Lueck,
%% http://www.contact-ednotes.sty.de.vu
@@ -31,10 +31,14 @@
%% % With v0.4, the code essentially is Donald Arseneau's.
%%
%% === Outline ===
-%% v0.4 considers recommendations by Donald Arseneau.
+%% v0.5 considers recommendations by Donald Arseneau.
%% Some of them may break in applications that we do not
%% know about, therefore they must be called by package
%% options. Package Option |[full]| calls all of them.
+%% %% 2011/03/14:
+%% Package Option |[fullpar]| calls a variant of them
+%% where instead of testing for `hmode' vs.~`vmode',
+%% `vmode' is \emph{forced} by a `\par', saving some tokens.
%%
%% The choices shall not be checked at each invocation
%% of `\@finalstrut', instead they are evaluated at the
@@ -51,13 +55,22 @@
%% exactly which situation. Bad.
%% Brave users may dare the `vmode' test again by choosing
%% package option |[v]|. It sets `\@tempe' for
-%% `\edef\@finalstrut'. While other conditionals are disabled
-%% right before the latter, we disable the mode test here:
-\AtEndOfPackage{%
- \def\@tempe#1#2{\noexpand\ifhmode#1\else#2\fi}}
+%% `\edef\@finalstrut'. The #1 argument of `\@tempe' is
+%% applied in `hmode', #2 in `vmode'---assuming we are not
+%% in `math' `mode' ...!? (TODO)%%%
+%% %% <- !?? don't understand 2011/02/16 ->
+%% %---While other conditionals
+%% % are disabled right before the latter,
+%% % we disable the mode test here:
+\AtEndOfPackage{\def\@tempe#1#2{\noexpand\ifhmode#1\else#2\fi}}
\DeclareOption{v}{%
\AtEndOfPackage{%
\def\@tempe#1#2{\noexpand\ifvmode#2\else#1\fi}}}
+%% Replacing the `hmode' or `vmode' test by \emph{forcing} `vmode'
+%% (and then applying Donald Arseneau's suggestions for `vmode')
+%% seems just to save a few tokens. With v0.5, option |[par]|
+%% picks this idea.
+\DeclareOption{par}{\AtEndOfPackage{\def\@tempe#1#2{\par#2}}}
%% |[argdelim]| appends a `\relax' to `\@finalstrut''s argument
%% in case the box number is given as a string of digits
%% (whereas `latex.ltx' only has `\strutbox' and
@@ -68,10 +81,11 @@
\AtEndOfPackage{\let\@tempd\@empty}
\DeclareOption{argdelim}{%
\AtEndOfPackage{\def\@tempd{\relax}}}
-\AtEndOfPackage{\let\@tempc\@secondoftwo}
+%% %% v0.5 move \@tempc down
%% |[dptest]| caters for depth exceeeding the depth of the
%% strut box and for negative depth. The test requires that
%% a multi-token argument (see above) is enclosed in braces.
+\AtEndOfPackage{\let\@tempc\@secondoftwo}
\DeclareOption{dptest}{%
\AtEndOfPackage{%
\def\@tempd{\relax}%
@@ -83,6 +97,15 @@
\def\@tempd{\relax}%
\let\@tempc\@firstoftwo
}}
+%% |[fullpar]| enables all of Donald Arseneau's suggestions
+%% apart from replacing the `vmode' test by \emph{forcing}
+%% `vmode', as with option |[par]|:
+\DeclareOption{fullpar}{%
+ \AtEndOfPackage{%
+ \def\@tempe#1#2{\par#2}%
+ \def\@tempd{\relax}%
+ \let\@tempc\@firstoftwo
+}}
%% |[show]| displays the definition of `\@finalstrut'
%% actually resulting:
\AtEndOfPackage{\let\@tempb\relax}
@@ -100,8 +123,12 @@
\let\dp@only\relax
\AtEndOfPackage{%
\begingroup
-%% Some conditionals are disabled for the `\edef':
+%% Some conditionals are disabled for the `\edef'.
\let\ifdim\relax \let\else\relax \let\fi\relax
+%% Actually, they will be restored by `\endgroup';
+%% and in order to get the final `\@finalstrut'
+%% outside the group, we ``emulate" its `\edef'
+%% by `\xdef'ing an alias `\@gtempa' of it etc. ...
\xdef\@gtempa#1{%
\unskip
\@tempe{% %% \ifhmode/\ifvmode
@@ -129,6 +156,20 @@
\def\dp@only{\@width\z@ \@height\z@ \@depth\dp}
}
%%
+%% === Example Result === %% 2011/02/17
+%% Option |[fullpar]| amounts to
+%% \begin{verbatim}
+%% \def\@finalstrut#1{%
+%% \unskip\par
+%% \ifdim\prevdepth<\dp#1\relax
+%% \ifdim\prevdepth>\z@
+%% \kern -\prevdepth
+%% \fi
+%% \hrule \@width\z@ \@height\z@ \@depth\dp#1\relax
+%% \fi
+%% }
+%% \end{verbatim}
+%%
%% === Leaving ===
\endinput
%%
@@ -140,3 +181,8 @@ v0.2 2011/02/09 redundancies removed -- still bad
v0.3 2011/02/11 code much reduced again (no \expandafter at all!);
wrong comments replaced; \subsection
v0.4 2011/02/12 Donald Arseneau's full suggestions as options
+v0.5 2011/02/12 first \@tempc line moved down
+ 2011/02/16 options [par] and [fullpar]
+ 2011/02/17 explaining \edef/\xdef
+ 2011/02/18 "emulate" \edef
+ 2011/03/14 some more text on v0.5