summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/floatrow/frsample10.tex
blob: fe7ba8e579f981e4e9a3f4a55be3d8e9aa0d80a4 (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
%frsample01 - sample head
%one column non-facing layout
%plain style for figures
%miscellaneous ruled style for textboxes
\input pictures
%\listfiles
\documentclass{book}

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

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

%load floatrow
\usepackage[font=small,footskip=.65\skip\footins,capbesideposition=inside,
   footnoterule=limited,margins=centering,captionskip=5pt,facing=yes,
   capbesidesep=quad,floatrowsep=quad]{floatrow}
\marginparwidth0pt
\usepackage{listpen}
% new float
\DeclareNewFloatType{textbox}{fileext=lor,name=Text,placement=tp}

\DeclareFloatVCode{textprerule}%
  {{\hskip-6pt\vrule depth5ptwidth2pt\hrulefill
    \vrule depth5ptwidth2pt\hspace*{-6pt}}\par\kern-3pt}
\DeclareFloatVCode{textmidrule}%
  {\kern4pt\hrule\kern4pt}
\DeclareFloatVCode{textpostrule}%
  {\par\kern-6pt
   \hbox to\hsize{\hskip-6pt
   \vrule height5ptwidth2pt\hrulefill
   \vrule height5ptwidth2pt\hskip-6pt}\par\relax}

\DeclareFloatStyle{textbox}{style=BOXED,
  frameset={\fboxsep6pt\fboxrule0pt},
  framefit=yes,precode=textprerule,midcode=textmidrule,
  postcode=textpostrule,heightadjust=all}

\DeclareFloatSeparators{textbox}{\kern6pt\vrule\kern6pt}
\DeclareObjectSet{textbox}{\raggedright\parindent15pt\parskip2pt}

\floatsetup[textbox]{style=textbox,capposition=bottom,
   objectset=textbox,capbesidesep=textbox,
   heightadjust=object,valign=t}

\newif\ifWideLayout

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

\newif\ifLoadSubcaption\LoadSubcaptiontrue
\usepackage{subcaption}
\DeclareCaptionSubType[alph]{figure}
\DeclareCaptionSubType[alph]{table}

\providecommand*\rightlast{\leftskip0ptplus1fil
  \rightskip0ptplus-1fil\parfillskip0ptplus1fil}
\providecommand*\leftlast{\leftskip0pt\rightskip0pt\parfillskip0ptplus1fil}
\DeclareCaptionJustification{togglelast}
  {\floatfacing*\rightlast\leftlast}
\captionsetup[floatbeside]{justification=togglelast}
\captionsetup[textbox]{justification=centerlast}

%load subfig
\newif\ifLoadSubfig
%\IfFileExists{subfig.sty}
%{\usepackage[justification=centerlast,captionskip=7pt]{subfig}
%
%\AtBeginDocument{\floatsetup{subfloatrowsep=columnsep}}
%
%\LoadSubfigtrue}{\LoadSubfigfalse}
\LoadSubfigfalse
%better put wrapfig before floatrow


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

\usepackage{floatpagestyle}
\let\wideemptyfloatpage\emptyfloatpage

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

\DeclareMarginSet{expand}%
  {\setfloatmargins
    {\hfil}
    {\hskip-\headsep\hskip-.7\headheight plus1fil}}
\floatsetup[rotfloat]{capbesideposition=right,margins=expand}
\LoadRotatingtrue}{\LoadRotatingfalse}

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

\chapter{Examples in One Column Document}

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

\emph{Common float settings.}\\
Font for float contents \verb|\small|; skips before foot material half reduced;
skip between caption above/below and object also half reduced;
footnote rule has maximal width$1$\,in (the maximal width defined by \verb|\frulemax| command); separation between
beside caption and object equals to 1\,em; separation between beside float
boxes also equals to 1\,em.
\begin{verbatim}
\usepackage[font=small,footskip=.65\skip\footins,
   capbesideposition=inside,footnoterule=limited,
   margins=centering,captionskip=5pt,facing=yes,
   capbesidesep=quad,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 centerlast (last line centered).
\begin{verbatim}
\usepackage[font=small,labelfont=bf,labelsep=period,
   justification=centerlast]{caption}
\end{verbatim}

\emph{Common subcaption settings.}\\
Justification centerlast (last line centered). The skip between caption and object enlarged to 7\,pt.
\begin{verbatim}
\usepackage[captionskip=7pt]{subfig}
\end{verbatim}

\emph{Special settings for float types.}

\emph{Textbox.}\\
The new float \env{textbox} uses special ruled style: there are defined three new options
\texttt{textprerule}, \texttt{textmidrule}, and \texttt{textpostrule}.
Please note that, in the case of usage of \env{floatrow} environment where float boxes must be aligned,
the rule below float must have total height no more than 2~pt to get correct alignment,
so first goes compensate vertical space.
\begin{verbatim}
\DeclareFloatVCode{textprerule}%
  {{\hskip-6pt\vrule depth5ptwidth2pt\hrulefill
    \vrule depth5ptwidth2pt\hspace*{-6pt}}\par\kern-3pt}
\DeclareFloatVCode{textmidrule}%
  {\kern4pt\hrule\kern4pt}
\DeclareFloatVCode{textpostrule}%
  {\par\kern-6pt
   \hbox to\hsize{\hskip-6pt
   \vrule height5ptwidth2pt\hrulefill
   \vrule height5ptwidth2pt\hskip-6pt}\par\relax}

\DeclareFloatStyle{textbox}{style=BOXED,
  frameset={\fboxsep6pt\fboxrule0pt},
  framefit=yes,precode=textprerule,midcode=textmidrule,
  postcode=textpostrule,heightadjust=all}

\DeclareFloatSeparators{textbox}{\kern6pt\vrule\kern6pt}
\DeclareObjectSet{textbox}{\raggedright\parindent15pt\parskip2pt}

\floatsetup[textbox]{style=textbox,capposition=bottom,
   objectset=textbox,capbesidesep=textbox,
   heightadjust=object,valign=t}
\end{verbatim}

\emph{Special settings for special float layout.}

\emph{Rotated.}\\
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}
\end{verbatim}

\emph{Beside caption.}\\
There was set of changed \verb|\captionsetup| for alignment of beside captions.
There was created special justification: the last line of beside caption flushed to
object side.
\begin{verbatim}
\DeclareCaptionJustification{togglelast}
  {\floatfacing*\rightlast\leftlast}
\captionsetup[floatbeside]{justification=togglelast}
\end{verbatim}

\end{sl}

\input fr-sample

\end{document}