summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/sidecap/sc-test1.tex
blob: 726eaad5b5a49356d383811c7d5e04137d38364b (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141

% `sc-test1.tex', part of the LaTeX package `sidecap'
% 2003-02-21
% Rolf Niepraschk and Hubert G\"a\ss{}lein -- niepraschk@ptb.de

\listfiles
\documentclass[12pt,a4paper]{article}
%\usepackage[bf,footnotesize]{caption2}
%\usepackage[innercaption,origragged,ragged]{sidecap}
%\usepackage[innercaption,raggedright]{sidecap}
\usepackage{sidecap}

\input{sc-test-common}

%\newlength\mylength

\begin{document}

\section*{The \texttt{sidecap} package}

First, a standard \LaTeX\ \texttt{figure} environment
(fig.~\ref{fig:standard}).
Since width of the body of the figure is considerably less than
the document's \verb|\textwidth|, there is much space wasted.

\begin{figure}[h]
  \centering
  \FIG[1cm]{1}%
  \caption[\SHORTCAPi]{\CAPi}
  \label{fig:standard}
\end{figure}

For such cases, the \textsf{sidecap} package provides the
\verb|SCfigure| and \verb|SCtable| environments to put the
caption beside the body of the floating environment.

In this document, we used the defaults of the \textsf{sidecap} package:
%
\begin{verbatim}
  \usepackage{sidecap}
\end{verbatim}
%
In the text, we used the optional arguments for the following figures
(fig.~\ref{fig:sc1}, \ref{fig:sc2}, and \ref{fig:sc3}).
%
\begin{verbatim}
  \begin{SCfigure} ...
  \begin{SCfigure}[1.2][bhp] ...
  \begin{SCfigure}[][bhp] ...
\end{verbatim}
%
In the first case, no optional arguments were given, so the defaults
(\verb|[1.0][tbp]|) are used. I.e., the caption will be as wide as
the body of the float; and the `float placement specifier' is the same
as for \LaTeX's standard floats (fig.~\ref{fig:sc1}).
In the second case, both optional arguments are given to change the
caption width as well as the placement options (fig.~\ref{fig:sc2}).
To change only the placement, just leave the first optional argument
empty (fig.~\ref{fig:sc3}).

\begin{SCfigure}
  \FIG[1cm]{1}%
  \caption[\SHORTCAPi]{\CAPi}
  \label{fig:sc1}
\end{SCfigure}

\begin{SCfigure}[1.2][bhp]
  \FIG[1cm]{1}%
  \caption[\SHORTCAPi]{\CAPi}
  \label{fig:sc2}
\end{SCfigure}

\begin{SCfigure}[][bhp]
  \FIG[1cm]{1}%
  \caption[\SHORTCAPi]{\CAPi}
  \label{fig:sc3}
\end{SCfigure}

\clearpage

Now, a standard \LaTeX\ \texttt{table} environment
(tab.~\ref{tab:standard}).

\begin{table}[h]
  \centering
  \caption[\SHORTCAPi]{\CAPi}
  \TABi%
  \label{tab:standard}
\end{table}

The only difference between the \verb|SCfigure| and the
\verb|SCtable| environments is the vertical position of the
caption with respect to the body of the float:
The former places the caption bottom-aligned, the latter top-aligned
(compare fig.~\ref{fig:sc1} to tab.~\ref{tab:sc1}).

Also, like standard \LaTeX, the \textsf{sidecap} package doesn't care
about the contents of the float (cf.\ tabs.~\ref{tab:standard} and
\ref{tab:sc1}).

\begin{SCtable}
  \caption[\SHORTCAPi]{\CAPi}  
  \FIG[1cm]{1}%
  \label{tab:sc1}
\end{SCtable}

If you want to use all the remaining space for the caption, just
specify a sufficiently large factor in the first optional argument.
E.g., for tab.~\ref{tab:sc2} we used the following:
%
\begin{verbatim}
  \begin{SCtable}[50] ...
\end{verbatim}
%
Note, however, that \TeX\ may complain
%
\begin{verbatim}
  ! Dimension too large.
\end{verbatim}
%
if the factor times the width of the body is huge enough to exceed
the range \TeX\ is able to represent in a length register.
%
(Max.\ \verb|\maxdimen|%
${}={}$\the\maxdimen
${}\approx 5.76$\,{meters}).

% VOODOO:
%\setlength
%\mylength=\maxdimen
%\mylength=-\mylength
%\the\mylength

\begin{SCtable}[50]
  \caption[\SHORTCAPi]{\CAPi}
  \label{tab:sc2}
%  \TABi%
  \FIG[1cm]{1}%
\end{SCtable}

\end{document}