summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/sidecap/sc-test6.tex
blob: be544084835a02064564403aa3869cb7eab7a340 (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

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

\listfiles
\documentclass[a4paper]{article}

%\usepackage[colorgrid,gridunit=pt]{eso-pic}

\usepackage{sidecap}
%\usepackage[ragged]{sidecap}

\input{sc-test-common}

\begin{document}

\section*{The \texttt{sidecap} package 
  (text in body of floats)}

If you need to put text inside the body of a floating
environment, you'll have to put it inside a \verb|\parbox|
or a \verb|minipage| environment.
(This is necessary due to the way the \textsf{sidecap} package
grabs the body of the float.)

For example, the first pair of floats in this document
(fig.~\ref{fig:wrong} and tab.~\ref{tab:wrong})
contain essentially the following:
%
\begin{verbatim}
  \begin{minipage}{0.5\textwidth}%
    text text ... text text.
  \end{minipage}%	
\end{verbatim}
%
Note that the alignment of the caption with respect to text in the body
is wrong.

\begin{SCfigure}[][hb]
  \FIG[0.078\textwidth]{3}
  \caption{`SCfigure' \CAPi}
  \label{fig:wrong}
\end{SCfigure}

\begin{SCtable}[][hb]
  \FIG[0.078\textwidth]{3}
  \caption{`SCtable' \CAPi}
  \label{tab:wrong}
\end{SCtable}

To fix this problem, you'll have to use some extra effort.

\clearpage

For example, the second pair of floats
(fig.~\ref{fig:right} and tab.~\ref{tab:right})
contain essentially the following:
%
\begin{verbatim}
  \begin{minipage}{0.5\textwidth}%
    \strut
    text text ... text text.
    \unskip\strut
  \end{minipage}%	
\end{verbatim}
%
Now the caption is properly aligned with the first or last line of
the text in the float's body.

\begin{SCfigure}[][hb]
  \FIG[0.078\textwidth]{4}
  \caption{`SCfigure' \CAPi}
  \label{fig:right}
\end{SCfigure}

\begin{SCtable}[][hb]
  \FIG[0.078\textwidth]{4}
  \caption{`SCtable' \CAPi}
  \label{tab:right}
\end{SCtable}

Still, there is a flaw in the captions:
Due to the small \verb|\linewidth| the linebreaking and\slash or
word spacing may be awful.
Use one of the \texttt{raggedright}, \texttt{raggedleft}, or
\texttt{ragged} package options.

\end{document}