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 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485
|
%sample file
%table floats---different tests
\documentclass{book}
\usepackage{calc}
\usepackage{tabularx,array}
\usepackage{longtable}
\usepackage{floatpagestyle}
%load floatrow
\usepackage[font=small,footskip=.5\skip\footins,
capbesidesep=quad,floatrowsep=quad]{floatrow}
\floatsetup[table]{style=Plaintop,captionskip=5pt}
\floatsetup[longtable]{LTcapwidth=table,margins=centering}
%load caption
\usepackage[font=small,justification=centerlast]{caption}[2004/11/28]
%%%for all versions of caption 3.x?
\DeclareCaptionFormat{flushrightlabel}{\leavevmode\rightline{#1}#2#3\normalfont\par}
%%%for caption 3.d?
%\DeclareCaptionFormat*{flushrightlabel}{\rightline{#1}#3\par}
\captionsetup[table]%
{format=flushrightlabel,labelformat=continued,labelsep=newline,textfont=bf,labelfont=sl}
%%%for caption 3.d?
%\captionsetup[table]%
% {format=flushrightlabel,labelsep=none,textfont=bf,labelfont=sl}
%>>>
\DeclareCaptionLabelFormat{continued}{\bothIfFirst{#1}{ }#2\Continued}
\newcommand\Continued{}
%\DeclareCaptionLabelFormat{continued}{\bothIfFirst{#1}{ }#2. \emph{Continued}}
\def\ContinuedTable{\ContinuedFloat\def\Continued{. \emph{Continued}}\caption{}}
%\def\ContinuedTable{\ContinuedFloat\captionsetup[table]{labelformat=continued}\caption{}}
%<<<
\captionsetup[floatfoot]{format=default}
\captionsetup[longtable]{labelformat=default}
%load subfig
\newif\ifLoadSubfig
\IfFileExists{subfig.sty}{\usepackage[justification=centerlast]{subfig}
\captionsetup[subtable]{format=default,labelfont=bf,textfont=sl}
\AtBeginDocument{\floatsetup{subfloatrowsep=quad}}
\LoadSubfigtrue}{\LoadSubfigfalse}
\let\wideemptyfloatpage\emptyfloatpage
\newif\ifLoadRotating
\IfFileExists{rotating.sty}
{\usepackage[figuresright]{rotating}
\DeclareMarginSet{expand}%
{\setfloatmargins{\hfil}
{\hskip-\headsep\hskip-.7\headheight plus1fil}}
\floatsetup[rotfloat]{margins=expand}
\LoadRotatingtrue}{\LoadRotatingfalse}
\newcommand\TABULARX[1][]{\begin{tabularx}{\hsize}{|X|X|X|}
\hline
Text for first column of first row#1&
More text for second column of first row#1&
More text for third column of first row#1\\\hline
Text for first column of second row#1&
More text for second column of second row#1&
More text for third column of second row#1\\\hline
Text for first column of third row#1&
More text for second column of third row#1&
More text for third column of third row#1\\\hline
\end{tabularx}}
\newcommand\TABULARS[1][]{\begin{tabular*}
{\hsize}{@{\extracolsep{-.4\tabcolsep plus1fill}}|p{.29\hsize}|p{.29\hsize}|p{.29\hsize}|}
\hline
Text for first column of first row#1&
More text for second column of first row#1&
More text for third column of first row#1\\\hline
Text for first column of second row#1&
More text for second column of second row#1&
More text for third column of second row#1\\\hline
Text for first column of third row#1&
More text for second column of third row#1&
More text for third column of third row#1\\\hline
\end{tabular*}}
\newcommand\TABULARI{\begin{tabular}{|l|>{\phantom0}c|>{\phantom0}c|}
\hline
\raisebox{-1.5ex}{Column Head}
& \multicolumn{2}{c|}{Data} \\
\cline{2-3}
& \multicolumn{1}{c|}{I}
& \multicolumn{1}{c|}{II}
\\\hline
First row & 1 & 2 \\
Second row & 3 & 4 \\
Third row & 6 & 8 \\
Fourth row & \llap{1}0 & \llap{1}6 \\
\hline
\end{tabular}}
\newcommand\TABULARII{\begin{tabular}{|l|c|c|c|}
\hline
\raisebox{-1.5ex}{Column Head}
& \multicolumn{3}{c|}{Data} \\
\cline{2-4}
& I & II & III \\
\hline
First row & 1 & 2 & \phantom01 \\
Second row & 3 & 4 & \phantom06 \\
Third row & 6 & 8 & 28 \\
\hline
\end{tabular}}
\providecommand*{\Lopt}[1]{\textsf{#1}}
\providecommand*{\file}[1]{\texttt{#1}}
\providecommand*{\pkg}[1]{\texttt{#1}}
\providecommand*{\env}[1]{\texttt{#1}}
\providecommand*{\com}[1]{\texttt{\char`\\#1}}
\providecommand*{\meta}[1]{$\langle$\textit{#1}$\rangle$}
\hfuzz3pt
\hbadness7000
\def\text{And more text and some more text and a bit more text and
a little more text and a little peace of text to fill space}
\def\Text{{\mdseries \text. \text. \text. \text. }}
\begin{document}
\chapter{Table Layout}
\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;
footnote rule has maximum width${{}\approx27}$\,mm; 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=.5\skip\footins,
captionskip=5pt,capbesidesep=quad,floatrowsep=quad]{floatrow}
\end{verbatim}
\emph{Common caption settings.}\\
For caption text used \verb|\small| font;
justification \texttt{centerlast} (last line centered).
\begin{verbatim}
\usepackage[font=small,justification=centerlast]{caption}
\end{verbatim}
\emph{Common subcaption settings.}\\
Justification centerlast (last line centered).
\begin{verbatim}
\usepackage[justification=centerlast]{subfig}
\end{verbatim}
\emph{Special settings for float types.}
\emph{Table.}\\
For tables is used \texttt{Plaintop} style (captions aligned by top line);
skip between caption and object half reduced.
\begin{verbatim}
\floatsetup[table]{style=Plaintop,captionskip=5pt}
\end{verbatim}
\emph{Special caption settings for float types.}
\emph{Table.}\\
For tables was created special format with separated label flushed to the right;
font of label slanted, font of caption text bold.
To restore normal behavior for \verb|\floatfoot| macro, here goes \verb|\captionsetup|
for \texttt{floatfoot} style.
\begin{verbatim}
\DeclareCaptionFormat{flushrightlabel}{\leavevmode
\rightline{#1}#2#3\par}
\captionsetup[table]%
{format=flushrightlabel,labelsep=newline,
textfont=bf,labelfont=sl}
\captionsetup[floatfoot]{format=default}
\end{verbatim}
With caption's version 3d you may set table format by this way:
\begin{verbatim}
\DeclareCaptionFormat*{flushrightlabel}{\rightline{#1}#3\par}
\captionsetup[table]%
{format=flushrightlabel,labelsep=none,textfont=bf,labelfont=sl}
\end{verbatim}
You may see, that there are absent settings for \verb|\floatfoot|.
(Unfortunately, if your table has only label, and no any text, the unwanted
space appears instead of caption title.)
For continued table (like table~\ref{rot:tab:cont} on the page~\pageref{rot:tab:cont})
was created new label format and defined command \verb|\ContinuedTable|, which includes
special \texttt{continued} format and \verb|\ContinuedFloat| command.
\begin{verbatim}
\DeclareCaptionLabelFormat{continued}{\bothIfFirst{#1}{ }#2.
\emph{Continued}}
\def\ContinuedTable{\ContinuedFloat
\captionsetup[table]{labelformat=continued}}
\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]{sidecappos=right,floatmargins=expand}
\end{verbatim}
\end{sl}
\clearpage
\bfseries\boldmath
Example of plain \env{table} environment (table~\ref{float:plain:table}),
\begin{table}
\caption{Plain table environment with \env{tabularx}. \text}\label{float:plain:table}
\TABULARX
\end{table}
\Text
\Text
\clearpage
Example of plain \env{table} environment (table~\ref{float:w:plain:table})
with predefined width.
Before \env{table} environment was written:
\begin{verbatim}
\thisfloatsetup{floatwidth=.85\hsize}
\end{verbatim}
\thisfloatsetup{floatwidth=.85\hsize}
\begin{table}
\caption{Plain table environment (\env{tabularx}) with predefined width. \text}\label{float:w:plain:table}
\TABULARX
\end{table}
\Text
\clearpage
Example of table placed in \verb|\ttabbox| (\verb|\floatbox| stuff);
the width of float box equals to the width of table
(see table~\ref{floatbox:FB:tab}).
\begin{table}
\floatbox{table}[\FBwidth]
{\caption{Float box table (\protect\com{ttabbox})
width of table}\label{floatbox:FB:tab}}
{\tabcolsep2\tabcolsep\TABULARI\floatfoot{Text of floatfoot. \text}}
\end{table}
\Text
\ifLoadSubfig
\clearpage
The example of subtables (table~\ref{floatbox:wide:subtab}) with two
subtables~\subref{subtab:A} and~\subref{subtab:B}.
Here for sub tables was used the \env{subfloatrow} environment (this environment
allows usage (and definition) of common horizontal skip between subfloats).
\begin{verbatim}
\begin{table*}\extrarowheight1pt
\floatbox[\captop]{table}[\FBwidth]
{\caption{...}
{\begin{subfloatrow}
\subfloat[...]{...}
\subfloat[...]{...}%
\end{subfloatrow}}
\end{table*}%
\end{verbatim}
\begin{table*}\extrarowheight1pt
\floatbox[\captop]{table}[\FBwidth]
{\caption{Table with two \protect\com{subfloats}
(from \pkg{subfig} package)}\label{floatbox:wide:subtab}}
{\begin{subfloatrow}
\subfloat[First table\label{subtab:A}]
{\TABULARI}%
\subfloat[Second table with long long long caption\label{subtab:B}]
{\TABULARII}%
\end{subfloatrow}}
\end{table*}%
\Text
\fi
\clearpage
The example of table row (tables~\ref{tab:row:tabI}--\ref{tab:row:tabII}).
\begin{table*}
\begin{floatrow}
\extrarowheight1pt
\ttabbox
{\caption[Beside table~I long header]%
{Beside table~I with long long long top aligned header}\label{tab:row:tabI}}
{\TABULARI}
%
\ttabbox
{\caption{Beside table~II short header}\label{tab:row:tabII}}
{\TABULARII}
\end{floatrow}
\end{table*}
\Text
\clearpage
Example of two rows: first---of beside tables in \env{tabularx} environments;
second---of beside tables in \env{tabular*} environments. Both rows use first column width${}=.85$\verb|\hsize|,
and second column${}=1.15$\verb|\hsize|.
(see tables~\ref{rot:tabx:tab1}--\ref{rot:tabx:tab2}).
\begin{table}[!t]
\begin{floatrow}\tabcolsep.5\tabcolsep
\ttabbox[.85\hsize]{\begin{tabularx}{\hsize}{|X|X|}
\hline
A text for first column of first row&
More text for second column of first row\\\hline
A text for first column of second row&
More text for second column of second row\\\hline
A text for first column of third row&
More text for second column of third row\\\hline
\end{tabularx}}{\caption{The \env{tabularx} environment with width \texttt{.85}\protect\com{hsize}}\label{rot:tabx:tab1}}
\ttabbox[1.15\hsize]{\begin{tabularx}{\hsize}{|X|X|}
\hline
Text for first column of first row&
More text for second column of first row\\\hline
Text for first column of second row&
More text for second column of second row\\\hline
Text for first column of third row&
More text for second column of third row\\\hline
\end{tabularx}}{\caption{The \env{tabularx} (from \pkg{tools} bundle) environment with width \texttt{1.15}\protect\com{hsize}}}
\end{floatrow}
\vskip\floatsep
\begin{floatrow}\tabcolsep.75\tabcolsep
\ttabbox[.85\hsize]{{\begin{tabular*}{\hsize}{@{\extracolsep{-.4\tabcolsep plus1fill}}
|p{.44\hsize}|p{.44\hsize}|}
\hline
A text for first column of first row&
More text for second column of first row\\\hline
A text for first column of second row&
More text for second column of second row\\\hline
A text for first column of third row &
More text for second column of third row\\\hline
\end{tabular*}}}{\caption{The \env{tabular*} environment with width \texttt{.85}\protect\com{hsize}}}
\ttabbox[1.15\hsize]{{\begin{tabular*}{\hsize}{@{\extracolsep{-.4\tabcolsep plus1fill}}|p{.45\hsize}|p{.45\hsize}|}
\hline
Text for first column of first row&
More text for second column of first row\\\hline
Text for first column of second row&
More text for second column of second row\\\hline
Text for first column of third row &
More text for second column of third row\\\hline
\end{tabular*}}}{\caption{The starred \LaTeX's \env{tabular*} environment with width \texttt{1.15}\protect\com{hsize}}\label{rot:tabx:tab2}}
\end{floatrow}
\end{table}
\Text
\clearpage
Example of continued rotated plain table on facing pages
(see table~\ref{rot:tab} on pages~\pageref{rot:tab}--\pageref{rot:tab:cont}).
\ifodd\value{page}\else
\Text \Text
\Text \Text
\ifodd\value{page}\else
\Text \Text
\Text \Text
\Text \Text
\fi
\fi
\newdimen\rottextwidth\rottextwidth\textwidth
\begin{sidewaystable}
\buildFBBOX{\vbox to\rottextwidth\bgroup\vss}{\egroup}
\wideemptyfloatpage
\caption{Plain table inside
\protect\env{sidewaystable} environment,
full text width. \text}\label{rot:tab}
\TABULARX[ \text. \text. ]
\end{sidewaystable}
%
\begin{sidewaystable}
\buildFBBOX{\vbox to\rottextwidth\bgroup}{\vss\egroup}
\emptyfloatpage\ContinuedTable
\label{rot:tab:cont}
\TABULARX[ \text.]
\end{sidewaystable}
\Text
\Text
\Text
\Text
\clearpage
Example of two beside tables in wide rotated table environment (\env{sidewaystable*})
(see tables~\hbox{\ref{rot:side:tab1}--\ref{rot:side:tab2}}
on page~\pageref{rot:side:tab1}).
\begin{sidewaystable*}\wideemptyfloatpage
\begin{floatrow}
\ttabbox[\hsize]
{{\TABULARS[. \text]\floatfoot{If you use inside \protect\com{floatbox} stuff
\texttt{tabularx} or \texttt{tabular*} environments with \protect\com{hsize}
command inside \meta{width} argument, you must repeat the \protect\com{hsize} argument
in \meta{width} argument of \protect\com{floatbox} macro.}}}
{\caption{}\label{rot:side:tab1}}
\ttabbox[\hsize]
{{\TABULARS[. \text]\floatfoot{If you want to set width of \texttt{tabularx} or \texttt{tabular*} environments
like \texttt{.8}\protect\com{hsize} (or \texttt{1.2}\protect\com{hsize}) and they placed inside any
\protect\com{floatbox} macro, load \texttt{.8}\protect\com{hsize} in \meta{width} argument of
\protect\com{floatbox} macro, and in \meta{width} argument of \texttt{tabularx} or \texttt{tabular*}
load only \protect\com{hsize} macro.}}}
{\caption{}\label{rot:side:tab2}}
\end{floatrow}
\end{sidewaystable*}
\Text
\Text
\clearpage
Example of two rows of beside tables in wide rotated table
(see tables~\ref{rot:tworow:tab1}--\ref{rot:tworow:tab2} on page~\pageref{rot:tworow:tab2}).
There were used \env{tabularx} environment in first row and
\env{tabular*}---in the second.
\begin{sidewaystable*}\wideemptyfloatpage
\begin{floatrow}
\ttabbox[\hsize]
{{\TABULARX}}{\caption{}\label{rot:tworow:tab1}}
\ttabbox[\hsize]
{{\TABULARX}}{\caption{}}
\end{floatrow}
\vskip\floatsep
\begin{floatrow}
\ttabbox[\hsize]{{\TABULARS}}{\caption{}}
\ttabbox[\hsize]{{\TABULARS}}{\caption{}\label{rot:tworow:tab2}}
\end{floatrow}
\end{sidewaystable*}
\Text
\Text
\end{document}
|