3

I'm a relative newbie to LaTeX and am having a problem with a longtabu table. I've set it up with alternating row colors, which works great. However, this makes the captions on all but the first page the alternate color. To get around this I tried a \multicolumn row in the header as shown in the MWE below. I also included a \multicolumn row in the footer with the same results.

\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage{tabu,xcolor,colortbl}
\usepackage{caption}
\usepackage{array}
\usepackage[colorlinks = true,
            linkcolor = blue,
            urlcolor  = blue,
            citecolor = blue,
            anchorcolor = blue]{hyperref}            
\usepackage{longtable}


\begin{document}

\taburowcolors[2]{white .. blue!20}

\tabulinesep=6pt
\arrayrulewidth=1pt 

\begin{longtabu}[h]{| m{1.75in} | m{1.5in} | m{2.75in} |}


\caption{This is the first page header} \label{Table:example}\\
 \rowcolor{blue}\color{white}Column 1  & \color{white}Column 2 & \color{white}Column 3\\
\endfirsthead

\rowcolor{white}\multicolumn{3}{c}{Table~\ref{Table:example}: Continued from previous page}\\
%\caption{Continued from previous page}\\
 \rowcolor{blue}\color{white}Column 1  & \color{white}Column 2 & \color{white}Column 3\\ 
\endhead

\hline
%\rowcolor{white} \multicolumn{3}{l}{Continued on next page}\\ 

\endfoot

\hline
\endlastfoot


This is Column 1 & This column describes Column 1 and is generally a little longer &  This is a longer description that will take up a few lines of text in the table. It is really just a bunch of text. This really means nothing in this minimum working example other than to take up space in the table.\\

This is Column 1 & This column describes Column 1 and is generally a little longer &  This is a longer description that will take up a few lines of text in the table. It is really just a bunch of text. This really means nothing in this minimum working example other than to take up space in the table.\\

This is Column 1 & This column describes Column 1 and is generally a little longer &  This is a longer description that will take up a few lines of text in the table. It is really just a bunch of text. This really means nothing in this minimum working example other than to take up space in the table.\\

This is Column 1 & This column describes Column 1 and is generally a little longer &  This is a longer description that will take up a few lines of text in the table. It is really just a bunch of text. This really means nothing in this minimum working example other than to take up space in the table.\\

This is Column 1 & This column describes Column 1 and is generally a little longer &  This is a longer description that will take up a few lines of text in the table. It is really just a bunch of text. This really means nothing in this minimum working example other than to take up space in the table.\\

This is Column 1 & This column describes Column 1 and is generally a little longer &  This is a longer description that will take up a few lines of text in the table. It is really just a bunch of text. This really means nothing in this minimum working example other than to take up space in the table.\\

This is Column 1 & This column describes Column 1 and is generally a little longer &  This is a longer description that will take up a few lines of text in the table. It is really just a bunch of text. This really means nothing in this minimum working example other than to take up space in the table.\\

This is Column 1 & This column describes Column 1 and is generally a little longer &  This is a longer description that will take up a few lines of text in the table. It is really just a bunch of text. This really means nothing in this minimum working example other than to take up space in the table.\\

This is Column 1 & This column describes Column 1 and is generally a little longer &  This is a longer description that will take up a few lines of text in the table. It is really just a bunch of text. This really means nothing in this minimum working example other than to take up space in the table.\\

This is Column 1 & This column describes Column 1 and is generally a little longer &  This is a longer description that will take up a few lines of text in the table. It is really just a bunch of text. This really means nothing in this minimum working example other than to take up space in the table.\\

This is Column 1 & This column describes Column 1 and is generally a little longer &  This is a longer description that will take up a few lines of text in the table. It is really just a bunch of text. This really means nothing in this minimum working example other than to take up space in the table.\\


\end{longtabu}

\end{document}

This works but throws a couple of Misplaced\omit \end{longtabu}

errors and a bunch of overfull and underfull \hbox as shown below.

line 66: Misplaced \omit \end{longtabu}
line 66: Misplaced \omit \end{longtabu}
line 66: Overfull \hbox (43.61536pt too wide) in alignment
line 66: Overfull \hbox (43.61536pt too wide) in alignment
line 66: Overfull \hbox (43.61536pt too wide) in alignment
line 66: Overfull \hbox (43.61536pt too wide) in alignment
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 2837) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 2837) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 2837) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 2837) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 2837) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 2837) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 2837) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 2837) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 2837) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 2837) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 10000) in paragraph
line 66: Underfull \hbox (badness 2837) in paragraph
line 66: Overfull \hbox (43.61536pt too wide) in alignment

Is there something that I can do to get rid of the errors?

Thanks

1

Use \cellcolor, not \rowcolor:

\begin{longtabu}{| >{\raggedright}m{1.75in} | >{\raggedright}m{1.5in} | >{\raggedright\arraybackslash}m{2.75i$


\caption{This is the first page header} \label{Table:example}\\
 \rowcolor{blue}\color{white}Column 1  & \color{white}Column 2 & \color{white}Column 3\\
\endfirsthead

\multicolumn{3}{c}{\cellcolor{white}Table~\ref{Table:example}: Continued from previous page}\\[\bigskipamount]
 \rowcolor{blue}\color{white}Column 1  & \color{white}Column 2 & \color{white}Column 3\\
\endhead

I set a small margin just to avoid the table overshooting the width. With \raggedright the cells don't throw tens of Underfull \hbox warnings.

enter image description here

  • @John It is great that the answer works great, so please remember upvoting the answer in addition to accepting it. – Sveinung Oct 22 '14 at 20:18

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.