summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/varwidth/varwidth-doc.tex
blob: 1944e0dbf599a4fd089b0b4adccc689fe18c5212 (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
\documentclass[a4paper]{article}
\usepackage[a4paper]{geometry}
\usepackage{miscdoc,varwidth,multicol}
\newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}}

\newsavebox{\varbox}

\begin{document}
\title{The \Package{varwidth} package (version 0.92)}
\author{Donald Arseneau\thanks{Documentation put together by Robin Fairbairns}}
\maketitle

\section{The \environment{varwidth} environment}

The package defines a \environment{varwidth} environment (based on
\environment{minipage}) which is an
analogue of \environment{minipage}, but whose resulting width is the
natural width of its contents.  A trivial example:
\begin{center}
  \begin{varwidth}[t]{2in}
    \cmdinvoke{begin}{varwidth}{1in}\\
    \null\quad\texttt{Trivia}\\
    \cmdinvoke{end}{varwidth}
  \end{varwidth}%
  \quad and\quad
  \begin{varwidth}[t]{2in}
    \cmdinvoke{begin}{minipage}{1in}\\
    \null\quad\texttt{Trivia}\\
    \cmdinvoke{end}{minipage}
  \end{varwidth}
\end{center}
which produces
\begin{center}
  \begin{lrbox}\varbox
    \begin{varwidth}{1in}
      Trivia
    \end{varwidth}
  \end{lrbox}
  \fbox{\usebox{\varbox}}%
  \quad and\quad
  \begin{lrbox}\varbox
    \begin{minipage}{1in}
      Trivia
    \end{minipage}
  \end{lrbox}
  \fbox{\usebox{\varbox}}%
\end{center}
(the output placed in an \cs{fbox} to emphasise the effect).

\section{The \cs{narrowragged} command}

The command works like \cs{raggedright}, but produces generally
narrowe lines in paragraphs, with more text in the last line (the
lines have more-equal lengths).
\end{document}