summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-04-02 18:41:23 +0000
committerKarl Berry <karl@freefriends.org>2009-04-02 18:41:23 +0000
commit01fcf064ed469deec1daa3aecec26ab905dd50c2 (patch)
tree1ce745bde1bdfcbbee1dbac414fed270d12a196b /Master/texmf-dist
parent9ae94e9c3b0cc4e0ec9429d9744173047caaa358 (diff)
varwidth update (31mar09)
git-svn-id: svn://tug.org/texlive/trunk@12605 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/tex/latex/varwidth/varwidth.sty (renamed from Master/texmf-dist/tex/latex/ltxmisc/varwidth.sty)50
1 files changed, 33 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/latex/ltxmisc/varwidth.sty b/Master/texmf-dist/tex/latex/varwidth/varwidth.sty
index 32c1a8fb639..5809254a493 100644
--- a/Master/texmf-dist/tex/latex/ltxmisc/varwidth.sty
+++ b/Master/texmf-dist/tex/latex/varwidth/varwidth.sty
@@ -1,10 +1,10 @@
-% varwidth.sty v 0.9a Mar 2003 Donald Arseneau asnd@triumf.ca
+% varwidth.sty v 0.92 Mar 2009 Donald Arseneau asnd@triumf.ca
%
-% Copyright 2003 by Donald Arseneau (asnd@triumf.ca).
+% Copyright 2003-2004,2009 by Donald Arseneau (asnd@triumf.ca).
% This software is released under the terms of the LaTeX Project Public
% License (ftp://ctan.tug.org/tex-archive/macros/latex/base/lppl.txt).
% (Essentially: Free to use, copy, distribute (sell) and change, but, if
-% changed, the name must be changed.)
+% changed, that fact must be clearly displayed to the user.)
%
% The varwidth environment is based on minipage, and takes the same
% parameters, but the specified width is just a maximum value -- the
@@ -16,7 +16,7 @@
% match a narrower natural width, if there is one.
%
% The \narrowragged command works like \raggedright, but produces
-% generally narrower lines in paragraphs, but more text in the last
+% generally narrower lines in paragraphs, with more text in the last
% line (the lines have more-equal lengths).
%
% This version works fine, but there are still many questions about
@@ -32,7 +32,7 @@
% Support numbered equations, including ams math.
%
-\ProvidesPackage{varwidth}[2003/03/10 ver 0.9a; \space
+\ProvidesPackage{varwidth}[2009/03/30 ver 0.92; \space
Variable-width minipages]
\newcommand\narrowragged{\rightskip \z@ plus .25\hsize
@@ -55,7 +55,8 @@
% a \vbox wrapped around them.
\let\@bsphack\@vwid@bsphack % \label and others
\let\mark\@gobble % Marks disappear in minipages anyway
- \let\@special\@vwid@special % \color and others
+ \let\special\@vwid@special % \color and others
+ \let\pdfliteral\@vwid@pdfliteral % \color and others
\let\addtocontents\@vwid@addtocontents % \addcontentsline
% Shifted boxes (\parshape,\hangindent) will have their shifts
% indicated in a separate box.
@@ -77,6 +78,7 @@
% At end of varwidth environment.
\def\endvarwidth{\par\@@par
+ \unskip
% Handle minipage-style notes.
\ifvoid\@mpfootins\else
\vskip\skip\@mpfootins
@@ -85,8 +87,9 @@
\unvbox\@mpfootins
\fi
\unskip
+ \@minipagefalse
\endgroup\egroup % got my \@tempboxa
-% {\showoutput\showbox\@tempboxa}%
+ %{\showoutput\showbox\@tempboxa}%
% in a discarded box, sift through list measuring max width.
\begingroup\setbox\z@\vbox\bgroup
%\message{-------------------------------------------------------------}%
@@ -101,19 +104,22 @@
\egroup\endgroup
% Done measuring. Now empty \@tempboxa onto current vertical list
% which is the contents of a minipage environment
-%\message{Got natural width \@vwid@. }%
+%\message{Got natural width \@vwid@ (compare \the\hsize) }%
\unvbox\@tempboxa
- % If the natural width is narrower, then go back through the list
- % reboxing and moving everything into \@vwid@box; then spill \@vwid@box
+ % Choose the natural width or the declared width, whichever is smaller.
\ifdim\@vwid@<\hsize
\hsize\@vwid@
- \setbox\@vwid@box\vbox{}%
- \sift@deathcycles\z@
+ \fi
+ % Go through the vertical list reboxing and moving everything into
+ % \@vwid@box; then spill \@vwid@box. If the natural width is narrower,
+ \setbox\@vwid@box\vbox{}%
+ \sift@deathcycles\z@
%\message{----------------------------------------------------------------}%
%\message{Second pass; hsize=\the\hsize... }%{\tracingall\showlists}%
- \@vwid@sift
- \unvbox\@vwid@box
- \fi
+ \@vwid@sift
+%\message{After sifting:}%
+%{\showoutput\showbox\@vwid@box}%
+ \unvbox\@vwid@box
% end the minipage environment
\endminipage}
@@ -193,8 +199,9 @@
\advance\@tempdima-\@vwid@roff
\advance\@tempdima-\@vwid@loff
\advance\@tempdima-\p@
+%\message{Test if \the\wd\z@ > \the\@tempdima, }%
\ifdim\wd\z@>\@tempdima % full-width line; rebox it
-%\message{An ordinary line or alignment. }%
+%\message{An ordinary line or alignment. (\the\wd\z@ > \the\@tempdima) }%
\hbox to\hsize
{\kern\@vwid@loff \unhbox\z@ \kern\@vwid@roff}%
\else % an equation or direct \hbox
@@ -204,10 +211,15 @@
{\hskip\@vwid@loff\@plus1fil
\unhbox\z@ \hskip\@vwid@roff\@plus1fil}%
\else % plain narrow \hbox; leave it as-is
+%\message{Plain narrow box}%
\box\z@
\fi\fi\fi\fi
\egroup}
+
+% Measure a line (in box \z@) and keep a running tally of the
+% widest natural width in \@tempdima
+
\def\@vwid@measure{%
\ifvoid\z@
\else
@@ -228,7 +240,7 @@
\let\@@bsphack\@bsphack
\let\@@esphack\@esphack
-\let\@@esphack\@Esphack
+\let\@@Esphack\@Esphack
\def\@vwid@bsphack{\@@bsphack
\ifx\@vwid@wrap\@firstofone
@@ -258,12 +270,14 @@
}\unvbox\@vwid@box }
\let\@@vwid@special\special
+\let\@@vwid@pdfliteral\pdfliteral
\let\@@vwid@addtocontents\addtocontents
\let\@@vwid@list\list
\let\@@vwid@endtrivlist\endtrivlist
\let\@@vwid@eqnnum\@eqnnum
\long\def\@vwid@special#1{\@vwid@wrap{\@@vwid@special{#1}}}
+\long\def\@vwid@pdfliteral#1{\@vwid@wrap{\@@vwid@pdfliteral{#1}}}
\long\def\@vwid@addtocontents#1#2{\@vwid@wrap{\@@vwid@addtocontents{#1}{#2}}}
\long\def\@vwid@hangfrom#1{\par
@@ -300,3 +314,5 @@
}{}
}
+% V 0.91 Always restack contents, even if width didn't change.
+% V 0.92 fix \special, \pdfliteral