summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/floatrow/frsample04.tex
blob: c2359a4abefa79ba3a1a6d4c0a960069c3327a80 (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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
%frsample05 - sample
%sample with layout with usage of beside captions
\input pictures
\documentclass{book}

\usepackage{calc}
\usepackage{tabularx,array}
\usepackage{graphicx}

\IfFileExists{pstricks.sty}{\usepackage{pstricks}\psset{unit=1pt}}{}

\IfFileExists{fancyhdr.sty}{\RequirePackage{fancyhdr}\pagestyle{fancy}\fancyfoot{}
\fancyhead[LE]{\leavevmode\hspace*{-7cc}\def\arraystretch{1,2}\begin{tabular}{@{}l@{}}
  \rlap{\thepage}\hskip7cc\hbox to\textwidth{\slshape\leftmark\hfill}\strut\\\hline\end{tabular}}
\fancyhead[LO]{\leavevmode\hspace*{-7cc}\def\arraystretch{1.2}\begin{tabular}{@{}l@{}}
  \hskip7cc\hbox to\textwidth{\slshape\rightmark\quad\hfill\thepage}\strut\\\hline\end{tabular}}
\fancyhead[RE]{}\fancyhead[CE]{}
\fancyhead[RO]{}\fancyhead[CO]{}
\def\headrulewidth{0pt}}
{\pagestyle{plain}}

%load floatrow
\usepackage[font=small,captionskip=5pt,
   capbesideframe=yes]{floatrow}

%load caption
\usepackage[font=small,labelfont=bf,labelsep=period,
   justification=raggedright,singlelinecheck=no]{caption}[2004/11/28]

\DeclareMarginSet{hangleft}%
  {\setfloatmargins{\hskip-7cc}{\hfill}}

\DeclareFloatSeparators{cicero}{\hskip1cc}

\DeclareCaptionFormat{Hang}{\leftskip7cc\parindent0pt
  \noindent\llap{\hbox to\leftskip{#1#2\hfil}}#3\par}
\DeclareCaptionFormat{break}{#1#2\break#3}

\floatsetup[figure]{style=Boxed,
  capposition=beside,capbesidewidth=6cc,objectset=centering,
  capbesideposition=left,capbesidesep=cicero,
  floatwidth=\columnwidth,
  margins=hangleft}

\floatsetup[widefigure]{capposition=bottom}

\captionsetup[figure]{format=Hang,labelsep=none,justification=raggedright}
\captionsetup[capbesidefigure]%
   {format=default,labelsep=newline}

\DeclareNewFloatType{textbox}{fileext=lor,name=Text,placement=tp,within=chapter}

\DeclareMarginSet{capleft}%
  {\setfloatmargins{\hfill}{\hfill\hskip\FCwidth}}

\DeclareObjectSet{indent}{\raggedright\parindent15pt\parskip2pt}

\floatsetup[textbox]{style=Boxed,
  frameset={\fboxrule=1pt\fboxsep=12pt},
  capposition=beside,capbesideposition=left,
  floatwidth=6cm,capbesidewidth=4.5cc,
  capbesidesep=cicero,margins=capleft,
  objectset=indent}

\floatsetup[widetextbox]{capposition=bottom,
  floatwidth=\columnwidth,margins=raggedright}

\captionsetup[textbox]{justification=raggedright}
\captionsetup[capbesidetextbox]%
  {format=break,labelsep=none,justification=raggedleft}

\providecommand*{\pkg}[1]{\texttt{#1}}
\newfloatcommand{ttextbox}{textbox}
\providecommand*{\pkg}[1]{\texttt{#1}}
\providecommand*{\env}[1]{\texttt{#1}}
\providecommand*{\com}[1]{\texttt{\char`\\#1}}
\providecommand*{\meta}[1]{$\langle$\textit{#1}$\rangle$}
\setcounter{topnumber}{1}

\def\TEXTBOX{Here goes first line of text \text

There goes second line of text

Thence goes third line of text \text

Hence goes fourth line of text}

\parskip0pt
\begin{document}

\chapter{Beside and Other Captions (Beta-Version Example)}

\begin{sl}
This example shows floats in one-column document in facing layouts.

\emph{Common float settings}\\
Font for float contents \verb|\small|;
\com{captionskip} is defined as 5pt;
separation between beside float boxes equals to 2\,em;
flag for captions beside framed object is true (frames will be defined later).
\begin{verbatim}
\usepackage[font=small,captionskip=5pt,
   capbesideframe=yes]{floatrow}
\end{verbatim}

\emph{Common caption settings.}\\
For caption text used \verb|\small| font;
caption label font bold;
label separated by period sign;
justification left;
one-line captions have the same alignment as multiline ones.
\begin{verbatim}
\usepackage[font=small,labelfont=bf,labelsep=period,
   justification=raggedright,singlelinecheck=no]{caption}
\end{verbatim}

\emph{Special caption settings for current float types.}

\emph{Figure.}\\
Label hangs on the left margin without label separator; justification left.
In beside captions label is placed above caption text.
\begin{verbatim}
\DeclareCaptionFormat{Hang}{\leftskip7cc\parindent0pt
  \noindent\llap{\hbox to\leftskip{#1#2\hfil}}#3\par}
\captionsetup[figure]%
   {format=Hang,labelsep=none,justification=raggedright}
\captionsetup[capbesidefigure]%
   {format=default,labelsep=newline}
\end{verbatim}

\emph{Textbox.}\\
Justification left.
For beside captions used \texttt{break} style (the \texttt{labelsep=none} won't help here, because of
\verb|\newline| command adds a glue at the end of line); justification right.
\begin{verbatim}
\captionsetup[textbox]{justification=raggedright}
\DeclareCaptionFormat{break}{#1#2\break#3}
\captionsetup[capbesidetextbox]%
  {format=break,labelsep=none,justification=raggedleft}
\end{verbatim}

\emph{Special settings for float types.}

\emph{Figure.}\\
For figures is used \texttt{Boxed} style;
captions always beside object and have width of margin (with separation);
they always placed on the left margin and separated by 1~cicero space;
object contents centered;
the default width of float object equals to text width;
float margins hang to the left by 7~cicero.

The wide figures (starred environment) put captions below object
\begin{verbatim}
\DeclareMarginSet{hangleft}%
  {\setfloatmargins{\hskip-7cc}{\hfill}}
\floatsetup[figure]{style=Boxed,
  capposition=beside,capbesidewidth=6cc,objectset=centering,
  capbesideposition=left,capbesidesep=cicero,
  floatwidth=\columnwidth,
  margins=hangleft}

\floatsetup[widefigure]{capposition=bottom}
\end{verbatim}

\emph{Textbox.}\\
The new float \env{textbox} uses corrected \texttt{Boxed} style;
caption always stays beside float object---on the left side;
the default width of float object 6 centimeters;
the default width of caption 4.5~cicero;
caption separated from objects by 1~cicero;
margins use settings which center float object;
object contents flushed to left margins;
\verb|\parindent|${{}=15}$\,pt, \verb|\parskip|${{}=2}$\,pt.

For wide text boxes caption placed below float object;
the default object width equals to text width;
float box alignment left.
\begin{verbatim}
\DeclareMarginSet{capleft}%
  {\setfloatmargins{\hfill}{\hfill\hskip\FCwidth}}

\DeclareObjectSet{indent}{\raggedright\parindent15pt\parskip2pt}

\floatsetup[textbox]{style=Boxed,
  frameset={\fboxrule=1pt\fboxsep=12pt},
  capposition=beside,capbesideposition=left,
  floatwidth=6cm,capbesidewidth=4.5cc,
  capbesidesep=cicero,margins=capleft,
  objectset=indent}

\floatsetup[widetextbox]{capposition=bottom,
  floatwidth=\columnwidth,margins=raggedright}
\end{verbatim}

\end{sl}

\widowpenalty10000

\def\text{{\mdseries
And more text and some more text and a bit more text and
a little more text and a little peace of text to fill space}}

\def\Text{{\mdseries
\text. \text. \text.  \text. \par \text. \text. \text.}}

\unitlength1.44pt
\ifx\pspicture\undefined\else\psset{unit=\unitlength}\fi
\bfseries
\clearpage

Example of plain \env{figure} environment (figure~\ref{float:plain:fig}).
\begin{figure}
  {\unitlength.85\unitlength\ifx\pspicture\undefined\else\psset{unit=\unitlength}\fi
  \input{BlackCat.picture}}%
  \caption{Plain figure}%
\label{float:plain:fig}%
\end{figure}%
\Text

\Text

Example of plain \env{textbox} environment (text~\ref{float:plain:text1}).
The width of object equals to 6\,cm.
\begin{textbox}
\TEXTBOX
\caption{Plain textbox without any settings}%
\label{float:plain:text1}%
\end{textbox}%
\Text

\Text

Example of plain \env{textbox} environment (text~\ref{float:plain:text2}) with defined width
\begin{verbatim}
\thisfloatsetup{floatwidth=8cm}
\end{verbatim}
This width is a bit more than \verb|\textwidth-2\captionwidth| value.

\thisfloatsetup{floatwidth=8cm}
\begin{textbox}
\TEXTBOX
\caption{Plain textbox. Width settings}%
\label{float:plain:text2}%
\end{textbox}%
\Text

\Text

Example of plain \env{textbox} environment (text~\ref{float:plain:text3}) with defined width
\begin{verbatim}
\thisfloatsetup{floatwidth=5cm}
\end{verbatim}
This width less than \verb|\textwidth-2\captionwidth| value.

\thisfloatsetup{floatwidth=5cm}
\begin{textbox}[!tb]
\TEXTBOX
\caption{Plain textbox. Width settings}%
\label{float:plain:text3}%
\end{textbox}%
\Text

Example of plain \env{figure} environment (figure~\ref{float:W:plain:fig2})
with predefined width${{}=5}$\,cm.
\begin{verbatim}
\thisfloatsetup{floatwidth=5cm}
\end{verbatim}
\thisfloatsetup{floatwidth=5cm}%floatrow
\begin{figure}
  {\unitlength.85\unitlength\ifx\pspicture\undefined\else\psset{unit=\unitlength}\fi
  \input{BlackCat.picture}}%
  \caption{Plain figure with changed width}%
  \label{float:W:plain:fig2}%
\end{figure}%
\Text

\Text


Example of two-column or wide plain figure (see figure~\ref{float:wide:fig3}).
\begin{figure*}
  {\unitlength.85\unitlength\ifx\pspicture\undefined\else\psset{unit=\unitlength}\fi
  \input{BlackCat.picture}}%
  \caption{%
Plain wide figure. \text}%
\label{float:wide:fig3}%
\end{figure*}%
\Text

\Text

\Text


Example of plain \env{figure} environment (figure~\ref{wfloat:W:plain:fig4})
with predefined width${{}=9}$\,cm.
\begin{verbatim}
\thisfloatsetup{floatwidth=9cm}
\end{verbatim}
The real width equals to 9\,cm${}+{}$margin width

\thisfloatsetup{floatwidth=9cm}
\begin{figure*}
  {\unitlength.85\unitlength\ifx\pspicture\undefined\else\psset{unit=\unitlength}\fi
  \input{BlackCat.picture}}%
  \caption{Plain figure with changed width}%
\label{wfloat:W:plain:fig4}%
\end{figure*}%

\Text

Example of plain ``wide'' \env{textbox} environment with predefined width
(see text~\ref{float:prewide:text5}).
\begin{verbatim}
\thisfloatsetup{floatwidth=.7\textwidth}
\end{verbatim}

\thisfloatsetup{floatwidth=.7\textwidth}
\begin{textbox*}
  \TEXTBOX
  \caption{Plain wide textbox. Changed width}%
  \label{float:prewide:text5}%
\end{textbox*}%

\Text

Example of plain ``wide'' \env{textbox} environment
(see text~\ref{float:wide:text6}).
\begin{textbox*}[!tbp]
\TEXTBOX
  \caption{Plain wide textbox}%
\label{float:wide:text6}%
\end{textbox*}%

\Text

\Text

Example of figure placed in \verb|\fcapside| (\verb|\floatbox| stuff for usage of beside captions);
the width of float box equals  to the width of graphics
(see figure~\ref{floatbox:FB:fig7}).
\begin{figure}
\fcapside[\FBwidth]
  {\unitlength2.8\unitlength\ifx\pspicture\undefined\else\psset{unit=\unitlength}\fi
  \input{TheCat.picture}}
  {\caption{%
Figure (\protect\com{ffigbox})
width of graphics}\label{floatbox:FB:fig7}}
\end{figure}%
\Text

\Text

Example of wide figure placed in \verb|\ffigbox| (\verb|\floatbox| stuff);
the width of float box equals  to the width of grahics
(see figure~\ref{floatbox:FB:fig8}).
\begin{figure*}
\ffigbox[\FBwidth]
  {\unitlength2.8\unitlength\ifx\pspicture\undefined\else\psset{unit=\unitlength}\fi
  \input{TheCat.picture}}
  {\caption{%
Wide figure (\protect\com{ffigbox})
width of graphics}\label{floatbox:FB:fig8}}
\end{figure*}%
\Text



\end{document}