0

I am trying to use "tabu" (specifically, longtabu) to create tables. I am attempting to follow Government Printing Office Style Manual guidance, 13.21: "Boxheads [i.e., table column headers] are centered horizontally and vertically." Here is an example from the manual itself:

Example of vertically and horizontally centered box headers

Here is a pared-down example of the table I am working on. I haven't been able to figure out how to center the headers either vertically nor even horizontally:

\documentclass{article}
\usepackage{ctable}
\usepackage{longtable}
\usepackage{tabu}

\begin{document}
\begin{longtabu} to \textwidth{ X[24] X[106] X[16] X[46] }

\toprule
\rowfont[c]\normalsize Symbol & Common Name \strut\newline\strut    Scientific Name & ODA List/Target & Mapping Protocol \\
\midrule\endhead

\scshape{aecy}  &   jointed goatgrass   \strut\newline\strut\quad   \emph{Aegilops cylindrica}  &   B   &   Mandatory   \\
\scshape{aetr}  &   barbed goatgrass    \strut\newline\strut\quad   \emph{Aegilops triuncialis \emph{var.} triuncialis} &   A/T &   Mandatory   \\
\scshape{brte}  &   cheatgrass  \strut\newline\strut\quad   \emph{Bromus tectorum}  &   &   Discretionary   \\

\bottomrule
\end{longtabu}
\end{document}

I get as follows:

My Result

The headings are neither vertically nor horizontally centered. I attempted to use \rowfont[c], but this seems ineffective. I do not know how to vertically center. Other questions along the same line are not clear to me. Can anyone help? Thanks!

2

enter image description here

with help of makecell package, changing columns width ratios, size of \tabcolsep and vertical spice in cells:

\documentclass{article}
\usepackage{booktabs, makecell, longtable, tabu}

\begin{document}
{
\tabulinesep=1.5pt
\begin{longtabu} to \textwidth{ X[12,c,m] X[50,c,m] X[15,c,m] X[18,c,m] }
\toprule
%\rowfont[c]\normalsize
Symbol          &   \makecell{Common Name\\
                    Scientific Name}            &   \makecell{ODA\\
                                                    List/Target}
                                                        & Mapping Protocol \\
\midrule\endhead
\scshape{aecy}  &   \makecell{jointed goatgrass\\
                    \emph{Aegilops cylindrica}} &   B   &   Mandatory       \\
\scshape{aetr}  &   \makecell{barbed goatgrass\\
                    \emph{Aegilops triuncialis
                    \emph{var.} triuncialis}}   &   A/T &   Mandatory       \\
\scshape{brte}  &   \makecell{cheatgrass\\
                    \emph{Bromus tectorum}}     &       &   Discretionary   \\

\bottomrule
\end{longtabu}
}
\end{document}
  • Thank you! Makecell appears to be a highly useful package for just this sort of table layout. – Roble Aug 26 '17 at 23:44

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.