Debian Codegraph @

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

raw
1 %frsample03 - sample head
2 %two-column layout with attempts of usage colored float styles
3 %figures use colored Boxed style
4 %textboxes use colored rules (like ruled style)
5 \input pictures
6 \listfiles
7 \documentclass[twocolumn]{book}
8
9 \IfFileExists{color.sty}{}{\errmessage{This sample file needs `color' package}{}\stop}
10 \usepackage{color}
11 \usepackage{calc}
12 \usepackage{tabularx,array}
13 \usepackage{floatpagestyle}
14
15 \marginparwidth0pt
16 %load floatrow
17 \usepackage[font={small,sf},
18 footskip=.5\skip\footins,
19 footnoterule=limited,
20 captionskip=5pt,
21 margins=raggedright,
22 objectset=raggedright,
23 capbesidesep=qquad,
24 floatrowsep=quad,
25 capbesideposition=inside,
26 facing=yes]%
27 {floatrow}
28 \usepackage{fr-fancy}
29
30 %load caption
31 \usepackage[font=small,labelfont=bf,
32 labelsep=period,justification=justified,
33 singlelinecheck=no]{caption}[2004/11/28]
34
35 %load subfig
36 \newif\ifLoadSubfig
37 \IfFileExists{subfig.sty}
38 {\usepackage[justification=centerlast,captionskip=7pt,
39 farskip=0pt]{subfig}
40 \LoadSubfigtrue}{\LoadSubfigfalse}
41
42 \DeclareColorBox{forfigure}{\fcolorbox{red}{yellow}}
43 \DeclareObjectSet{colorblue}{\color{blue}}
44
45 \floatsetup[figure]{framestyle=colorbox,
46 colorframeset=forfigure,
47 objectset=colorblue,
48 frameset={\fboxrule1pt\fboxsep6pt},
49 capbesideframe=yes,
50 framearound=object,framefit=yes,
51 heightadjust=object}
52
53 % new float
54 \DeclareNewFloatType{textbox}%
55 {fileext=lor,name=Text,placement=tp}
56
57 \DeclareFloatVCode{rulei}%
58 {\begingroup
59 \color{blue}%
60 \hrule height1.8ptdepth0pt\kern2pt%
61 \endgroup}
62 \DeclareFloatVCode{ruleii}%
63 {\begingroup
64 \color{blue}%
65 \kern5pt\hrule height1.8pt depth0pt%
66 \kern5pt
67 \endgroup}
68 \DeclareObjectSet{colorred}
69 {\parskip2pt\color{red}}
70 \DeclareFloatSeparators{colorsep}%
71 {\begingroup
72 \color{blue}%
73 \floatfacing
74 {\hskip14pt
75 \vrule width1.8pt\hskip2pt}%
76 {\hskip2pt
77 \vrule width1.8pt\hskip14pt}%
78 \endgroup}
79 \floatsetup[textbox]{precode=rulei,
80 midcode=ruleii,
81 capposition=bottom,
82 objectset=colorred,
83 floatrowsep=qquad,
84 heightadjust=all,valign=t}
85 \captionsetup[textbox]{format=hang}
86
87 \floatsetup[capbesidetextbox]%
88 {precode=none,capbesidesep=colorsep,
89 capbesideframe=no}
90 \providecommand*\rightlast{\leftskip0ptplus1fil
91 \rightskip0ptplus-1fil\parfillskip0ptplus1fil}
92 \providecommand*\leftlast{\leftskip0pt
93 \rightskip0pt\parfillskip0ptplus1fil}
94 \DeclareCaptionJustification{togglelast}
95 {\floatfacing*\rightlast\leftlast}
96 \makeatother
97 \captionsetup[floatbeside]%
98 {format=default,labelsep=newline,
99 justification=togglelast}
100 \captionsetup[capbesidetextbox]%
101 {format=default,labelsep=newline,
102 justification=togglelast}
103
104 \newif\ifLoadRotating
105 \IfFileExists{rotating.sty}
106 {\usepackage[figuresright]{rotating}
107
108 \DeclareMarginSet{sideways}%
109 {\setfloatmargins
110 {}{\hskip.5\topskip plus1fil}}
111 \floatsetup[rotfloat]{%
112 capbesideposition={right,top},
113 margins=sideways,facing=no}%for facing caption `facing=no' prohibited
114
115 \newif\ifWideLayout\WideLayouttrue
116
117 \DeclareMarginSet{widesideways}%
118 {\setfloatmargins{}%
119 {\hskip-\headsep
120 \hskip-.7\headheight plus1fil}}
121 \floatsetup[widerotfloat]{%
122 capbesideposition={right,center},
123 capbesideframe=no,
124 margins=widesideways,facing=no}
125 \LoadRotatingtrue}{\LoadRotatingfalse}
126
127 \newif\ifLoadWrapfig
128 \IfFileExists{wrapfig.sty}
129 {\usepackage{wrapfig}
130 \LoadWrapfigtrue}{\LoadWrapfigfalse}
131
132 \let\wideemptyfloatpage\emptyfloatpage
133 \let\emptyfloatpage\relax
134
135 \providecommand*{\pkg}[1]{\texttt{#1}}
136 \providecommand*{\com}[1]{\texttt{\char`\\#1}}
137 \begin{document}
138
139 \unitlength1.44pt
140
141 \onecolumn
142 \begingroup
143
144 \chapter{Two Column Document and Color (Beta-Version Example)}
145
146 \begin{sl}\fontsize{11}{13.6}\selectfont
147 This example shows floats in two-column document.
148 There are also color settings.
149
150 \emph{Common float settings.}
151 Font for float contents \verb|\small| sans serif;
152 skips before foot material half reduced;
153 skip between caption and object also half reduced;
154 footnote rule has maximum width${{}\approx27}$\,mm;
155 box alignment and justification of object contents flushed to left margin;
156 separation between beside caption and object equals to 2\,em; separation
157 between beside float boxes also equals to 1\,em.
158 \begin{verbatim}
159 \usepackage[font={small,sf},footskip=.5\skip\footins,footnoterule=limited,
160 captionskip=5pt,margins=raggedright,objectset=raggedright,
161 capbesidesep=qquad,floatrowsep=quad]{floatrow}
162 \end{verbatim}
163
164 \emph{Common caption settings.}
165 For caption text used \verb|\small| font, caption label font bold, separated
166 by period sign, justification justified.
167 \begin{verbatim}
168 \usepackage[font=small,labelfont=bf,labelsep=period,justification=justified,
169 singlelinecheck=no]{caption}
170 \end{verbatim}
171
172 \emph{Common subcaption settings.}
173 Justification centerlast (last line centered). The value of \verb|\farskip|
174 equals zero (to avoid unwanted colored space in tables).
175 \begin{verbatim}
176 \usepackage[justification=centerlast,farskip=0pt]{subfig}
177 \end{verbatim}
178
179 \emph{Special settings for float types.}\\
180 \emph{Figure.}
181 For figures is used box around float object, box width reduced to
182 current \verb|\hsize|, heights of boxes adjusted in float row
183 (float style was `gathered' by \verb|\floatsetup| keys),
184 beside captions aligned to the edges of frame, footnote rule absent.
185 \begin{verbatim}
186 \floatsetup[figure]{framestyle=doublebox,capbesideframe=yes,
187 framearound=object,framefit=yes,heightadjust=object,footnoterule=none}
188 \end{verbatim}
189 \emph{Textbox.}
190 The new float textbox uses defined colored thick rules above and below,
191 (defined by \verb|\DeclareFloatVCode| and macros);
192 object contents have red color and \verb|\parskip|${={}}2$\,pt;
193 floats in float row separated by 2\,em space.\\
194 Captions use hanged label.
195 \begin{verbatim}
196 \DeclareNewFloatType{textbox}{fileext=lor,name=Text,placement=tp}
197
198 \DeclareFloatVCode{rulei}{\begingroup
199 \color{blue}\hrule height1.8ptdepth0pt\kern2pt\endgroup}
200 \DeclareFloatVCode{ruleii}%
201 {\begingroup\color{blue}\kern2pt\hrule height1.8pt depth0pt\kern5pt\endgroup}
202 \DeclareObjectSet{colorred}{\parskip2pt\color{red}}
203 \DeclareFloatSeparators{colorsep}{\begingroup
204 \color{blue}\floatfacing{\hskip14pt\vrule width1.8pt\hskip2pt}%
205 {\hskip2pt\vrule width1.8pt\hskip14pt}\endgroup}
206 \floatsetup[textbox]{precode=rulei,midcode=ruleii,capposition=bottom,
207 objectset=colorred,floatrowsep=qquad,heightadjust=object}
208
209 \captionsetup[textbox]{format=hang}
210 \end{verbatim}
211 \emph{Textbox with beside caption.}
212 For beside captions the rules above and below were replaced by vertical
213 separate rule. Caption label placed in separate line.
214 \begin{verbatim}
215 \floatsetup[capbesidetextbox]{precode=none,capbesidesep=colorsep}
216
217 \captionsetup[capbesidetextbox]{format=default,labelsep=newline}
218 \end{verbatim}
219
220 \emph{Special settings for special float layout.}\\
221 \emph{Rotated.}
222 For rotated floats created special settings to align visual top of rotated
223 float with beside text column was created spacial alignment; beside captions
224 positioned to the right from object contents and top aligned.
225 \begin{verbatim}
226 \DeclareMarginSet{sideways}{\setfloatmargins{}{\hskip.5\topskip plus1fil}}
227 \floatsetup[rotfloat]{capbesideposition={right,top},margins=sideways}
228 \end{verbatim}
229 \emph{Wide rotated.}
230 For wide or two-column (starred)
231 environment right side expanded to the top of running head. To delete running
232 head from pages with wide rotated float there was used \verb|\emptyfloatpage|
233 command from loaded \pkg{floatpagestyle} package\footnote{In current example
234 \protect\com{wideemptyfloatpage} does work of \protect\com{emptyfloatpage};
235 \protect\com{emptyfloatpage} equals to \protect\com{relax}.}; beside captions
236 positioned to the right from object contents and vertically centered.
237 \begin{verbatim}
238 \DeclareMarginSet{widesideways}%
239 {\setfloatmargins{}{\hskip-\headsep\hskip-.7\headheight plus1fil}}
240 \floatsetup[widerotfloat]{capbesideposition={right,center},
241 capbesideframe=no,margins=widesideways}
242 \end{verbatim}
243
244 \end{sl}
245
246 \endgroup
247
248 \twocolumn
249
250 \input fr-sample
251
252 \end{document}