summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/floatrow/frsample01.tex
blob: 7b07fb89f146cad51d2fdccf1b30cbbbf51619cc (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
%sample file
%all possible combinations of predefined floatrow styles
%plain environments and float rows
%caption above/below float object
\documentclass{book}

\usepackage[footskip=4pt,objectset=centering]{floatrow}

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

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

%%%try with fancy shadowbox frame
%%%there is the trick: base boxed and BOXED styles changed to use shadowbox frame
%\usepackage{fr-fancy}
%\DeclareFloatStyle{boxed}{capposition=bottom,captionskip=2pt,
%  framestyle=shadowbox,heightadjust=object,framearound=object}
%\DeclareFloatStyle{BOXED}{capposition=bottom,framestyle=shadowbox,
%  framefit=yes,heightadjust=all,framearound=all}

\setlength\textfloatsep{8ptplus2ptminus2pt}
\setlength\intextsep{8ptplus2ptminus2pt}
\advance\textheight2in
\advance\topmargin-.75in
\hbadness2000
\advance\textwidth.5in
\advance\evensidemargin-.25in
\advance\oddsidemargin-.25in

\begin{document}
\chapter{Float Boxes with Foots: Variants of Layout}

In this sample file are gathered plain float environments and float rows
with usage of all predefined base float styles. You may try to run this document
with \texttt{shadowbox} frame: uncomment line with \verb|\usepackage{fr-fancy}|
at the preamble and lines below.

The default vertical alignment of float objects is centered.
To change alignment to top edge you may say:
\begin{verbatim}
\floatsetup{valign=t}
\end{verbatim}
like in current sample.
Keys are analogous to option of vertical alignment in minipage and \verb|\parbox|:
\texttt{t}---for top alignment, \texttt{c}---for center alignment,
\texttt{b}---for bottom alignment, and \texttt{s}---to stretch float object material
to full height.

\emph{Note}. All float styles with frames get \verb|frameset={\fboxsep7.5pt}|
to get more visible differences between fitted and non-fitted frames.

%%%aligns float objects by top
\floatsetup{valign=t}

\newcommand\PICTURE[4]{\begin{picture}(#1,#2)
  \put(0,0){\line(#3,#4){#1}}\put(0,0){\line(1,0){#1}}\put(0,0){\line(0,1){#2}}
  \put(0,#2){\line(#3,-#4){#1}}\put(0,#2){\line(1,0){#1}}
  \put(#1,0){\line(0,1){#2}}
  \end{picture}}
\newcommand\FIGS[5][]{
\clearpage
\markboth
{{\small Variant #3: \texttt{style=#2,capposition=#4,footposition=#5}}}
{{\small Variant #3: \texttt{style=#2,capposition=#4,footposition=#5}}}

\noindent Var.\,#3: \protect\com{floatsetup}\texttt{\{style=#2,\allowbreak capposition=#4,\allowbreak
footposition=#5\}}

\clearfloatsetup{figure}
\floatsetup[figure]{style=#2,capposition=#4,footposition=#5#1
%%%you may try to create row with usage of predefined height uncomment next line
%%%and [150] few lines below
%,heightadjust=all
}
\begingroup\samepage
\begin{figure}[H]
  {\PICTURE{20}{20}11}%
  \caption{%
Plain figure in \texttt{#2} style. Caption position \texttt{#4}}%
\label{fig:plain:#3}%
\floatfoot{\sloppy Much more, more and more and more and more and more and more and more text inside macro
\protect\com{floatfoot}}%
\end{figure}

\medskip
\strut\vrule
\medskip

\begin{figure}[H]
\begin{floatrow}[3]
\floatbox{figure}
{\caption{Beside figure in float row, ``column'' width. And more text\protect\footnote{\texttt{footpos=#5}}}}
{\PICTURE{20}{20}11%
\floatfoot{\sloppy Text inside \protect\com{floatfoot}}%
\label{figI:#2:row:#3}}

\floatbox{figure}[\FBwidth]
{\caption{Beside figure, graphic width\strut}\label{figII:#2:row:#3}}
{\PICTURE{96}{48}21%
\floatfoot{\sloppy More and more text inside the \protect\com{floatfoot}}}

%%%you may try to create float rows with usage of predefined height - uncomment [150pt]
%%%and key heightadjust in \floatsetup few lines above
\floatbox{figure}[\Xhsize]%[150pt]
{\caption{Beside figure in float row. Float row in \texttt{#2} style, caption \texttt{#4}}}
{\PICTURE{35}{35}11%
\floatfoot{\sloppy Much more, more and more, more and more text inside \protect\com{floatfoot}}%
\label{figIII:#2:row:#3}}
\end{floatrow}
\end{figure}

\medskip
\strut\vrule
\medskip

\captionof{figure}{Alone caption inside \protect\com{captionof}}

\medskip
\strut\vrule
\medskip

\captionof*{figure}{Alone starred caption inside \protect\com{captionof*}}

\medskip
\strut\vrule
\medskip

\floatbox{figure}{}{\caption{Alone caption inside \protect\com{floatbox}. Float row in \texttt{#2} style, caption \texttt{#4}. The next goes alone graphics inside \protect\com{floatbox}. The last goes row of the alone graphics}}

\medskip
\strut\vrule
\medskip

\floatbox{figure}{\PICTURE{35}{35}11}{}

\medskip
\strut\vrule
\medskip

\begin{figure}[H]
\begin{floatrow}[3]
\floatbox{figure}
{}
{\PICTURE{20}{20}11}

\floatbox{figure}[\FBwidth]
{}
{\PICTURE{96}{48}21}

\floatbox{figure}[\Xhsize]%[150pt]
{}
{\PICTURE{35}{35}11}
\end{floatrow}
\end{figure}

\endgroup}

\clearpage\raggedright
%
\FIGS[,frameset={\fboxsep7.5pt}]{BOXED}{I}{TOP}{caption}
\FIGS[,frameset={\fboxsep7.5pt}]{BOXED}{II}{bottom}{caption}

\FIGS{Ruled}{III}{TOP}{caption}
\FIGS{Ruled}{IV}{bottom}{caption}

\FIGS[,frameset={\fboxsep7.5pt}]{Boxed}{V}{TOP}{caption}
\FIGS[,frameset={\fboxsep7.5pt}]{Boxed}{VI}{bottom}{caption}

%
\FIGS[,frameset={\fboxsep7.5pt}]{BOXED}{VII}{TOP}{default}
\FIGS[,frameset={\fboxsep7.5pt}]{BOXED}{VIII}{bottom}{default}

\FIGS{Ruled}{IX}{TOP}{default}
\FIGS{Ruled}{X}{bottom}{default}

\FIGS[,frameset={\fboxsep7.5pt}]{Boxed}{XI}{TOP}{default}
\FIGS[,frameset={\fboxsep7.5pt}]{Boxed}{XII}{bottom}{default}

%
\FIGS[,frameset={\fboxsep7.5pt}]{BOXED}{XIII}{TOP}{bottom}
\FIGS{Ruled}{XIV}{TOP}{bottom}

\FIGS[,frameset={\fboxsep7.5pt}]{Boxed}{XV}{TOP}{bottom}

\clearpage
\textbf{The next variants (XVI--XXI) show layout of framed styles
with key \texttt{framefit=no}; \texttt{boxed} style (native style of \textsf{float} package),
and \texttt{BOXED} with added key \texttt{framefit=no}.}
\vfill\vbox{}\vfill

\floatsetup{floatrowsep=qquad}
\clearpage
\FIGS[,frameset={\fboxsep7.5pt}]{boxed}{XVI}{TOP}{caption}
\FIGS[,framefit=no,frameset={\fboxsep7.5pt}]{BOXED}{XVII}{TOP}{caption}

\FIGS[,frameset={\fboxsep7.5pt}]{boxed}{XVIII}{TOP}{default}
\FIGS[,framefit=no,frameset={\fboxsep7.5pt}]{BOXED}{XIX}{TOP}{default}

\FIGS[,frameset={\fboxsep7.5pt}]{boxed}{XX}{TOP}{bottom}
\FIGS[,framefit=no,frameset={\fboxsep7.5pt}]{BOXED}{XXI}{TOP}{bottom}

\FIGS{plain}{XXII}{TOP}{caption}
\FIGS{plain}{XXIII}{bottom}{caption}

\FIGS{plain}{XXIV}{TOP}{default}
\FIGS{plain}{XXV}{bottom}{default}

\FIGS{plain}{XXVI}{TOP}{bottom}

\end{document}