summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/floatrow/frsample12.tex
blob: afd694fc8994a8771b265b7c505a84c8c5b031e1 (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
%frsample03 - sample head
%two-column layout with attempts of usage colored float styles
%figures use colored Boxed style
%textboxes use colored rules (like ruled style)
\input pictures
\listfiles
\documentclass[twocolumn]{book}

\IfFileExists{color.sty}{}{\errmessage{This sample file needs `color' package}{}\stop}
\usepackage{color}
\usepackage{calc}
\usepackage{tabularx,array}
\usepackage{floatpagestyle}

\marginparwidth0pt
%load floatrow
\usepackage[font={small,sf},
   footskip=.5\skip\footins,
   footnoterule=limited,
   captionskip=5pt,
   margins=raggedright,
   objectset=raggedright,
   capbesidesep=qquad,
   floatrowsep=quad,
   capbesideposition=inside,
   facing=yes]%
   {floatrow}
\usepackage{fr-fancy}

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

%load subfig
\newif\ifLoadSubfig
\IfFileExists{subfig.sty}
{\usepackage[justification=centerlast,captionskip=7pt,
   farskip=0pt]{subfig}
\LoadSubfigtrue}{\LoadSubfigfalse}

\DeclareColorBox{forfigure}{\fcolorbox{red}{yellow}}
\DeclareObjectSet{colorblue}{\color{blue}}

\floatsetup[figure]{framestyle=colorbox,
  colorframeset=forfigure,
  objectset=colorblue,
  frameset={\fboxrule1pt\fboxsep6pt},
  capbesideframe=yes,
  framearound=object,framefit=yes,
  heightadjust=object}

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

\DeclareFloatVCode{rulei}%
  {\begingroup
    \color{blue}%
    \hrule height1.8ptdepth0pt\kern2pt%
   \endgroup}
\DeclareFloatVCode{ruleii}%
  {\begingroup
    \color{blue}%
    \kern5pt\hrule height1.8pt depth0pt%
    \kern5pt
   \endgroup}
\DeclareObjectSet{colorred}
   {\parskip2pt\color{red}}
\DeclareFloatSeparators{colorsep}%
  {\begingroup
    \color{blue}%
    \floatfacing
     {\hskip14pt
      \vrule width1.8pt\hskip2pt}%
     {\hskip2pt
      \vrule width1.8pt\hskip14pt}%
   \endgroup}
\floatsetup[textbox]{precode=rulei,
   midcode=ruleii,
   capposition=bottom,
   objectset=colorred,
   floatrowsep=qquad,
   heightadjust=all,valign=t}
\captionsetup[textbox]{format=hang}

\floatsetup[capbesidetextbox]%
   {precode=none,capbesidesep=colorsep,
    capbesideframe=no}
\providecommand*\rightlast{\leftskip0ptplus1fil
  \rightskip0ptplus-1fil\parfillskip0ptplus1fil}
\providecommand*\leftlast{\leftskip0pt
\rightskip0pt\parfillskip0ptplus1fil}
\DeclareCaptionJustification{togglelast}
  {\floatfacing*\rightlast\leftlast}
\makeatother
\captionsetup[floatbeside]%
   {format=default,labelsep=newline,
   justification=togglelast}
\captionsetup[capbesidetextbox]%
   {format=default,labelsep=newline,
   justification=togglelast}

\newif\ifLoadRotating
\IfFileExists{rotating.sty}
{\usepackage[figuresright]{rotating}

\DeclareMarginSet{sideways}%
  {\setfloatmargins
    {}{\hskip.5\topskip plus1fil}}
\floatsetup[rotfloat]{%
   capbesideposition={right,top},
   margins=sideways,facing=no}%for facing caption `facing=no' prohibited

\newif\ifWideLayout\WideLayouttrue

\DeclareMarginSet{widesideways}%
   {\setfloatmargins{}%
     {\hskip-\headsep
     \hskip-.7\headheight plus1fil}}
\floatsetup[widerotfloat]{%
   capbesideposition={right,center},
   capbesideframe=no,
   margins=widesideways,facing=no}
\LoadRotatingtrue}{\LoadRotatingfalse}

\newif\ifLoadWrapfig
\IfFileExists{wrapfig.sty}
{\usepackage{wrapfig}
\LoadWrapfigtrue}{\LoadWrapfigfalse}

\let\wideemptyfloatpage\emptyfloatpage
\let\emptyfloatpage\relax

\providecommand*{\pkg}[1]{\texttt{#1}}
\providecommand*{\com}[1]{\texttt{\char`\\#1}}
\begin{document}

\unitlength1.44pt

\chapter{Two Column Document and Color (Beta-Version Example)}

\begin{sl}
This example shows floats in two-column document.
There are also color settings.

\emph{Common float settings.}
Font for float contents \verb|\small| sans serif;
skips before foot material half reduced;
skip between caption and object also half reduced;
footnote rule has maximum width${{}\approx27}$\,mm;
box alignment and justification of object contents flushed to left margin;
separation between beside caption and object equals to 2\,em; separation
between beside float boxes also equals to 1\,em.
\begin{verbatim}
\usepackage[font={small,sf},
   footskip=.5\skip\footins,
   footnoterule=limited,
   captionskip=5pt,
   margins=raggedright,
   objectset=raggedright,
   capbesidesep=qquad,
   floatrowsep=quad]{floatrow}
\end{verbatim}

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

\emph{Common subcaption settings.}
Justification centerlast (last line centered). The value of \verb|\farskip|
equals zero (to avoid unwanted colored space in tables).
\begin{verbatim}
\usepackage[justification=centerlast,
   farskip=0pt]{subfig}
\end{verbatim}

\emph{Special settings for float types.}\\
\emph{Figure.}
For figures is used box around float object, box width reduced to
current \verb|\hsize|, heights of boxes adjusted in float row
(float style was `gathered' by \verb|\floatsetup| keys),
beside captions aligned to the edges of frame, footnote rule absent.
\begin{verbatim}
\floatsetup[figure]{framestyle=doublebox,
  capbesideframe=yes,
  framearound=object,framefit=yes,
  heightadjust=object,footnoterule=none}
\end{verbatim}
\emph{Textbox.}
The new float textbox uses defined colored thick rules above and below,
(defined by \verb|\DeclareFloatVCode| and macros);
object contents have red color and \verb|\parskip|${={}}2$\,pt;
floats in float row separated by 2\,em space.\\
Captions use hanged label.
\begin{verbatim}
\DeclareNewFloatType{textbox}%
   {fileext=lor,name=Text,placement=tp}

\DeclareFloatVCode{rulei}%
  {\begingroup
    \color{blue}%
    \hrule height1.8ptdepth0pt\kern2pt%
   \endgroup}
\DeclareFloatVCode{ruleii}%
  {\begingroup
    \color{blue}%
    \kern2pt\hrule height1.8pt depth0pt%
    \kern5pt
   \endgroup}
\DeclareObjectSet{colorred}
   {\parskip2pt\color{red}}
\DeclareFloatSeparators{colorsep}%
  {\begingroup
    \color{blue}%
    \floatfacing
     {\hskip14pt
      \vrule width1.8pt\hskip2pt}%
     {\hskip2pt
      \vrule width1.8pt\hskip14pt}%
   \endgroup}
\floatsetup[textbox]{precode=rulei,
   midcode=ruleii,
   capposition=bottom,
   objectset=colorred,
   floatrowsep=qquad,
   heightadjust=object}

\captionsetup[textbox]{format=hang}
\end{verbatim}
\emph{Textbox with beside caption.}
For beside captions the rules above and below were replaced by vertical
separate rule. Caption label placed in separate line.
\begin{verbatim}
\floatsetup[capbesidetextbox]%
   {precode=none,capbesidesep=colorsep}

\captionsetup[capbesidetextbox]%
   {format=default,labelsep=newline}
\end{verbatim}

\emph{Special settings for special float layout.}\\
\emph{Rotated.}
For rotated floats created special settings to align visual top of rotated
float with beside text column was created spacial alignment; beside captions
positioned to the right from object contents and top aligned.
\begin{verbatim}
\DeclareMarginSet{sideways}%
  {\setfloatmargins
    {}{\hskip.5\topskip plus1fil}}
\floatsetup[rotfloat]{%
   capbesideposition={right,top},
   margins=sideways}
\end{verbatim}
\emph{Wide rotated.}
For wide or two-column (starred)
environment right side expanded to the top of running head. To delete running
head from pages with wide rotated float there was used \verb|\emptyfloatpage|
command from loaded \pkg{floatpagestyle} package\footnote{In current example
\protect\com{wideemptyfloatpage} does work of \protect\com{emptyfloatpage};
\protect\com{emptyfloatpage} equals to \protect\com{relax}.}; beside captions
positioned to the right from object contents and vertically centered.
\begin{verbatim}
\DeclareMarginSet{widesideways}%
   {\setfloatmargins{}%
     {\hskip-\headsep
     \hskip-.7\headheight plus1fil}}
\floatsetup[widerotfloat]{%
   capbesideposition={right,center},
   capbesideframe=no,
   margins=widesideways}
\end{verbatim}

\end{sl}

\input fr-sample

\end{document}