%frsample03 - sample head %two-column layout with attempts of usage colored float styles %figures use colored Boxed style %textboxes use colored rules (like ruled style) \input pictures \listfiles \documentclass[twocolumn]{book} \IfFileExists{color.sty}{}{\errmessage{This sample file needs `color' package}{}\stop} \usepackage{color} \usepackage{calc} \usepackage{tabularx,array} \usepackage{floatpagestyle} \marginparwidth0pt %load floatrow \usepackage[font={small,sf}, footskip=.5\skip\footins, footnoterule=limited, captionskip=5pt, margins=raggedright, objectset=raggedright, capbesidesep=qquad, floatrowsep=quad, capbesideposition=inside, facing=yes]% {floatrow} \usepackage{fr-fancy} %load caption \usepackage[font=small,labelfont=bf, labelsep=period,justification=justified, singlelinecheck=no]{caption}[2004/11/28] %load subfig \newif\ifLoadSubfig \IfFileExists{subfig.sty} {\usepackage[justification=centerlast,captionskip=7pt, farskip=0pt]{subfig} \LoadSubfigtrue}{\LoadSubfigfalse} \DeclareColorBox{forfigure}{\fcolorbox{red}{yellow}} \DeclareObjectSet{colorblue}{\color{blue}} \floatsetup[figure]{framestyle=colorbox, colorframeset=forfigure, objectset=colorblue, frameset={\fboxrule1pt\fboxsep6pt}, capbesideframe=yes, framearound=object,framefit=yes, heightadjust=object} % new float \DeclareNewFloatType{textbox}% {fileext=lor,name=Text,placement=tp} \DeclareFloatVCode{rulei}% {\begingroup \color{blue}% \hrule height1.8ptdepth0pt\kern2pt% \endgroup} \DeclareFloatVCode{ruleii}% {\begingroup \color{blue}% \kern5pt\hrule height1.8pt depth0pt% \kern5pt \endgroup} \DeclareObjectSet{colorred} {\parskip2pt\color{red}} \DeclareFloatSeparators{colorsep}% {\begingroup \color{blue}% \floatfacing {\hskip14pt \vrule width1.8pt\hskip2pt}% {\hskip2pt \vrule width1.8pt\hskip14pt}% \endgroup} \floatsetup[textbox]{precode=rulei, midcode=ruleii, capposition=bottom, objectset=colorred, floatrowsep=qquad, heightadjust=all,valign=t} \captionsetup[textbox]{format=hang} \floatsetup[capbesidetextbox]% {precode=none,capbesidesep=colorsep, capbesideframe=no} \providecommand*\rightlast{\leftskip0ptplus1fil \rightskip0ptplus-1fil\parfillskip0ptplus1fil} \providecommand*\leftlast{\leftskip0pt \rightskip0pt\parfillskip0ptplus1fil} \DeclareCaptionJustification{togglelast} {\floatfacing*\rightlast\leftlast} \makeatother \captionsetup[floatbeside]% {format=default,labelsep=newline, justification=togglelast} \captionsetup[capbesidetextbox]% {format=default,labelsep=newline, justification=togglelast} \newif\ifLoadRotating \IfFileExists{rotating.sty} {\usepackage[figuresright]{rotating} \DeclareMarginSet{sideways}% {\setfloatmargins {}{\hskip.5\topskip plus1fil}} \floatsetup[rotfloat]{% capbesideposition={right,top}, margins=sideways,facing=no}%for facing caption `facing=no' prohibited \newif\ifWideLayout\WideLayouttrue \DeclareMarginSet{widesideways}% {\setfloatmargins{}% {\hskip-\headsep \hskip-.7\headheight plus1fil}} \floatsetup[widerotfloat]{% capbesideposition={right,center}, capbesideframe=no, margins=widesideways,facing=no} \LoadRotatingtrue}{\LoadRotatingfalse} \newif\ifLoadWrapfig \IfFileExists{wrapfig.sty} {\usepackage{wrapfig} \LoadWrapfigtrue}{\LoadWrapfigfalse} \let\wideemptyfloatpage\emptyfloatpage \let\emptyfloatpage\relax \providecommand*{\pkg}[1]{\texttt{#1}} \providecommand*{\com}[1]{\texttt{\char`\\#1}} \begin{document} \unitlength1.44pt \onecolumn \begingroup \chapter{Two Column Document and Color (Beta-Version Example)} \begin{sl}\fontsize{11}{13.6}\selectfont This example shows floats in two-column document. There are also color settings. \emph{Common float settings.} Font for float contents \verb|\small| sans serif; skips before foot material half reduced; skip between caption and object also half reduced; footnote rule has maximum width${{}\approx27}$\,mm; box alignment and justification of object contents flushed to left margin; separation between beside caption and object equals to 2\,em; separation between beside float boxes also equals to 1\,em. \begin{verbatim} \usepackage[font={small,sf},footskip=.5\skip\footins,footnoterule=limited, captionskip=5pt,margins=raggedright,objectset=raggedright, capbesidesep=qquad,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 justified. \begin{verbatim} \usepackage[font=small,labelfont=bf,labelsep=period,justification=justified, singlelinecheck=no]{caption} \end{verbatim} \emph{Common subcaption settings.} Justification centerlast (last line centered). The value of \verb|\farskip| equals zero (to avoid unwanted colored space in tables). \begin{verbatim} \usepackage[justification=centerlast,farskip=0pt]{subfig} \end{verbatim} \emph{Special settings for float types.}\\ \emph{Figure.} For figures is used box around float object, box width reduced to current \verb|\hsize|, heights of boxes adjusted in float row (float style was `gathered' by \verb|\floatsetup| keys), beside captions aligned to the edges of frame, footnote rule absent. \begin{verbatim} \floatsetup[figure]{framestyle=doublebox,capbesideframe=yes, framearound=object,framefit=yes,heightadjust=object,footnoterule=none} \end{verbatim} \emph{Textbox.} The new float textbox uses defined colored thick rules above and below, (defined by \verb|\DeclareFloatVCode| and macros); object contents have red color and \verb|\parskip|${={}}2$\,pt; floats in float row separated by 2\,em space.\\ Captions use hanged label. \begin{verbatim} \DeclareNewFloatType{textbox}{fileext=lor,name=Text,placement=tp} \DeclareFloatVCode{rulei}{\begingroup \color{blue}\hrule height1.8ptdepth0pt\kern2pt\endgroup} \DeclareFloatVCode{ruleii}% {\begingroup\color{blue}\kern2pt\hrule height1.8pt depth0pt\kern5pt\endgroup} \DeclareObjectSet{colorred}{\parskip2pt\color{red}} \DeclareFloatSeparators{colorsep}{\begingroup \color{blue}\floatfacing{\hskip14pt\vrule width1.8pt\hskip2pt}% {\hskip2pt\vrule width1.8pt\hskip14pt}\endgroup} \floatsetup[textbox]{precode=rulei,midcode=ruleii,capposition=bottom, objectset=colorred,floatrowsep=qquad,heightadjust=object} \captionsetup[textbox]{format=hang} \end{verbatim} \emph{Textbox with beside caption.} For beside captions the rules above and below were replaced by vertical separate rule. Caption label placed in separate line. \begin{verbatim} \floatsetup[capbesidetextbox]{precode=none,capbesidesep=colorsep} \captionsetup[capbesidetextbox]{format=default,labelsep=newline} \end{verbatim} \emph{Special settings for special float layout.}\\ \emph{Rotated.} For rotated floats created special settings to align visual top of rotated float with beside text column was created spacial alignment; beside captions positioned to the right from object contents and top aligned. \begin{verbatim} \DeclareMarginSet{sideways}{\setfloatmargins{}{\hskip.5\topskip plus1fil}} \floatsetup[rotfloat]{capbesideposition={right,top},margins=sideways} \end{verbatim} \emph{Wide rotated.} For wide or two-column (starred) environment right side expanded to the top of running head. To delete running head from pages with wide rotated float there was used \verb|\emptyfloatpage| command from loaded \pkg{floatpagestyle} package\footnote{In current example \protect\com{wideemptyfloatpage} does work of \protect\com{emptyfloatpage}; \protect\com{emptyfloatpage} equals to \protect\com{relax}.}; beside captions positioned to the right from object contents and vertically centered. \begin{verbatim} \DeclareMarginSet{widesideways}% {\setfloatmargins{}{\hskip-\headsep\hskip-.7\headheight plus1fil}} \floatsetup[widerotfloat]{capbesideposition={right,center}, capbesideframe=no,margins=widesideways} \end{verbatim} \end{sl} \endgroup \twocolumn \input fr-sample \end{document}