summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/pbox/pbox.sty
blob: d93146d20b953a703d9e38176d6715271e523922 (plain)
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
%%
%% This is file `pbox.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% pbox.dtx  (with options: `style')
%% 
%% Copyright (C) 2003  Simon Law
%% 
%%   This program is free software; you can redistribute it and/or modify
%%   it under the terms of the GNU General Public License as published by
%%   the Free Software Foundation; either version 2 of the License, or
%%   (at your option) any later version.
%% 
%%   This program is distributed in the hope that it will be useful,
%%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%%   GNU General Public License for more details.
%% 
%%   You should have received a copy of the GNU General Public License
%%   along with this program; if not, write to the Free Software
%%   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
%% 
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{pbox}[2003/04/06 v1.0 Dynamic parboxes]
\RequirePackage{calc}
\RequirePackage{ifthen}
\newcommand{\settominwidth}[3][\columnwidth]{%
  \settowidth{#2}{\begin{tabular}{@{}l@{}}#3\end{tabular}}%
  \ifthenelse{\lengthtest{#1<#2}}{\setlength{#2}{#1}}}
\newcommand{\widthofpbox}[1]{%
  \widthof{\begin{tabular}{@{}l@{}}#1\end{tabular}}}
\DeclareRobustCommand*{\pbox}[1][]{%
  \def\pb@xargi{#1}%
  \pb@xi}
\DeclareRobustCommand*{\pb@xi}[1][]{%
  \def\pb@xargii{#1}%
  \pb@xii}
\DeclareRobustCommand*{\pb@xii}[1][]{%
  \def\pb@xargiii{#1}%
  \pb@xiii}
\newlength{\pb@xlen}
\DeclareRobustCommand{\pb@xiii}[2]{%
  \settominwidth[#1]{\pb@xlen}{#2}%
  \ifthenelse{\equal{\pb@xargi}{}}
    {\parbox{\pb@xlen}{#2}}
    {\ifthenelse{\equal{\pb@xargii}{}}
      {\ifthenelse{\equal{\pb@xargiii}{}}
        {\parbox[\pb@xargi]{\pb@xlen}{#2}}
        {\parbox[\pb@xargi][][\pb@xargiii]{\pb@xlen}{#2}}}
      {\ifthenelse{\equal{\pb@xargiii}{}}
        {\parbox[\pb@xargi][\pb@xargii]{\pb@xlen}{#2}}
        {\parbox[\pb@xargi][\pb@xargii][\pb@xargiii]{\pb@xlen}{#2}}}}%
  \def\pb@xargi\relax
  \def\pb@xargii\relax
  \def\pb@xargiii\relax
  \makebox[0pt]{}}
\endinput
%%
%% End of file `pbox.sty'.