summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/floatrow/frsample05.tex
blob: 3c8585acfc7ef7db8899107207bffb5504067a1c (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
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
%frsample06 - sample
%one-column facing layout with miscellaneous caption settings
\input pictures
\documentclass{book}

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

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

%load floatrow
\usepackage{floatrow}

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

%load subfig
\newif\ifLoadSubfig
\IfFileExists{subfig.sty}{\usepackage[justification=raggedright,
   singlelinecheck=no,captionskip=7pt]{subfig}
\LoadSubfigtrue}{\LoadSubfigfalse}

\LoadSubfigfalse

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

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

\floatsetup[textbox]{style=Boxed,heightadjust=all,
  frameset={\fboxrule=1pt\fboxsep=12pt},
  margins=raggedright,captionskip=7pt,
  capposition=bottom,objectset=indent,
  capbesideframe=yes,capbesideposition=outside,
  capbesidewidth=\marginparwidth,valign=t}

%\DeclareMarginSet{hangoutside}%
%  {\setfloatmargins*
%    {\hfil}{\hskip-\marginparwidth\hskip-\marginparsep}}

\floatsetup[widetextbox]{margins=hangoutside,facing=yes,
  floatwidth=\textwidth}
\floatsetup[textboxrow]{floatwidth=sidefil}
%\makeatletter
%\DeclareCaptionFormat{hangorbreak}{\FBiffloatrow{#1#2#3\par
%  }{\@hangfrom{#1#2}%
%    \advance\caption@parindent\hangindent
%    \advance\caption@hangindent\hangindent
%    #3\par
%  }}
%\makeatother

\DeclareCaptionFormat{marginpars}{\vbox to0pt{\RaggedRight\FBifcaptop\vss\relax
      \floatfacing
        {\addtolength\leftskip{\textwidth+1em}}%
        {\addtolength\rightskip{\textwidth+1em}}%
      #1\par#3%
      \FBifcaptop\relax\vss}}

\captionsetup[textbox]{justification=justified,format=hang}
\captionsetup[textboxrow]{justification=justified,format=default,labelsep=newline}

\captionsetup[capbesidetextbox]{justification=raggedright,
  format=default,labelsep=newline}

\captionsetup[widetextbox]{format=marginpars}

\newif\ifLoadRotating
\IfFileExists{rotating.sty}
{\usepackage[figuresright]{rotating}
\DeclareMarginSet{expand}%
  {\setfloatmargins
    {\hfil}{\hskip-\headsep\hskip-.7\headheight plus1fil}}

\floatsetup[rotfloat]{capbesideposition=right,margins=expand,
  facing=no,capbesidewidth=none}
\LoadRotatingtrue}{\LoadRotatingfalse}

\let\wideemptyfloatpage\emptyfloatpage

\providecommand*{\pkg}[1]{\texttt{#1}}
\providecommand*{\com}[1]{\texttt{\char`\\#1}}
\providecommand*{\Lopt}[1]{\textsf{#1}}
\providecommand*{\file}[1]{\texttt{#1}}
\providecommand*{\env}[1]{\texttt{#1}}
\providecommand*{\meta}[1]{$\langle$\textit{#1}$\rangle$}

\newfloatcommand{ttextbox}{textbox}

\makeatletter
\newcommand\ifTwocolumn{\if@twocolumn}
\newcommand\Resizebox[5]{\setbox0\hbox{\setlength\unitlength{#1/#3}{#5}}%
 \@tempdima\ht0\advance\@tempdima\dp0%
 \ifdim\@tempdima>#2\setlength\unitlength{#2/#4}{#5}\else\box0\fi}
\makeatother

\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.} }

\unitlength1.44pt

\newcommand\TEXTBOX[1][]{%
Here goes first line of text \text\par
There goes second line of text#1\par
Thence goes third line of text \text\par
Hence goes fourth line of text}

\begin{document}
\providecommand\RaggedRight{\raggedright}

\chapter{One Column Facing~Document
(Beta-Version~Example)}
\markboth{One Column Facing Document}{One Column Facing Document}
\begin{sl}
This example shows floats in one-column document in facing layouts.

\emph{Common caption settings.}\\
For caption text used \verb|\small| font;
caption label font bold, separated
by period sign.
\begin{verbatim}
\usepackage[font=small,labelfont=bf,labelsep=period,
   singlelinecheck=no]{caption}
\end{verbatim}

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

\emph{Textbox.}\\
Justified alignment.
If float stays alone caption label hangs to the left;
if float stays in \env{floatrow} environment---there is used normal float style (with in-line caption label).

In beside captions caption label stays separately on line. Justification left.

For captions in wide floats (which climb out to the left margin) used miscellaneous format,
which in \env{floatrow} environment restored to normal.
\begin{verbatim}
\makeatletter
\DeclareCaptionFormat{hangorbreak}{\FBiffloatrow#1#2#3\par
  \else\@hangfrom{#1#2}%
    \advance\captionparindent\hangindent
    \advance\captionhangindent\hangindent
    #3\par\fi}
\makeatother

\DeclareCaptionFormat{marginpars}{\FBiffloatrow#1#2#3\par
  \else
    \vbox to0pt{\RaggedRight\FBifcaptop\vss\fi
      \floatfacing
        {\addtolength\leftskip{\textwidth+1em}}%
        {\addtolength\rightskip{\textwidth+1em}}%
      #1\par#3%
      \FBifcaptop\else\vss\fi}\fi}

\captionsetup[textbox]{justification=justified,
  format=hangorbreak}

\captionsetup[capbesidetextbox]{justification=raggedright,
  format=default,labelsep=newline}

\captionsetup[widetextbox]{format=marginpars}
\end{verbatim}

\emph{Common subcaption settings.}\\
Justification left. One line subcaptions have the same alignment.
\begin{verbatim}
\usepackage[justification=raggedright,
   singlelinecheck=no]{subfig}
\end{verbatim}

\emph{Special settings for float types.}

\emph{Textbox.}\\
The new float textbox uses
corrected \texttt{Boxed} style; object contents flushed to left margins;
\verb|\captionskip| defined as 7~pt;
captions below objects;
object contents; alignment: \verb|\parindent|${{}=15}$\,pt, \verb|\parskip|${{}=2}$\,pt;
beside captions aligned to frames;
width of beside captions equals to margin width;
objects aligned by top line.
\begin{verbatim}
\DeclareObjectSet{indent}{\raggedright\parindent15pt\parskip2pt}

\floatsetup[textbox]{style=Boxed,heightadjust=all,
  frameset={\fboxrule=1pt\fboxsep=12pt},
  margins=raggedright,captionskip=7pt,
  capposition=bottom,objectset=indent,
  capbesideframe=yes,capbesideposition=outside,
  capbesidewidth=\marginparwidth,valign=t}
\end{verbatim}

\emph{Special settings for special float layout.}

\emph{Wide float.}\\
For wide float set hanged indentation to binder margin;
the default width of object equals ti text width;
The facing control switched on.
\begin{verbatim}
\DeclareMarginSet{hangoutside}%
  {\setfloatmargins*
    {\hfil}{\hskip-\marginparwidth\hskip-\marginparsep}}

\floatsetup[widetextbox]{margins=hangoutside,facing=yes,
  floatwidth=\textwidth}
\end{verbatim}

\emph{Rotated float.}\\
For rotated floats beside caption placed to right side of object;
right side expanded to the top of running head. To delete running head from pages
with rotated float was used \verb|\emptyfloatpage| macro\footnote{In current example the
\protect\com{wideemptyfloatpage} command is the synonym.} and
loaded \pkg{floatpagestyle} package.
\begin{verbatim}
\DeclareMarginSet{expand}%
  {\setfloatmargins
    {\hfil}{\hskip-\headsep\hskip-.7\headheight plus1fil}}

\floatsetup[rotfloat]{capbesideposition=right,margins=expand,
  facing=no,capbesidewidth=none}
\end{verbatim}

For this document there was also used special page style for running heads
using \pkg{fancyhdr}. If this style exists on your system the special page
style will be loaded otherwise the \texttt{plain} page style used.
\end{sl}

\clearpage
\bfseries

Example of plain \env{textbox} environment (text~\ref{float:plain:text}).

\tracingmacros=1
\begin{textbox}
\TEXTBOX
\caption{Plain \env{textbox} environment. \text }%
\label{float:plain:text}%
\end{textbox}

\Text

\clearpage

Example of plain \env{textbox} environment (box~\ref{float:w:plain:Text})
with predefined width.
\begin{verbatim}
\thisfloatsetup{floatwidth=7cm}
\end{verbatim}

\thisfloatsetup{floatwidth=7cm}
\begin{textbox}
\caption{Plain  \env{textbox} environment with predefined width. \text}\label{float:w:plain:Text}
\TEXTBOX
\end{textbox}

\Text

\clearpage

Example of textbox placed in \verb|\ttextbox| (\verb|\floatbox| stuff);
the width of float box equals to defined width
(see text box~\ref{floatbox:FB:text}).
\begin{verbatim}
\ttextbox[.85\hsize]
   ...
\end{verbatim}

\begin{textbox}
\ttextbox[.85\hsize]
  {\TEXTBOX}
  {\caption{%
The \env{textbox} environment including \protect\com{ttextbox}
with defined width. \text}\label{floatbox:FB:text}}
\end{textbox}

\Text

\ifLoadSubfig

\clearpage
Example of float with beside caption (see text box~\ref{floatbox:beside:text})
with two subboxes~\subref{subtext:A} and \subref{subtext:B}.
These subfloats are placed inside \env{subfloatrow} environment, left subfloat has width 6\,cm,
second---occupies the rest width of row.
\begin{verbatim}
\begin{textbox}
\ttextbox
{\vspace{-\topskip}\begin{subfloatrow}
\subfloat[First ...\label{...}]{\vbox{\hsize6cm...}}

\subfloat[Second ...\label{...}]{\vbox{\hsize\Xhsize...}}
\end{subfloatrow}}
{\caption{...}\label{...}}
\end{textbox}
\end{verbatim}

Since the \verb|\subfloat| macro uses \verb|\vtop| during subfloat building, before \env{subfloatrow}
environment was placed compensated space
\begin{verbatim}
\vspace{-\topskip}
\end{verbatim}

\begin{textbox}
\ttextbox
{\vspace{-\topskip}\begin{subfloatrow}
\subfloat[First text box\label{subtext:A}]%
{\vbox{\hsize6cm\TEXTBOX}}

\subfloat[Second text box with long long subcaption\label{subtext:B}]%
{\vbox{\hsize\Xhsize\TEXTBOX}}
\end{subfloatrow}}
{\caption{The \env{textbox} environment with subfloats. \text}%
\label{floatbox:subfloat:text}}
\end{textbox}

%\Text

\fi

\ifTwocolumn\else

\clearpage

Example of text box with beside caption (see box~\ref{floatbox:subfloat:text}).
\begin{verbatim}
\thisfloatsetup{capposition=beside,capbesidewidth=none}
\end{verbatim}
Since the \env{textbox} setup defines width for beside caption, there
was redefined key \texttt{capbesidewidth=none}.
Both caption and float object occupy 1``column'' width.

\thisfloatsetup{capposition=beside,capbesidewidth=none}
\begin{textbox}
{\TEXTBOX}
{\caption{Beside caption. The width of object equals
to 1``column'' width. \text}%
\label{floatbox:beside:text}}
\end{textbox}

\Text

\fi

\clearpage

Examples of plain wide \env{textbox} environments
(see text boxes~\ref{float:wide:text}--\ref{floatbox:wideii:text}).

For text box \ref{floatbox:wideii:text}  (at the bottom of page~\pageref{floatbox:wideii:text})
was redefined position of caption
\begin{verbatim}
\floatsetup[textbox]{capposition=top}
\end{verbatim}
inside group.

\begin{textbox*}
\TEXTBOX
  \caption{Plain wide textbox. \text }%
\label{float:wide:text}%
\end{textbox*}

\Text

\Text

\Text

\Text

\Text
\text.

\Text

\begin{textbox*}[h]
{\TEXTBOX}
{\caption{Plain wide textbox with \texttt{[h]} placement option. \text}%
\label{floatbox:widei:text}}
\end{textbox*}


\Text
\text.

\begingroup
\floatsetup[textbox]{capposition=top}
\begin{textbox*}[b]
{\TEXTBOX}
{\caption{Plain wide textbox with \texttt{[b]} placement option. \text}%
\label{floatbox:wideii:text}}
\end{textbox*}
\endgroup

\text.
\text.


\clearpage

Example of text box with beside caption (see text box~\ref{floatbox:wbeside:text}).
The default settings of caption and text box width put text box' contents at the space of main
text and caption at the space of marginal paragraphs.

\thisfloatsetup{capposition=beside}
\begin{textbox*}
{\TEXTBOX}
{\caption{Wide beside caption with default settings. \text}%
\label{floatbox:wbeside:text}}
\end{textbox*}

\Text

\Text

\Text

\clearpage

Example of  row with two textboxes
(boxes~\ref{row:text:I}--\ref{row:text:II}).

\begin{textbox*}
\begin{floatrow}
\ttextbox
{\TEXTBOX\footnote{Text of footnote. \text}}
{\caption{Beside text~I in float row. \text}%
\label{row:text:I}}%

\floatbox{textbox}
{\TEXTBOX. \text.

\floatfoot{Text of float foot. \text}}%
{\caption{Beside text~II in float row}%
\label{row:text:II}}%
\end{floatrow}
\end{textbox*}

\Text

\ifLoadRotating
\newlength\rotatedheight\rotatedheight\textwidth

\clearpage

Example of plain rotated text box with beside caption
(see figure~\ref{rot:beside:text} on page~\pageref{rot:beside:text}).

\thisfloatsetup{capposition=beside}
\begin{sidewaystextbox}
\emptyfloatpage
{\TEXTBOX[ \text.]}
{\caption{Beside caption. \text. \text. \text}%
\label{rot:beside:text}}
\end{sidewaystextbox}

\Text

\Text

\clearpage

Example of rotated float row with text boxes
(see texts~\ref{row:textI:I}--\ref{row:textI:II} on page~\pageref{row:textI:II}).

\begin{sidewaystextbox}
\wideemptyfloatpage
\begin{floatrow}
\ttextbox
{\TEXTBOX\par\TEXTBOX\footnote
{Text of footnote. \text}}
{\caption{Beside text~I. \text}%
\label{row:textI:I}}%

\floatbox{textbox}
{\caption{Beside text~II}%
\label{row:textI:II}%
\floatfoot{Text of float foot. \text}%
}%
{\TEXTBOX[ \text.]}%
\end{floatrow}
\end{sidewaystextbox}

\Text \Text \Text

\Text \Text

\fi

\end{document}