3

I have a somewhat large table, and I'm trying to make it landscape oriented (else it not fit). However, I'm using the floatrow package in order to make the caption wrap with the dimension of the table. I'm also using adjustbox to rotate the ttabbox for landscape alignment. But, I'm having difficulty getting the table to align in the center (both vertically and horizontally). The top of my table is off the page, and I can't get it to come down. Is there a way to get this table in the dead center, such that the spacing on the top/bottom and left/right is equal? Perhaps floatrow is a problem, but I am not willing to sacrifice the dynamic text wrapping it provides with \FBwidth.

As a bonus, is there a way to get this table on its own page? I do not want to use \newpage commands manually, I want it to be dynamic so that I don't have to change placement of things later as I expand the document.

\documentclass[12pt]{article}
\usepackage{floatrow}
\usepackage{adjustbox}

\begin{document}
Testing text up here

\begin{table}
\begin{adjustbox}{angle=90}
\ttabbox[\FBwidth]
{
\caption{Some table comments here}
}
{
\begin{tabular}{c c c c c c c c c c c c c}
\hline \hline
Material & Z & 1 (H) & 6 (C) & 7 (N) & 8 (O) & 12 (Mg) & 14 (Si) & 15 (P) & 17 (Cl) & 20 (Ca) & $\rho$ \\
         & A & 1.008 & 12.011 & 14.007 & 15.999 & 24.305 & 28.086 & 30.974 & 35.453 & 40.078 & (g/cm\textsuperscript{3}) \\
\hline
LN-300 Lung &  & 8.46 & 59.37 & 1.96 & 18.14 & 11.19  & 0.78 & 0 & 0.10 & 0 & 0.30 \\ 
LN-450 Lung &  & 8.47 & 59.56 & 1.97 & 18.11 & 11.21 & 0.58 & 0 & 0.10 & 0 & 0.45 \\
AP6 Adipose &  & 9.06 & 72.29 & 2.25 & 16.27 & 0 & 0 & 0 & 0.13 & 0 & 0.94 \\
BR-12 Breast &  & 8.59 & 70.10 & 2.33 & 17.90 & 0 & 0 & 0 & 0.13 & 0.95 & 0.98 \\
Water &  & 11.19 & 0 & 0 & 88.81 & 0 & 0 & 0 & 0 & 0 & 1 \\
CT Solid Water & & 8.00 & 67.29 & 2.39 & 19.87 & 0 & 0 & 0 & 0.14 & 2.31 & 1.02 \\
BRN-SR2 Brain & & 10.82 & 72.54 & 1.69 & 14.86 & 0 & 0 & 0 & 0.08 & 0 & 1.05 \\
LV1 Liver & &  8.06 & 67.01 & 2.47 & 20.01 & 0 & 0 & 0 & 0.14 & 2.31 & 1.10 \\
IB Inner Bone & & 6.67 & 55.65 & 1.96 & 23.52 & 0 & 0 & 3.23 & 0.11 & 8.86 & 1.14 \\
B200 Bone Mineral & & 6.65 & 55.51 & 1.98 & 23.64 & 0 & 0 & 3.24 & 0.11 & 8.87 & 1.15 \\
CB2 - 30\% CaCO\textsubscript{3} & & 6.68 & 53.47 & 2.12 & 25.61 & 0 & 0 & 0 & 0.11 & 12.01 & 1.34 \\
CB2 - 50\% CaCO\textsubscript{3} & & 4.77 & 41.62 & 1.52 & 31.99 & 0 & 0 & 0 & 0.08 & 20.02 & 1.56 \\
SB3 Cortical Bone & & 3.41 & 31.41 & 1.84 & 36.50 & 0 & 0 & 0 & 0.04 & 26.81 & 1.82 \\ 
\hline \hline
\end{tabular}
}
\end{adjustbox}
\end{table}
Some test text here

More test text
\end{document}

enter image description here

2

To make the table fit the page height, I use the \small font size (which makes 10 pt here) and reduced the value of \tabcolsep to 4pt (default is 6) and used the sidewaystable environment (which results in the table being on a page of its own).

Also, I added some improvements, using the S column type from siunitx to align numbers on the decimal dot, and the ruled from booktabs which have some vertical padding and variable widths.

\documentclass[12pt]{article}
\usepackage{rotating, booktabs, siunitx}
\usepackage{floatrow}
\usepackage{adjustbox}

\begin{document}
Testing text up here

\begin{sidewaystable}
\centering
\small\setlength{\tabcolsep}{5pt}
\sisetup{table-format=2.3, table-number-alignment=center}
\null\vfill
\ttabbox[\FBwidth]
{
\caption{Some table comments here}
}
{
\begin{tabular}{@{}c c *{9}{S}S[table-format=1.2]@{}}
\toprule \midrule
Material & Z & {1 (H)} & {6 (C)} & {7 (N)} & {8 (O)} & {12 (Mg)} & {14 (Si)} & {15 (P)} & {17 (Cl)} & {20 (Ca)} & {$\rho$} \\
         & A & 1.008 & 12.011 & 14.007 & 15.999 & 24.305 & 28.086 & 30.974 & 35.453 & 40.078 & {\si{g\per cm\cubed}} \\ %
\midrule
LN-300 Lung & & 8.46 & 59.37 & 1.96 & 18.14 & 11.19 & 0.78 & 0 & 0.10 & 0 & 0.30 \\
LN-450 Lung & & 8.47 & 59.56 & 1.97 & 18.11 & 11.21 & 0.58 & 0 & 0.10 & 0 & 0.45 \\
AP6 Adipose & & 9.06 & 72.29 & 2.25 & 16.27 & 0 & 0 & 0 & 0.13 & 0 & 0.94 \\
BR-12 Breast & & 8.59 & 70.10 & 2.33 & 17.90 & 0 & 0 & 0 & 0.13 & 0.95 & 0.98 \\
Water & & 11.19 & 0 & 0 & 88.81 & 0 & 0 & 0 & 0 & 0 & 1 \\
CT Solid Water & & 8.00 & 67.29 & 2.39 & 19.87 & 0 & 0 & 0 & 0.14 & 2.31 & 1.02 \\
BRN-SR2 Brain & & 10.82 & 72.54 & 1.69 & 14.86 & 0 & 0 & 0 & 0.08 & 0 & 1.05 \\
LV1 Liver & & 8.06 & 67.01 & 2.47 & 20.01 & 0 & 0 & 0 & 0.14 & 2.31 & 1.10 \\
IB Inner Bone & & 6.67 & 55.65 & 1.96 & 23.52 & 0 & 0 & 3.23 & 0.11 & 8.86 & 1.14 \\
B200 Bone Mineral & & 6.65 & 55.51 & 1.98 & 23.64 & 0 & 0 & 3.24 & 0.11 & 8.87 & 1.15 \\
CB2 - 30\% CaCO\textsubscript{3} & & 6.68 & 53.47 & 2.12 & 25.61 & 0 & 0 & 0 & 0.11 & 12.01 & 1.34 \\
CB2 - 50\% CaCO\textsubscript{3} & & 4.77 & 41.62 & 1.52 & 31.99 & 0 & 0 & 0 & 0.08 & 20.02 & 1.56 \\
SB3 Cortical Bone & & 3.41 & 31.41 & 1.84 & 36.50 & 0 & 0 & 0 & 0.04 & 26.81 & 1.82 \\
\midrule \bottomrule
\end{tabular}
}
\end{sidewaystable}

Some test text here

More test text

\end{document} 

enter image description here

| improve this answer | |
  • Nice, sidewaystable seems to behave much more nicely with the other packages I'm using. Thanks for the other aesthetic suggestions, too! – AtomJZ Aug 15 at 2:04
4

I would write your table as follows:

\documentclass[12pt]{article}
\usepackage{rotating}
\usepackage{booktabs}
\usepackage[skip=1ex]{caption}
\usepackage{siunitx}
\usepackage[version=4]{mhchem}

\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{sidewaystable}
\caption{Some table comments here}

\begin{tabular}{l c *{9}{S[table-format=2.2]}S[table-format=1.2]}
    \toprule
Material & Z 
    & {1 (H)}   & {6 (C)} & {7 (N)}      & {8 (O)}      & {12 (Mg)} 
    & {14 (Si)} & {5 (P)} & {17 (Cl)}    & {20 (a)}    & {$\rho$}          \\
         & A 
    &  1.008    & 12.011  & 14.007      & 15.999    & 24.305
    & 28.086    & 30.974  & 35.453      & 40.078    & {\si{g/cm^3}}            \\
    \midrule
LN-300 Lung     &  & 8.46 & 59.37 & 1.96 & 18.14 & 11.19  & 0.78 & 0 & 0.10 & 0 & 0.30 \\
LN-450 Lung     &  & 8.47 & 59.56 & 1.97 & 18.11 & 11.21 & 0.58 & 0 & 0.10 & 0 & 0.45 \\
AP6 Adipose     &  & 9.06 & 72.29 & 2.25 & 16.27 & 0 & 0 & 0 & 0.13 & 0 & 0.94 \\
BR-12 Breast    &  & 8.59 & 70.10 & 2.33 & 17.90 & 0 & 0 & 0 & 0.13 & 0.95 & 0.98 \\
Water           &  & 11.19 & 0 & 0 & 88.81 & 0 & 0 & 0 & 0 & 0 & 1 \\
CT Solid Water  & & 8.00 & 67.29 & 2.39 & 19.87 & 0 & 0 & 0 & 0.14 & 2.31 & 1.02 \\
BRN-SR2 Brain   & & 10.82 & 72.54 & 1.69 & 14.86 & 0 & 0 & 0 & 0.08 & 0 & 1.05 \\
LV1 Liver       & &  8.06 & 67.01 & 2.47 & 20.01 & 0 & 0 & 0 & 0.14 & 2.31 & 1.10 \\
IB Inner Bone   & & 6.67 & 55.65 & 1.96 & 23.52 & 0 & 0 & 3.23 & 0.11 & 8.86 & 1.14 \\
B200 Bone Mineral & & 6.65 & 55.51 & 1.98 & 23.64 & 0 & 0 & 3.24 & 0.11 & 8.87 & 1.15 \\
CB2 - 30\% \ce{CaCO3} & & 6.68 & 53.47 & 2.12 & 25.61 & 0 & 0 & 0 & 0.11 & 12.01 & 1.34 \\
CB2 - 50\% \ce{CaCO3} & & 4.77 & 41.62 & 1.52 & 31.99 & 0 & 0 & 0 & 0.08 & 20.02 & 1.56 \\
SB3 Cortical Bone & & 3.41 & 31.41 & 1.84 & 36.50 & 0 & 0 & 0 & 0.04 & 26.81 & 1.82 \\
    \bottomrule
\end{tabular}
\end{sidewaystable}
\lipsum[2-12]
\end{document}
  • Instead the adjustbox environment defined in the package of the same name is used sidewaystable defined in rotating package.
  • For columns with numbers are used S columns defined in siunitx package. It enable align numbers at decimal points
  • for chemistry symbols are use \ce{...} command defined in the mhchem` package

enter image description here

Addendum: Just to show complete and rotate page on which is better visible that it is vertical and horizontal centered in text area on the page...

enter image description here

| improve this answer | |
  • 1
    Indeed, sideways table works great! Good call on the chemistry symbols and siunitx package, adds a nice touch. – AtomJZ Aug 15 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.