Debian Codegraph @

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

raw
1 %frsample01 - sample head
2 %one column non-facing layout
3 %plain style for figures
4 %miscellaneous ruled style for textboxes
5 \input pictures
6 %\listfiles
7 \documentclass{book}
8
9 \usepackage{calc}
10 \usepackage{tabularx,array}
11 \usepackage{floatpagestyle}
12
13 \IfFileExists{pstricks.sty}{\usepackage{pstricks}\psset{unit=1pt}}{}
14
15 %load floatrow
16 \usepackage[font=small,footskip=.65\skip\footins,capbesideposition=inside,
17 footnoterule=limited,margins=centering,captionskip=5pt,facing=yes,
18 capbesidesep=quad,floatrowsep=quad]{floatrow}
19 \marginparwidth0pt
20 \usepackage{listpen}
21 % new float
22 \DeclareNewFloatType{textbox}{fileext=lor,name=Text,placement=tp}
23
24 \DeclareFloatVCode{textprerule}%
25 {{\hskip-6pt\vrule depth5ptwidth2pt\hrulefill
26 \vrule depth5ptwidth2pt\hspace*{-6pt}}\par\kern-3pt}
27 \DeclareFloatVCode{textmidrule}%
28 {\kern4pt\hrule\kern4pt}
29 \DeclareFloatVCode{textpostrule}%
30 {\par\kern-6pt
31 \hbox to\hsize{\hskip-6pt
32 \vrule height5ptwidth2pt\hrulefill
33 \vrule height5ptwidth2pt\hskip-6pt}\par\relax}
34
35 \DeclareFloatStyle{textbox}{style=BOXED,
36 frameset={\fboxsep6pt\fboxrule0pt},
37 framefit=yes,precode=textprerule,midcode=textmidrule,
38 postcode=textpostrule,heightadjust=all}
39
40 \DeclareFloatSeparators{textbox}{\kern6pt\vrule\kern6pt}
41 \DeclareObjectSet{textbox}{\raggedright\parindent15pt\parskip2pt}
42
43 \floatsetup[textbox]{style=textbox,capposition=bottom,
44 objectset=textbox,capbesidesep=textbox,
45 heightadjust=object,valign=t}
46
47 \newif\ifWideLayout
48
49 %load caption
50 \usepackage[font=small,labelfont=bf,labelsep=period,
51 justification=centerlast]{caption}[2004/11/28]
52
53 \newif\ifLoadSubcaption\LoadSubcaptiontrue
54 \usepackage{subcaption}
55 \DeclareCaptionSubType[alph]{figure}
56 \DeclareCaptionSubType[alph]{table}
57
58 \providecommand*\rightlast{\leftskip0ptplus1fil
59 \rightskip0ptplus-1fil\parfillskip0ptplus1fil}
60 \providecommand*\leftlast{\leftskip0pt\rightskip0pt\parfillskip0ptplus1fil}
61 \DeclareCaptionJustification{togglelast}
62 {\floatfacing*\rightlast\leftlast}
63 \captionsetup[floatbeside]{justification=togglelast}
64 \captionsetup[textbox]{justification=centerlast}
65
66 %load subfig
67 \newif\ifLoadSubfig
68 %\IfFileExists{subfig.sty}
69 %{\usepackage[justification=centerlast,captionskip=7pt]{subfig}
70 %
71 %\AtBeginDocument{\floatsetup{subfloatrowsep=columnsep}}
72 %
73 %\LoadSubfigtrue}{\LoadSubfigfalse}
74 \LoadSubfigfalse
75 %better put wrapfig before floatrow
76
77
78 \newif\ifLoadWrapfig
79 \IfFileExists{wrapfig.sty}
80 {\usepackage{wrapfig}\LoadWrapfigtrue}{\LoadWrapfigfalse}
81
82 \usepackage{floatpagestyle}
83 \let\wideemptyfloatpage\emptyfloatpage
84
85 \newif\ifLoadRotating
86 \IfFileExists{rotating.sty}
87 {\usepackage[figuresright]{rotating}
88
89 \DeclareMarginSet{expand}%
90 {\setfloatmargins
91 {\hfil}
92 {\hskip-\headsep\hskip-.7\headheight plus1fil}}
93 \floatsetup[rotfloat]{capbesideposition=right,margins=expand}
94 \LoadRotatingtrue}{\LoadRotatingfalse}
95
96 \providecommand*{\pkg}[1]{\texttt{#1}}
97 \providecommand*{\com}[1]{\texttt{\char`\\#1}}
98 \providecommand*{\env}[1]{\texttt{#1}}
99 \begin{document}
100
101 \chapter{Examples in One Column Document}
102
103 \begin{sl}
104 This example shows floats in one-column document.
105
106 \emph{Common float settings.}\\
107 Font for float contents \verb|\small|; skips before foot material half reduced;
108 skip between caption above/below and object also half reduced;
109 footnote rule has maximal width$1$\,in (the maximal width defined by \verb|\frulemax| command); separation between
110 beside caption and object equals to 1\,em; separation between beside float
111 boxes also equals to 1\,em.
112 \begin{verbatim}
113 \usepackage[font=small,footskip=.65\skip\footins,
114 capbesideposition=inside,footnoterule=limited,
115 margins=centering,captionskip=5pt,facing=yes,
116 capbesidesep=quad,floatrowsep=quad]{floatrow}
117 \end{verbatim}
118
119 \emph{Common caption settings.}\\
120 For caption text used \verb|\small| font, caption label font bold, separated
121 by period sign, justification centerlast (last line centered).
122 \begin{verbatim}
123 \usepackage[font=small,labelfont=bf,labelsep=period,
124 justification=centerlast]{caption}
125 \end{verbatim}
126
127 \emph{Common subcaption settings.}\\
128 Justification centerlast (last line centered). The skip between caption and object enlarged to 7\,pt.
129 \begin{verbatim}
130 \usepackage[captionskip=7pt]{subfig}
131 \end{verbatim}
132
133 \emph{Special settings for float types.}
134
135 \emph{Textbox.}\\
136 The new float \env{textbox} uses special ruled style: there are defined three new options
137 \texttt{textprerule}, \texttt{textmidrule}, and \texttt{textpostrule}.
138 Please note that, in the case of usage of \env{floatrow} environment where float boxes must be aligned,
139 the rule below float must have total height no more than 2~pt to get correct alignment,
140 so first goes compensate vertical space.
141 \begin{verbatim}
142 \DeclareFloatVCode{textprerule}%
143 {{\hskip-6pt\vrule depth5ptwidth2pt\hrulefill
144 \vrule depth5ptwidth2pt\hspace*{-6pt}}\par\kern-3pt}
145 \DeclareFloatVCode{textmidrule}%
146 {\kern4pt\hrule\kern4pt}
147 \DeclareFloatVCode{textpostrule}%
148 {\par\kern-6pt
149 \hbox to\hsize{\hskip-6pt
150 \vrule height5ptwidth2pt\hrulefill
151 \vrule height5ptwidth2pt\hskip-6pt}\par\relax}
152
153 \DeclareFloatStyle{textbox}{style=BOXED,
154 frameset={\fboxsep6pt\fboxrule0pt},
155 framefit=yes,precode=textprerule,midcode=textmidrule,
156 postcode=textpostrule,heightadjust=all}
157
158 \DeclareFloatSeparators{textbox}{\kern6pt\vrule\kern6pt}
159 \DeclareObjectSet{textbox}{\raggedright\parindent15pt\parskip2pt}
160
161 \floatsetup[textbox]{style=textbox,capposition=bottom,
162 objectset=textbox,capbesidesep=textbox,
163 heightadjust=object,valign=t}
164 \end{verbatim}
165
166 \emph{Special settings for special float layout.}
167
168 \emph{Rotated.}\\
169 For rotated floats beside caption placed to right side of object;
170 right side expanded to the top of running head. To delete running head from pages
171 with rotated float was used \verb|\emptyfloatpage| macro\footnote{In current example the
172 \protect\com{wideemptyfloatpage} command is the synonym.} and
173 loaded \pkg{floatpagestyle} package.
174 \begin{verbatim}
175 \DeclareMarginSet{expand}%
176 {\setfloatmargins
177 {\hfil}
178 {\hskip-\headsep\hskip-.7\headheight plus1fil}}
179 \floatsetup[rotfloat]{capbesideposition=right,margins=expand}
180 \end{verbatim}
181
182 \emph{Beside caption.}\\
183 There was set of changed \verb|\captionsetup| for alignment of beside captions.
184 There was created special justification: the last line of beside caption flushed to
185 object side.
186 \begin{verbatim}
187 \DeclareCaptionJustification{togglelast}
188 {\floatfacing*\rightlast\leftlast}
189 \captionsetup[floatbeside]{justification=togglelast}
190 \end{verbatim}
191
192 \end{sl}
193
194 \input fr-sample
195
196 \end{document}