Debian Codegraph @

texmf-dist/doc/latex/floatrow/frsample04.tex

raw
1 %frsample05 - sample
2 %sample with layout with usage of beside captions
3 \input pictures
4 \documentclass{book}
5
6 \usepackage{calc}
7 \usepackage{tabularx,array}
8 \usepackage{graphicx}
9
10 \IfFileExists{pstricks.sty}{\usepackage{pstricks}\psset{unit=1pt}}{}
11
12 \IfFileExists{fancyhdr.sty}{\RequirePackage{fancyhdr}\pagestyle{fancy}\fancyfoot{}
13 \fancyhead[LE]{\leavevmode\hspace*{-7cc}\def\arraystretch{1,2}\begin{tabular}{@{}l@{}}
14 \rlap{\thepage}\hskip7cc\hbox to\textwidth{\slshape\leftmark\hfill}\strut\\\hline\end{tabular}}
15 \fancyhead[LO]{\leavevmode\hspace*{-7cc}\def\arraystretch{1.2}\begin{tabular}{@{}l@{}}
16 \hskip7cc\hbox to\textwidth{\slshape\rightmark\quad\hfill\thepage}\strut\\\hline\end{tabular}}
17 \fancyhead[RE]{}\fancyhead[CE]{}
18 \fancyhead[RO]{}\fancyhead[CO]{}
19 \def\headrulewidth{0pt}}
20 {\pagestyle{plain}}
21
22 %load floatrow
23 \usepackage[font=small,captionskip=5pt,
24 capbesideframe=yes]{floatrow}
25
26 %load caption
27 \usepackage[font=small,labelfont=bf,labelsep=period,
28 justification=raggedright,singlelinecheck=no]{caption}[2004/11/28]
29
30 \DeclareMarginSet{hangleft}%
31 {\setfloatmargins{\hskip-7cc}{\hfill}}
32
33 \DeclareFloatSeparators{cicero}{\hskip1cc}
34
35 \DeclareCaptionFormat{Hang}{\leftskip7cc\parindent0pt
36 \noindent\llap{\hbox to\leftskip{#1#2\hfil}}#3\par}
37 \DeclareCaptionFormat{break}{#1#2\break#3}
38
39 \floatsetup[figure]{style=Boxed,
40 capposition=beside,capbesidewidth=6cc,objectset=centering,
41 capbesideposition=left,capbesidesep=cicero,
42 floatwidth=\columnwidth,
43 margins=hangleft}
44
45 \floatsetup[widefigure]{capposition=bottom}
46
47 \captionsetup[figure]{format=Hang,labelsep=none,justification=raggedright}
48 \captionsetup[capbesidefigure]%
49 {format=default,labelsep=newline}
50
51 \DeclareNewFloatType{textbox}{fileext=lor,name=Text,placement=tp,within=chapter}
52
53 \DeclareMarginSet{capleft}%
54 {\setfloatmargins{\hfill}{\hfill\hskip\FCwidth}}
55
56 \DeclareObjectSet{indent}{\raggedright\parindent15pt\parskip2pt}
57
58 \floatsetup[textbox]{style=Boxed,
59 frameset={\fboxrule=1pt\fboxsep=12pt},
60 capposition=beside,capbesideposition=left,
61 floatwidth=6cm,capbesidewidth=4.5cc,
62 capbesidesep=cicero,margins=capleft,
63 objectset=indent}
64
65 \floatsetup[widetextbox]{capposition=bottom,
66 floatwidth=\columnwidth,margins=raggedright}
67
68 \captionsetup[textbox]{justification=raggedright}
69 \captionsetup[capbesidetextbox]%
70 {format=break,labelsep=none,justification=raggedleft}
71
72 \providecommand*{\pkg}[1]{\texttt{#1}}
73 \newfloatcommand{ttextbox}{textbox}
74 \providecommand*{\pkg}[1]{\texttt{#1}}
75 \providecommand*{\env}[1]{\texttt{#1}}
76 \providecommand*{\com}[1]{\texttt{\char`\\#1}}
77 \providecommand*{\meta}[1]{$\langle$\textit{#1}$\rangle$}
78 \setcounter{topnumber}{1}
79
80 \def\TEXTBOX{Here goes first line of text \text
81
82 There goes second line of text
83
84 Thence goes third line of text \text
85
86 Hence goes fourth line of text}
87
88 \parskip0pt
89 \begin{document}
90
91 \chapter{Beside and Other Captions (Beta-Version Example)}
92
93 \begin{sl}
94 This example shows floats in one-column document in facing layouts.
95
96 \emph{Common float settings}\\
97 Font for float contents \verb|\small|;
98 \com{captionskip} is defined as 5pt;
99 separation between beside float boxes equals to 2\,em;
100 flag for captions beside framed object is true (frames will be defined later).
101 \begin{verbatim}
102 \usepackage[font=small,captionskip=5pt,
103 capbesideframe=yes]{floatrow}
104 \end{verbatim}
105
106 \emph{Common caption settings.}\\
107 For caption text used \verb|\small| font;
108 caption label font bold;
109 label separated by period sign;
110 justification left;
111 one-line captions have the same alignment as multiline ones.
112 \begin{verbatim}
113 \usepackage[font=small,labelfont=bf,labelsep=period,
114 justification=raggedright,singlelinecheck=no]{caption}
115 \end{verbatim}
116
117 \emph{Special caption settings for current float types.}
118
119 \emph{Figure.}\\
120 Label hangs on the left margin without label separator; justification left.
121 In beside captions label is placed above caption text.
122 \begin{verbatim}
123 \DeclareCaptionFormat{Hang}{\leftskip7cc\parindent0pt
124 \noindent\llap{\hbox to\leftskip{#1#2\hfil}}#3\par}
125 \captionsetup[figure]%
126 {format=Hang,labelsep=none,justification=raggedright}
127 \captionsetup[capbesidefigure]%
128 {format=default,labelsep=newline}
129 \end{verbatim}
130
131 \emph{Textbox.}\\
132 Justification left.
133 For beside captions used \texttt{break} style (the \texttt{labelsep=none} won't help here, because of
134 \verb|\newline| command adds a glue at the end of line); justification right.
135 \begin{verbatim}
136 \captionsetup[textbox]{justification=raggedright}
137 \DeclareCaptionFormat{break}{#1#2\break#3}
138 \captionsetup[capbesidetextbox]%
139 {format=break,labelsep=none,justification=raggedleft}
140 \end{verbatim}
141
142 \emph{Special settings for float types.}
143
144 \emph{Figure.}\\
145 For figures is used \texttt{Boxed} style;
146 captions always beside object and have width of margin (with separation);
147 they always placed on the left margin and separated by 1~cicero space;
148 object contents centered;
149 the default width of float object equals to text width;
150 float margins hang to the left by 7~cicero.
151
152 The wide figures (starred environment) put captions below object
153 \begin{verbatim}
154 \DeclareMarginSet{hangleft}%
155 {\setfloatmargins{\hskip-7cc}{\hfill}}
156 \floatsetup[figure]{style=Boxed,
157 capposition=beside,capbesidewidth=6cc,objectset=centering,
158 capbesideposition=left,capbesidesep=cicero,
159 floatwidth=\columnwidth,
160 margins=hangleft}
161
162 \floatsetup[widefigure]{capposition=bottom}
163 \end{verbatim}
164
165 \emph{Textbox.}\\
166 The new float \env{textbox} uses corrected \texttt{Boxed} style;
167 caption always stays beside float object---on the left side;
168 the default width of float object 6 centimeters;
169 the default width of caption 4.5~cicero;
170 caption separated from objects by 1~cicero;
171 margins use settings which center float object;
172 object contents flushed to left margins;
173 \verb|\parindent|${{}=15}$\,pt, \verb|\parskip|${{}=2}$\,pt.
174
175 For wide text boxes caption placed below float object;
176 the default object width equals to text width;
177 float box alignment left.
178 \begin{verbatim}
179 \DeclareMarginSet{capleft}%
180 {\setfloatmargins{\hfill}{\hfill\hskip\FCwidth}}
181
182 \DeclareObjectSet{indent}{\raggedright\parindent15pt\parskip2pt}
183
184 \floatsetup[textbox]{style=Boxed,
185 frameset={\fboxrule=1pt\fboxsep=12pt},
186 capposition=beside,capbesideposition=left,
187 floatwidth=6cm,capbesidewidth=4.5cc,
188 capbesidesep=cicero,margins=capleft,
189 objectset=indent}
190
191 \floatsetup[widetextbox]{capposition=bottom,
192 floatwidth=\columnwidth,margins=raggedright}
193 \end{verbatim}
194
195 \end{sl}
196
197 \widowpenalty10000
198
199 \def\text{{\mdseries
200 And more text and some more text and a bit more text and
201 a little more text and a little peace of text to fill space}}
202
203 \def\Text{{\mdseries
204 \text. \text. \text. \text. \par \text. \text. \text.}}
205
206 \unitlength1.44pt
207 \ifx\pspicture\undefined\else\psset{unit=\unitlength}\fi
208 \bfseries
209 \clearpage
210
211 Example of plain \env{figure} environment (figure~\ref{float:plain:fig}).
212 \begin{figure}
213 {\unitlength.85\unitlength\ifx\pspicture\undefined\else\psset{unit=\unitlength}\fi
214 \input{BlackCat.picture}}%
215 \caption{Plain figure}%
216 \label{float:plain:fig}%
217 \end{figure}%
218 \Text
219
220 \Text
221
222 Example of plain \env{textbox} environment (text~\ref{float:plain:text1}).
223 The width of object equals to 6\,cm.
224 \begin{textbox}
225 \TEXTBOX
226 \caption{Plain textbox without any settings}%
227 \label{float:plain:text1}%
228 \end{textbox}%
229 \Text
230
231 \Text
232
233 Example of plain \env{textbox} environment (text~\ref{float:plain:text2}) with defined width
234 \begin{verbatim}
235 \thisfloatsetup{floatwidth=8cm}
236 \end{verbatim}
237 This width is a bit more than \verb|\textwidth-2\captionwidth| value.
238
239 \thisfloatsetup{floatwidth=8cm}
240 \begin{textbox}
241 \TEXTBOX
242 \caption{Plain textbox. Width settings}%
243 \label{float:plain:text2}%
244 \end{textbox}%
245 \Text
246
247 \Text
248
249 Example of plain \env{textbox} environment (text~\ref{float:plain:text3}) with defined width
250 \begin{verbatim}
251 \thisfloatsetup{floatwidth=5cm}
252 \end{verbatim}
253 This width less than \verb|\textwidth-2\captionwidth| value.
254
255 \thisfloatsetup{floatwidth=5cm}
256 \begin{textbox}[!tb]
257 \TEXTBOX
258 \caption{Plain textbox. Width settings}%
259 \label{float:plain:text3}%
260 \end{textbox}%
261 \Text
262
263 Example of plain \env{figure} environment (figure~\ref{float:W:plain:fig2})
264 with predefined width${{}=5}$\,cm.
265 \begin{verbatim}
266 \thisfloatsetup{floatwidth=5cm}
267 \end{verbatim}
268 \thisfloatsetup{floatwidth=5cm}%floatrow
269 \begin{figure}
270 {\unitlength.85\unitlength\ifx\pspicture\undefined\else\psset{unit=\unitlength}\fi
271 \input{BlackCat.picture}}%
272 \caption{Plain figure with changed width}%
273 \label{float:W:plain:fig2}%
274 \end{figure}%
275 \Text
276
277 \Text
278
279
280 Example of two-column or wide plain figure (see figure~\ref{float:wide:fig3}).
281 \begin{figure*}
282 {\unitlength.85\unitlength\ifx\pspicture\undefined\else\psset{unit=\unitlength}\fi
283 \input{BlackCat.picture}}%
284 \caption{%
285 Plain wide figure. \text}%
286 \label{float:wide:fig3}%
287 \end{figure*}%
288 \Text
289
290 \Text
291
292 \Text
293
294
295 Example of plain \env{figure} environment (figure~\ref{wfloat:W:plain:fig4})
296 with predefined width${{}=9}$\,cm.
297 \begin{verbatim}
298 \thisfloatsetup{floatwidth=9cm}
299 \end{verbatim}
300 The real width equals to 9\,cm${}+{}$margin width
301
302 \thisfloatsetup{floatwidth=9cm}
303 \begin{figure*}
304 {\unitlength.85\unitlength\ifx\pspicture\undefined\else\psset{unit=\unitlength}\fi
305 \input{BlackCat.picture}}%
306 \caption{Plain figure with changed width}%
307 \label{wfloat:W:plain:fig4}%
308 \end{figure*}%
309
310 \Text
311
312 Example of plain ``wide'' \env{textbox} environment with predefined width
313 (see text~\ref{float:prewide:text5}).
314 \begin{verbatim}
315 \thisfloatsetup{floatwidth=.7\textwidth}
316 \end{verbatim}
317
318 \thisfloatsetup{floatwidth=.7\textwidth}
319 \begin{textbox*}
320 \TEXTBOX
321 \caption{Plain wide textbox. Changed width}%
322 \label{float:prewide:text5}%
323 \end{textbox*}%
324
325 \Text
326
327 Example of plain ``wide'' \env{textbox} environment
328 (see text~\ref{float:wide:text6}).
329 \begin{textbox*}[!tbp]
330 \TEXTBOX
331 \caption{Plain wide textbox}%
332 \label{float:wide:text6}%
333 \end{textbox*}%
334
335 \Text
336
337 \Text
338
339 Example of figure placed in \verb|\fcapside| (\verb|\floatbox| stuff for usage of beside captions);
340 the width of float box equals to the width of graphics
341 (see figure~\ref{floatbox:FB:fig7}).
342 \begin{figure}
343 \fcapside[\FBwidth]
344 {\unitlength2.8\unitlength\ifx\pspicture\undefined\else\psset{unit=\unitlength}\fi
345 \input{TheCat.picture}}
346 {\caption{%
347 Figure (\protect\com{ffigbox})
348 width of graphics}\label{floatbox:FB:fig7}}
349 \end{figure}%
350 \Text
351
352 \Text
353
354 Example of wide figure placed in \verb|\ffigbox| (\verb|\floatbox| stuff);
355 the width of float box equals to the width of grahics
356 (see figure~\ref{floatbox:FB:fig8}).
357 \begin{figure*}
358 \ffigbox[\FBwidth]
359 {\unitlength2.8\unitlength\ifx\pspicture\undefined\else\psset{unit=\unitlength}\fi
360 \input{TheCat.picture}}
361 {\caption{%
362 Wide figure (\protect\com{ffigbox})
363 width of graphics}\label{floatbox:FB:fig8}}
364 \end{figure*}%
365 \Text
366
367
368
369 \end{document}