%frsample02 - sample head
%one-column non-facing layout with left margin
%figures use BOXED style
%text boxes use modified Boxed style
\input pictures
%\listfiles
\documentclass{book}

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

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

\IfFileExists{fancyhdr.sty}{\RequirePackage{fancyhdr}\pagestyle{fancy}\fancyfoot{}
\fancyhead[LE]{\leavevmode\hspace*{-.5\marginparwidth}\hskip-\marginparsep
  \def\arraystretch{1,2}\begin{tabular}{@{}l@{}}
  \leavevmode\rlap{\thepage}\hskip.5\marginparwidth\hskip\marginparsep
  \hbox to\textwidth{\slshape\leftmark\hfill}\\\hline\end{tabular}}
\fancyhead[LO]{\leavevmode\hspace*{-.5\marginparwidth}\hskip-\marginparsep
  \def\arraystretch{1,2}\begin{tabular}{@{}l@{}}
  \hskip.5\marginparwidth\hskip\marginparsep
  \hbox to\textwidth{{\slshape\rightmark}\quad\hfill\thepage}\\\hline\end{tabular}}
\fancyhead[RE]{}\fancyhead[CE]{}
\fancyhead[RO]{}\fancyhead[CO]{}
\def\headrulewidth{0pt}}
{\pagestyle{plain}}

%load floatrow
\usepackage{floatrow}
\usepackage{listpen}
\floatsetup{font={small,sf},footskip=.5\skip\footins,
   footnoterule=limited,captionskip=5pt,margins=raggedright,
   objectset=raggedright,capbesideposition=right,
   capbesidesep=quad,floatrowsep=quad,style=BOXED}
\usepackage{fr-fancy}
\usepackage{floatpagestyle}

% new float
\DeclareNewFloatType{textbox}{fileext=lor,name=Text,placement=tp}

\DeclareObjectSet{unindent}{\leftskip12pt\parindent-\leftskip\parskip2pt}

\floatsetup[textbox]{style=Boxed,heightadjust=all,
  frameset={\fboxrule=1pt\fboxsep=12pt},
  capposition=bottom,objectset=unindent,
  capbesideframe=yes,heightadjust=object,
  valign=t}

\newif\ifWideLayout\WideLayouttrue

\DeclareMarginSet{hangleft}%
  {\setfloatmargins
     {\hskip-.5\marginparwidth\hskip-\marginparsep}{\hfil}}
\floatsetup[widefloat]{margins=hangleft}

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

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

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

%load subfig
\newif\ifLoadSubfig
\IfFileExists{subfig.sty}
{\usepackage[justification=justified,font=rm]{subfig}
\LoadSubfigtrue}{\LoadSubfigfalse}

\newif\ifLoadSubcaption\LoadSubcaptiontrue

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

\let\wideemptyfloatpage\emptyfloatpage

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

\chapter{One Column Document and~Wide Floats}

\begin{sl}
This example shows floats in one-column document, wide float left hanged.

\emph{Common settings.}\\
Font for float contents \verb|\small| sans serif (except tables),
in this case font settings for subfloats was restored Roman family;
skips before foot material half reduced;
skip between caption and object also half reduced;
footnote rule has maximum width 1\,in (here is created special footnote style);
box alignment and justification of object contents flushed to left margin;
separation between beside caption and object equals to 1\,em; separation
between beside float boxes also equals to 1\,em. Common float style
\texttt{BOXED} (box around all float contents).
\begin{verbatim}
\floatsetup{font={small,sf},footskip=.5\skip\footins,
   footnoterule=limited,captionskip=5pt,margins=raggedright,
   objectset=raggedright,capbesideposition=right,
   capbesidesep=quad,floatrowsep=quad,style=BOXED}
\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). Restored roman family.
\begin{verbatim}
\usepackage[justification=justified,font=rm]{subfig}
\end{verbatim}

\emph{Special settings for float types.}

\emph{Textbox.}\\
The new float textbox uses corrected \texttt{Boxed} style (changed frame
settings); object contents left aligned (\verb|\raggedright|), with
\verb|\parindent|${{}=15}$\,pt, \verb|\parskip|${{}=15}$\,pt.
To get aligned subfloats the key \texttt{heightadjust=all} loaded.
\begin{verbatim}
\DeclareNewFloatType{textbox}{fileext=lor,name=Text,placement=tp}

\DeclareObjectSet{unindent}{\leftskip12pt\parindent-\leftskip\parskip2pt}

\floatsetup[textbox]{style=Boxed,heightadjust=all,
  frameset={\fboxrule=1pt\fboxsep=12pt},
  capposition=bottom,objectset=unindent,
  capbesideframe=yes,heightadjust=object,
  valign=t}
\end{verbatim}

\emph{Special settings for special float layout.}

\emph{Wide float.}\\
For wide float set hanged indentation to the left margin.
\begin{verbatim}
\DeclareMarginSet{hangleft}%
  {\setfloatmargins
     {\hskip-.5\marginparwidth\hskip-\marginparsep}{\hfil}}
\floatsetup[widefloat]{margins=hangleft}
\end{verbatim}

\emph{Rotated float.}\\
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
     {}{\hskip-\headsep\hskip-.7\headheight plus1fil}}
\floatsetup[rotfloat]{capbesideposition=right,margins=expand}
\end{verbatim}

\end{sl}

\input fr-sample

\end{document}
