Debian Codegraph @

texmf-dist/doc/latex/sidecap/sc-test1.tex

raw
1
2 % `sc-test1.tex', part of the LaTeX package `sidecap'
3 % 2003-02-21
4 % Rolf Niepraschk and Hubert G\"a\ss{}lein -- [email protected]
5
6 \listfiles
7 \documentclass[12pt,a4paper]{article}
8 %\usepackage[bf,footnotesize]{caption2}
9 %\usepackage[innercaption,origragged,ragged]{sidecap}
10 %\usepackage[innercaption,raggedright]{sidecap}
11 \usepackage{sidecap}
12
13 \input{sc-test-common}
14
15 %\newlength\mylength
16
17 \begin{document}
18
19 \section*{The \texttt{sidecap} package}
20
21 First, a standard \LaTeX\ \texttt{figure} environment
22 (fig.~\ref{fig:standard}).
23 Since width of the body of the figure is considerably less than
24 the document's \verb|\textwidth|, there is much space wasted.
25
26 \begin{figure}[h]
27 \centering
28 \FIG[1cm]{1}%
29 \caption[\SHORTCAPi]{\CAPi}
30 \label{fig:standard}
31 \end{figure}
32
33 For such cases, the \textsf{sidecap} package provides the
34 \verb|SCfigure| and \verb|SCtable| environments to put the
35 caption beside the body of the floating environment.
36
37 In this document, we used the defaults of the \textsf{sidecap} package:
38 %
39 \begin{verbatim}
40 \usepackage{sidecap}
41 \end{verbatim}
42 %
43 In the text, we used the optional arguments for the following figures
44 (fig.~\ref{fig:sc1}, \ref{fig:sc2}, and \ref{fig:sc3}).
45 %
46 \begin{verbatim}
47 \begin{SCfigure} ...
48 \begin{SCfigure}[1.2][bhp] ...
49 \begin{SCfigure}[][bhp] ...
50 \end{verbatim}
51 %
52 In the first case, no optional arguments were given, so the defaults
53 (\verb|[1.0][tbp]|) are used. I.e., the caption will be as wide as
54 the body of the float; and the `float placement specifier' is the same
55 as for \LaTeX's standard floats (fig.~\ref{fig:sc1}).
56 In the second case, both optional arguments are given to change the
57 caption width as well as the placement options (fig.~\ref{fig:sc2}).
58 To change only the placement, just leave the first optional argument
59 empty (fig.~\ref{fig:sc3}).
60
61 \begin{SCfigure}
62 \FIG[1cm]{1}%
63 \caption[\SHORTCAPi]{\CAPi}
64 \label{fig:sc1}
65 \end{SCfigure}
66
67 \begin{SCfigure}[1.2][bhp]
68 \FIG[1cm]{1}%
69 \caption[\SHORTCAPi]{\CAPi}
70 \label{fig:sc2}
71 \end{SCfigure}
72
73 \begin{SCfigure}[][bhp]
74 \FIG[1cm]{1}%
75 \caption[\SHORTCAPi]{\CAPi}
76 \label{fig:sc3}
77 \end{SCfigure}
78
79 \clearpage
80
81 Now, a standard \LaTeX\ \texttt{table} environment
82 (tab.~\ref{tab:standard}).
83
84 \begin{table}[h]
85 \centering
86 \caption[\SHORTCAPi]{\CAPi}
87 \TABi%
88 \label{tab:standard}
89 \end{table}
90
91 The only difference between the \verb|SCfigure| and the
92 \verb|SCtable| environments is the vertical position of the
93 caption with respect to the body of the float:
94 The former places the caption bottom-aligned, the latter top-aligned
95 (compare fig.~\ref{fig:sc1} to tab.~\ref{tab:sc1}).
96
97 Also, like standard \LaTeX, the \textsf{sidecap} package doesn't care
98 about the contents of the float (cf.\ tabs.~\ref{tab:standard} and
99 \ref{tab:sc1}).
100
101 \begin{SCtable}
102 \caption[\SHORTCAPi]{\CAPi}
103 \FIG[1cm]{1}%
104 \label{tab:sc1}
105 \end{SCtable}
106
107 If you want to use all the remaining space for the caption, just
108 specify a sufficiently large factor in the first optional argument.
109 E.g., for tab.~\ref{tab:sc2} we used the following:
110 %
111 \begin{verbatim}
112 \begin{SCtable}[50] ...
113 \end{verbatim}
114 %
115 Note, however, that \TeX\ may complain
116 %
117 \begin{verbatim}
118 ! Dimension too large.
119 \end{verbatim}
120 %
121 if the factor times the width of the body is huge enough to exceed
122 the range \TeX\ is able to represent in a length register.
123 %
124 (Max.\ \verb|\maxdimen|%
125 ${}={}$\the\maxdimen
126 ${}\approx 5.76$\,{meters}).
127
128 % VOODOO:
129 %\setlength
130 %\mylength=\maxdimen
131 %\mylength=-\mylength
132 %\the\mylength
133
134 \begin{SCtable}[50]
135 \caption[\SHORTCAPi]{\CAPi}
136 \label{tab:sc2}
137 % \TABi%
138 \FIG[1cm]{1}%
139 \end{SCtable}
140
141 \end{document}