| 1 |
%frsample06 - sample |
| 2 |
%one-column facing layout with miscellaneous caption settings |
| 3 |
\input pictures |
| 4 |
\documentclass{book} |
| 5 |
|
| 6 |
\usepackage{calc} |
| 7 |
\usepackage{tabularx,array} |
| 8 |
\usepackage{floatpagestyle} |
| 9 |
|
| 10 |
\IfFileExists{fancyhdr.sty}{\RequirePackage{fancyhdr}\pagestyle{fancy}\fancyfoot{} |
| 11 |
\fancyhead[LE]{\leavevmode\hspace*{-\marginparwidth}\hskip-\marginparsep |
| 12 |
\def\arraystretch{1,2}\begin{tabular}{@{}l@{}} |
| 13 |
\rlap{\thepage}\hskip\marginparwidth\hskip\marginparsep |
| 14 |
\hbox to\textwidth{\slshape\leftmark\hfill}\\\hline\end{tabular}} |
| 15 |
\fancyhead[LO]{\leavevmode |
| 16 |
\def\arraystretch{1,2}\begin{tabular}{@{}l@{}} |
| 17 |
\hbox to\textwidth{\hfill\slshape\rightmark} |
| 18 |
\hskip\marginparwidth\hskip\marginparsep\llap{\thepage} \\ |
| 19 |
\hline\end{tabular}\hskip-\marginparsep |
| 20 |
\hspace*{-\marginparwidth}} |
| 21 |
\fancyhead[RE]{}\fancyhead[CE]{} |
| 22 |
\fancyhead[RO]{}\fancyhead[CO]{} |
| 23 |
\def\headrulewidth{0pt}} |
| 24 |
{\pagestyle{plain}} |
| 25 |
|
| 26 |
%load floatrow |
| 27 |
\usepackage{floatrow} |
| 28 |
|
| 29 |
%load caption |
| 30 |
\usepackage[font=small,labelfont=bf,labelsep=period, |
| 31 |
singlelinecheck=no]{caption}[2004/11/28] |
| 32 |
|
| 33 |
%load subfig |
| 34 |
\newif\ifLoadSubfig |
| 35 |
\IfFileExists{subfig.sty}{\usepackage[justification=raggedright, |
| 36 |
singlelinecheck=no,captionskip=7pt]{subfig} |
| 37 |
\LoadSubfigtrue}{\LoadSubfigfalse} |
| 38 |
|
| 39 |
\LoadSubfigfalse |
| 40 |
|
| 41 |
\DeclareNewFloatType{textbox}{fileext=lor,name=Text,placement=tp} |
| 42 |
|
| 43 |
\DeclareObjectSet{indent}{\raggedright\parindent15pt\parskip2pt} |
| 44 |
|
| 45 |
\floatsetup[textbox]{style=Boxed,heightadjust=all, |
| 46 |
frameset={\fboxrule=1pt\fboxsep=12pt}, |
| 47 |
margins=raggedright,captionskip=7pt, |
| 48 |
capposition=bottom,objectset=indent, |
| 49 |
capbesideframe=yes,capbesideposition=outside, |
| 50 |
capbesidewidth=\marginparwidth,valign=t} |
| 51 |
|
| 52 |
%\DeclareMarginSet{hangoutside}% |
| 53 |
% {\setfloatmargins* |
| 54 |
% {\hfil}{\hskip-\marginparwidth\hskip-\marginparsep}} |
| 55 |
|
| 56 |
\floatsetup[widetextbox]{margins=hangoutside,facing=yes, |
| 57 |
floatwidth=\textwidth} |
| 58 |
\floatsetup[textboxrow]{floatwidth=sidefil} |
| 59 |
%\makeatletter |
| 60 |
%\DeclareCaptionFormat{hangorbreak}{\FBiffloatrow{#1#2#3\par |
| 61 |
% }{\@hangfrom{#1#2}% |
| 62 |
% \advance\caption@parindent\hangindent |
| 63 |
% \advance\caption@hangindent\hangindent |
| 64 |
% #3\par |
| 65 |
% }} |
| 66 |
%\makeatother |
| 67 |
|
| 68 |
\DeclareCaptionFormat{marginpars}{\vbox to0pt{\RaggedRight\FBifcaptop\vss\relax |
| 69 |
\floatfacing |
| 70 |
{\addtolength\leftskip{\textwidth+1em}}% |
| 71 |
{\addtolength\rightskip{\textwidth+1em}}% |
| 72 |
#1\par#3% |
| 73 |
\FBifcaptop\relax\vss}} |
| 74 |
|
| 75 |
\captionsetup[textbox]{justification=justified,format=hang} |
| 76 |
\captionsetup[textboxrow]{justification=justified,format=default,labelsep=newline} |
| 77 |
|
| 78 |
\captionsetup[capbesidetextbox]{justification=raggedright, |
| 79 |
format=default,labelsep=newline} |
| 80 |
|
| 81 |
\captionsetup[widetextbox]{format=marginpars} |
| 82 |
|
| 83 |
\newif\ifLoadRotating |
| 84 |
\IfFileExists{rotating.sty} |
| 85 |
{\usepackage[figuresright]{rotating} |
| 86 |
\DeclareMarginSet{expand}% |
| 87 |
{\setfloatmargins |
| 88 |
{\hfil}{\hskip-\headsep\hskip-.7\headheight plus1fil}} |
| 89 |
|
| 90 |
\floatsetup[rotfloat]{capbesideposition=right,margins=expand, |
| 91 |
facing=no,capbesidewidth=none} |
| 92 |
\LoadRotatingtrue}{\LoadRotatingfalse} |
| 93 |
|
| 94 |
\let\wideemptyfloatpage\emptyfloatpage |
| 95 |
|
| 96 |
\providecommand*{\pkg}[1]{\texttt{#1}} |
| 97 |
\providecommand*{\com}[1]{\texttt{\char`\\#1}} |
| 98 |
\providecommand*{\Lopt}[1]{\textsf{#1}} |
| 99 |
\providecommand*{\file}[1]{\texttt{#1}} |
| 100 |
\providecommand*{\env}[1]{\texttt{#1}} |
| 101 |
\providecommand*{\meta}[1]{$\langle$\textit{#1}$\rangle$} |
| 102 |
|
| 103 |
\newfloatcommand{ttextbox}{textbox} |
| 104 |
|
| 105 |
\makeatletter |
| 106 |
\newcommand\ifTwocolumn{\if@twocolumn} |
| 107 |
\newcommand\Resizebox[5]{\setbox0\hbox{\setlength\unitlength{#1/#3}{#5}}% |
| 108 |
\@tempdima\ht0\advance\@tempdima\dp0% |
| 109 |
\ifdim\@tempdima>#2\setlength\unitlength{#2/#4}{#5}\else\box0\fi} |
| 110 |
\makeatother |
| 111 |
|
| 112 |
\def\text{{\mdseries And more text and some more text and a bit more text and |
| 113 |
a little more text and a little peace of text to fill space}} |
| 114 |
|
| 115 |
\def\Text{{\mdseries \text. \text. \text. \text.} } |
| 116 |
|
| 117 |
\unitlength1.44pt |
| 118 |
|
| 119 |
\newcommand\TEXTBOX[1][]{% |
| 120 |
Here goes first line of text \text\par |
| 121 |
There goes second line of text#1\par |
| 122 |
Thence goes third line of text \text\par |
| 123 |
Hence goes fourth line of text} |
| 124 |
|
| 125 |
\begin{document} |
| 126 |
\providecommand\RaggedRight{\raggedright} |
| 127 |
|
| 128 |
\chapter{One Column Facing~Document |
| 129 |
(Beta-Version~Example)} |
| 130 |
\markboth{One Column Facing Document}{One Column Facing Document} |
| 131 |
\begin{sl} |
| 132 |
This example shows floats in one-column document in facing layouts. |
| 133 |
|
| 134 |
\emph{Common caption settings.}\\ |
| 135 |
For caption text used \verb|\small| font; |
| 136 |
caption label font bold, separated |
| 137 |
by period sign. |
| 138 |
\begin{verbatim} |
| 139 |
\usepackage[font=small,labelfont=bf,labelsep=period, |
| 140 |
singlelinecheck=no]{caption} |
| 141 |
\end{verbatim} |
| 142 |
|
| 143 |
\emph{Special caption settings for current float types.} |
| 144 |
|
| 145 |
\emph{Textbox.}\\ |
| 146 |
Justified alignment. |
| 147 |
If float stays alone caption label hangs to the left; |
| 148 |
if float stays in \env{floatrow} environment---there is used normal float style (with in-line caption label). |
| 149 |
|
| 150 |
In beside captions caption label stays separately on line. Justification left. |
| 151 |
|
| 152 |
For captions in wide floats (which climb out to the left margin) used miscellaneous format, |
| 153 |
which in \env{floatrow} environment restored to normal. |
| 154 |
\begin{verbatim} |
| 155 |
\makeatletter |
| 156 |
\DeclareCaptionFormat{hangorbreak}{\FBiffloatrow#1#2#3\par |
| 157 |
\else\@hangfrom{#1#2}% |
| 158 |
\advance\captionparindent\hangindent |
| 159 |
\advance\captionhangindent\hangindent |
| 160 |
#3\par\fi} |
| 161 |
\makeatother |
| 162 |
|
| 163 |
\DeclareCaptionFormat{marginpars}{\FBiffloatrow#1#2#3\par |
| 164 |
\else |
| 165 |
\vbox to0pt{\RaggedRight\FBifcaptop\vss\fi |
| 166 |
\floatfacing |
| 167 |
{\addtolength\leftskip{\textwidth+1em}}% |
| 168 |
{\addtolength\rightskip{\textwidth+1em}}% |
| 169 |
#1\par#3% |
| 170 |
\FBifcaptop\else\vss\fi}\fi} |
| 171 |
|
| 172 |
\captionsetup[textbox]{justification=justified, |
| 173 |
format=hangorbreak} |
| 174 |
|
| 175 |
\captionsetup[capbesidetextbox]{justification=raggedright, |
| 176 |
format=default,labelsep=newline} |
| 177 |
|
| 178 |
\captionsetup[widetextbox]{format=marginpars} |
| 179 |
\end{verbatim} |
| 180 |
|
| 181 |
\emph{Common subcaption settings.}\\ |
| 182 |
Justification left. One line subcaptions have the same alignment. |
| 183 |
\begin{verbatim} |
| 184 |
\usepackage[justification=raggedright, |
| 185 |
singlelinecheck=no]{subfig} |
| 186 |
\end{verbatim} |
| 187 |
|
| 188 |
\emph{Special settings for float types.} |
| 189 |
|
| 190 |
\emph{Textbox.}\\ |
| 191 |
The new float textbox uses |
| 192 |
corrected \texttt{Boxed} style; object contents flushed to left margins; |
| 193 |
\verb|\captionskip| defined as 7~pt; |
| 194 |
captions below objects; |
| 195 |
object contents; alignment: \verb|\parindent|${{}=15}$\,pt, \verb|\parskip|${{}=2}$\,pt; |
| 196 |
beside captions aligned to frames; |
| 197 |
width of beside captions equals to margin width; |
| 198 |
objects aligned by top line. |
| 199 |
\begin{verbatim} |
| 200 |
\DeclareObjectSet{indent}{\raggedright\parindent15pt\parskip2pt} |
| 201 |
|
| 202 |
\floatsetup[textbox]{style=Boxed,heightadjust=all, |
| 203 |
frameset={\fboxrule=1pt\fboxsep=12pt}, |
| 204 |
margins=raggedright,captionskip=7pt, |
| 205 |
capposition=bottom,objectset=indent, |
| 206 |
capbesideframe=yes,capbesideposition=outside, |
| 207 |
capbesidewidth=\marginparwidth,valign=t} |
| 208 |
\end{verbatim} |
| 209 |
|
| 210 |
\emph{Special settings for special float layout.} |
| 211 |
|
| 212 |
\emph{Wide float.}\\ |
| 213 |
For wide float set hanged indentation to binder margin; |
| 214 |
the default width of object equals ti text width; |
| 215 |
The facing control switched on. |
| 216 |
\begin{verbatim} |
| 217 |
\DeclareMarginSet{hangoutside}% |
| 218 |
{\setfloatmargins* |
| 219 |
{\hfil}{\hskip-\marginparwidth\hskip-\marginparsep}} |
| 220 |
|
| 221 |
\floatsetup[widetextbox]{margins=hangoutside,facing=yes, |
| 222 |
floatwidth=\textwidth} |
| 223 |
\end{verbatim} |
| 224 |
|
| 225 |
\emph{Rotated float.}\\ |
| 226 |
For rotated floats beside caption placed to right side of object; |
| 227 |
right side expanded to the top of running head. To delete running head from pages |
| 228 |
with rotated float was used \verb|\emptyfloatpage| macro\footnote{In current example the |
| 229 |
\protect\com{wideemptyfloatpage} command is the synonym.} and |
| 230 |
loaded \pkg{floatpagestyle} package. |
| 231 |
\begin{verbatim} |
| 232 |
\DeclareMarginSet{expand}% |
| 233 |
{\setfloatmargins |
| 234 |
{\hfil}{\hskip-\headsep\hskip-.7\headheight plus1fil}} |
| 235 |
|
| 236 |
\floatsetup[rotfloat]{capbesideposition=right,margins=expand, |
| 237 |
facing=no,capbesidewidth=none} |
| 238 |
\end{verbatim} |
| 239 |
|
| 240 |
For this document there was also used special page style for running heads |
| 241 |
using \pkg{fancyhdr}. If this style exists on your system the special page |
| 242 |
style will be loaded otherwise the \texttt{plain} page style used. |
| 243 |
\end{sl} |
| 244 |
|
| 245 |
\clearpage |
| 246 |
\bfseries |
| 247 |
|
| 248 |
Example of plain \env{textbox} environment (text~\ref{float:plain:text}). |
| 249 |
|
| 250 |
\tracingmacros=1 |
| 251 |
\begin{textbox} |
| 252 |
\TEXTBOX |
| 253 |
\caption{Plain \env{textbox} environment. \text }% |
| 254 |
\label{float:plain:text}% |
| 255 |
\end{textbox} |
| 256 |
|
| 257 |
\Text |
| 258 |
|
| 259 |
\clearpage |
| 260 |
|
| 261 |
Example of plain \env{textbox} environment (box~\ref{float:w:plain:Text}) |
| 262 |
with predefined width. |
| 263 |
\begin{verbatim} |
| 264 |
\thisfloatsetup{floatwidth=7cm} |
| 265 |
\end{verbatim} |
| 266 |
|
| 267 |
\thisfloatsetup{floatwidth=7cm} |
| 268 |
\begin{textbox} |
| 269 |
\caption{Plain \env{textbox} environment with predefined width. \text}\label{float:w:plain:Text} |
| 270 |
\TEXTBOX |
| 271 |
\end{textbox} |
| 272 |
|
| 273 |
\Text |
| 274 |
|
| 275 |
\clearpage |
| 276 |
|
| 277 |
Example of textbox placed in \verb|\ttextbox| (\verb|\floatbox| stuff); |
| 278 |
the width of float box equals to defined width |
| 279 |
(see text box~\ref{floatbox:FB:text}). |
| 280 |
\begin{verbatim} |
| 281 |
\ttextbox[.85\hsize] |
| 282 |
... |
| 283 |
\end{verbatim} |
| 284 |
|
| 285 |
\begin{textbox} |
| 286 |
\ttextbox[.85\hsize] |
| 287 |
{\TEXTBOX} |
| 288 |
{\caption{% |
| 289 |
The \env{textbox} environment including \protect\com{ttextbox} |
| 290 |
with defined width. \text}\label{floatbox:FB:text}} |
| 291 |
\end{textbox} |
| 292 |
|
| 293 |
\Text |
| 294 |
|
| 295 |
\ifLoadSubfig |
| 296 |
|
| 297 |
\clearpage |
| 298 |
Example of float with beside caption (see text box~\ref{floatbox:beside:text}) |
| 299 |
with two subboxes~\subref{subtext:A} and \subref{subtext:B}. |
| 300 |
These subfloats are placed inside \env{subfloatrow} environment, left subfloat has width 6\,cm, |
| 301 |
second---occupies the rest width of row. |
| 302 |
\begin{verbatim} |
| 303 |
\begin{textbox} |
| 304 |
\ttextbox |
| 305 |
{\vspace{-\topskip}\begin{subfloatrow} |
| 306 |
\subfloat[First ...\label{...}]{\vbox{\hsize6cm...}} |
| 307 |
|
| 308 |
\subfloat[Second ...\label{...}]{\vbox{\hsize\Xhsize...}} |
| 309 |
\end{subfloatrow}} |
| 310 |
{\caption{...}\label{...}} |
| 311 |
\end{textbox} |
| 312 |
\end{verbatim} |
| 313 |
|
| 314 |
Since the \verb|\subfloat| macro uses \verb|\vtop| during subfloat building, before \env{subfloatrow} |
| 315 |
environment was placed compensated space |
| 316 |
\begin{verbatim} |
| 317 |
\vspace{-\topskip} |
| 318 |
\end{verbatim} |
| 319 |
|
| 320 |
\begin{textbox} |
| 321 |
\ttextbox |
| 322 |
{\vspace{-\topskip}\begin{subfloatrow} |
| 323 |
\subfloat[First text box\label{subtext:A}]% |
| 324 |
{\vbox{\hsize6cm\TEXTBOX}} |
| 325 |
|
| 326 |
\subfloat[Second text box with long long subcaption\label{subtext:B}]% |
| 327 |
{\vbox{\hsize\Xhsize\TEXTBOX}} |
| 328 |
\end{subfloatrow}} |
| 329 |
{\caption{The \env{textbox} environment with subfloats. \text}% |
| 330 |
\label{floatbox:subfloat:text}} |
| 331 |
\end{textbox} |
| 332 |
|
| 333 |
%\Text |
| 334 |
|
| 335 |
\fi |
| 336 |
|
| 337 |
\ifTwocolumn\else |
| 338 |
|
| 339 |
\clearpage |
| 340 |
|
| 341 |
Example of text box with beside caption (see box~\ref{floatbox:subfloat:text}). |
| 342 |
\begin{verbatim} |
| 343 |
\thisfloatsetup{capposition=beside,capbesidewidth=none} |
| 344 |
\end{verbatim} |
| 345 |
Since the \env{textbox} setup defines width for beside caption, there |
| 346 |
was redefined key \texttt{capbesidewidth=none}. |
| 347 |
Both caption and float object occupy 1``column'' width. |
| 348 |
|
| 349 |
\thisfloatsetup{capposition=beside,capbesidewidth=none} |
| 350 |
\begin{textbox} |
| 351 |
{\TEXTBOX} |
| 352 |
{\caption{Beside caption. The width of object equals |
| 353 |
to 1``column'' width. \text}% |
| 354 |
\label{floatbox:beside:text}} |
| 355 |
\end{textbox} |
| 356 |
|
| 357 |
\Text |
| 358 |
|
| 359 |
\fi |
| 360 |
|
| 361 |
\clearpage |
| 362 |
|
| 363 |
Examples of plain wide \env{textbox} environments |
| 364 |
(see text boxes~\ref{float:wide:text}--\ref{floatbox:wideii:text}). |
| 365 |
|
| 366 |
For text box \ref{floatbox:wideii:text} (at the bottom of page~\pageref{floatbox:wideii:text}) |
| 367 |
was redefined position of caption |
| 368 |
\begin{verbatim} |
| 369 |
\floatsetup[textbox]{capposition=top} |
| 370 |
\end{verbatim} |
| 371 |
inside group. |
| 372 |
|
| 373 |
\begin{textbox*} |
| 374 |
\TEXTBOX |
| 375 |
\caption{Plain wide textbox. \text }% |
| 376 |
\label{float:wide:text}% |
| 377 |
\end{textbox*} |
| 378 |
|
| 379 |
\Text |
| 380 |
|
| 381 |
\Text |
| 382 |
|
| 383 |
\Text |
| 384 |
|
| 385 |
\Text |
| 386 |
|
| 387 |
\Text |
| 388 |
\text. |
| 389 |
|
| 390 |
\Text |
| 391 |
|
| 392 |
\begin{textbox*}[h] |
| 393 |
{\TEXTBOX} |
| 394 |
{\caption{Plain wide textbox with \texttt{[h]} placement option. \text}% |
| 395 |
\label{floatbox:widei:text}} |
| 396 |
\end{textbox*} |
| 397 |
|
| 398 |
|
| 399 |
\Text |
| 400 |
\text. |
| 401 |
|
| 402 |
\begingroup |
| 403 |
\floatsetup[textbox]{capposition=top} |
| 404 |
\begin{textbox*}[b] |
| 405 |
{\TEXTBOX} |
| 406 |
{\caption{Plain wide textbox with \texttt{[b]} placement option. \text}% |
| 407 |
\label{floatbox:wideii:text}} |
| 408 |
\end{textbox*} |
| 409 |
\endgroup |
| 410 |
|
| 411 |
\text. |
| 412 |
\text. |
| 413 |
|
| 414 |
|
| 415 |
\clearpage |
| 416 |
|
| 417 |
Example of text box with beside caption (see text box~\ref{floatbox:wbeside:text}). |
| 418 |
The default settings of caption and text box width put text box' contents at the space of main |
| 419 |
text and caption at the space of marginal paragraphs. |
| 420 |
|
| 421 |
\thisfloatsetup{capposition=beside} |
| 422 |
\begin{textbox*} |
| 423 |
{\TEXTBOX} |
| 424 |
{\caption{Wide beside caption with default settings. \text}% |
| 425 |
\label{floatbox:wbeside:text}} |
| 426 |
\end{textbox*} |
| 427 |
|
| 428 |
\Text |
| 429 |
|
| 430 |
\Text |
| 431 |
|
| 432 |
\Text |
| 433 |
|
| 434 |
\clearpage |
| 435 |
|
| 436 |
Example of row with two textboxes |
| 437 |
(boxes~\ref{row:text:I}--\ref{row:text:II}). |
| 438 |
|
| 439 |
\begin{textbox*} |
| 440 |
\begin{floatrow} |
| 441 |
\ttextbox |
| 442 |
{\TEXTBOX\footnote{Text of footnote. \text}} |
| 443 |
{\caption{Beside text~I in float row. \text}% |
| 444 |
\label{row:text:I}}% |
| 445 |
|
| 446 |
\floatbox{textbox} |
| 447 |
{\TEXTBOX. \text. |
| 448 |
|
| 449 |
\floatfoot{Text of float foot. \text}}% |
| 450 |
{\caption{Beside text~II in float row}% |
| 451 |
\label{row:text:II}}% |
| 452 |
\end{floatrow} |
| 453 |
\end{textbox*} |
| 454 |
|
| 455 |
\Text |
| 456 |
|
| 457 |
\ifLoadRotating |
| 458 |
\newlength\rotatedheight\rotatedheight\textwidth |
| 459 |
|
| 460 |
\clearpage |
| 461 |
|
| 462 |
Example of plain rotated text box with beside caption |
| 463 |
(see figure~\ref{rot:beside:text} on page~\pageref{rot:beside:text}). |
| 464 |
|
| 465 |
\thisfloatsetup{capposition=beside} |
| 466 |
\begin{sidewaystextbox} |
| 467 |
\emptyfloatpage |
| 468 |
{\TEXTBOX[ \text.]} |
| 469 |
{\caption{Beside caption. \text. \text. \text}% |
| 470 |
\label{rot:beside:text}} |
| 471 |
\end{sidewaystextbox} |
| 472 |
|
| 473 |
\Text |
| 474 |
|
| 475 |
\Text |
| 476 |
|
| 477 |
\clearpage |
| 478 |
|
| 479 |
Example of rotated float row with text boxes |
| 480 |
(see texts~\ref{row:textI:I}--\ref{row:textI:II} on page~\pageref{row:textI:II}). |
| 481 |
|
| 482 |
\begin{sidewaystextbox} |
| 483 |
\wideemptyfloatpage |
| 484 |
\begin{floatrow} |
| 485 |
\ttextbox |
| 486 |
{\TEXTBOX\par\TEXTBOX\footnote |
| 487 |
{Text of footnote. \text}} |
| 488 |
{\caption{Beside text~I. \text}% |
| 489 |
\label{row:textI:I}}% |
| 490 |
|
| 491 |
\floatbox{textbox} |
| 492 |
{\caption{Beside text~II}% |
| 493 |
\label{row:textI:II}% |
| 494 |
\floatfoot{Text of float foot. \text}% |
| 495 |
}% |
| 496 |
{\TEXTBOX[ \text.]}% |
| 497 |
\end{floatrow} |
| 498 |
\end{sidewaystextbox} |
| 499 |
|
| 500 |
\Text \Text \Text |
| 501 |
|
| 502 |
\Text \Text |
| 503 |
|
| 504 |
\fi |
| 505 |
|
| 506 |
\end{document} |