Commits

Simon Law  committed 4bd3645

Really fix \settominwidth, with a test.

  • Participants
  • Parent commits 52600e8

Comments (0)

Files changed (1)

 % \fi
 % \iffalse
 %<style>\NeedsTeXFormat{LaTeX2e}
-%<style>\ProvidesPackage{pbox}[2011/11/24 v1.1 Dynamic parboxes]
+%<style>\ProvidesPackage{pbox}[2011/12/07 v1.2 Dynamic parboxes]
 %<*driver>
 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
 \documentclass{ltxdoc}
 % \fi
 %
 % \StopEventually{\PrintIndex \PrintChanges}
-% \CheckSum{78}
+% \CheckSum{77}
 %
 % \DoNotIndex{\begin}
 % \DoNotIndex{\columnwidth}
 % \makeatletter
 % \begingroup\center
 % \begin{minipage}[c]{\ExampleWidth-5mm}
-%     \parbox[b]{2cm}{Hello\\World!}^^A
-%     \parbox[t]{2cm}{Bonjour\\monde!}
+%     \parbox[b]{1.5cm}{Hello\\World!}^^A
+%     \parbox[t]{1.5cm}{Bonjour\\monde!}
 % \end{minipage}
 % \begin{minipage}{\textwidth-\ExampleWidth}
 %   \fvset{xrightmargin=0pt}
 %   \begin{Verbatim}
-%     \parbox[b]{2cm}{Hello\\World!}%
-%     \parbox[t]{2cm}{Bonjour\\monde!}
+%     \parbox[b]{1.5cm}{Hello\\World!}%
+%     \parbox[t]{1.5cm}{Bonjour\\monde!}
 %   \end{Verbatim}
 % \end{minipage}
 % \endcenter\endgroup
 % \end{minipage}
 % \endcenter\endgroup
 % \makeatother
-% \end{DescribeMacro}
 % Notice how the exclaimation mark and the capital B have no extra 
 % space between each other, implying that |\pbox| creates minimal-width
 % boxes.
 %
+% If the provided width argument is smaller than the minimal-width,
+% then |\pbox| acts just like a regular |\parbox|. By minimal-width,
+% we mean the width of the unwrapped piece of text. You will have to
+% put in line breaks, to make |\pbox| create the tightest bounding box.
+%
+% For instance, the following example tries to get |\pbox| to wrap its
+% lines automatically.
+% \makeatletter
+% \begingroup\center
+% \begin{minipage}[c]{\ExampleWidth-5mm}
+%     \pbox[b]{1.5cm}{Hello World!}^^A
+%     \pbox[t]{1.5cm}{Bonjour monde!}
+% \end{minipage}
+% \begin{minipage}{\textwidth-\ExampleWidth}
+%   \fvset{xrightmargin=0pt}
+%   \begin{Verbatim}
+%     \pbox[b]{1.5cm}{Hello World!}%
+%     \pbox[t]{1.5cm}{Bonjour monde!}
+%   \end{Verbatim}
+% \end{minipage}
+% \endcenter\endgroup
+% \makeatother
+% \end{DescribeMacro}
+%
 % \section{Determining minimum widths}
 %
 % This is all well and good, but how does one measure the width of one
 %
 % \begin{macro}{\settominwidth}
 % \changes{v1.1}{2011/11/24}{Always return a robust value.}
+% \changes{v1.2}{2011/12/07}{Really fix the result.}
 % The minimum length is determined by the clever use of the
 % \textbf{tabular} environment.  It knows how to calculate the minimum
 % requisite width for a column, and the way determines the end of a
 % Finally, I wish to make sure that the length I have set in |#2| is
 % not larger than the maximum stored in |#1|.
 %    \begin{macrocode}
-  \ifthenelse{\lengthtest{#1<#2}}{\setlength{#2}{\protect{#1}}}}
+  \ifthenelse{\lengthtest{#1<#2}}{\setlength{#2}{#1}}{}}
 %    \end{macrocode}
 % \end{macro}
 %