jel
2009-03-05 21:51:08 UTC
I'm having difficulty with the simplest longtable. Here's an example:
\documentclass[12pt,letterpaper]{article}
\usepackage{longtable}
\usepackage{colortbl}
\usepackage{dcolumn}
\begin{document}
\newcolumntype{G}{>{\raggedright\columncolor[gray]{0.95}}m{2in}}
\newcolumntype{H}{>{\centering}m{1in}}
\begin{longtable}{GHGH}
\caption{My Caption} \\ \hline
\multicolumn{1}{c}{A} & \multicolumn{1}{c}{B} & \multicolumn{1}{c}{C}
& \multicolumn{1}{c}{D} \endhead \hline
a & b & c & d \\ \hline
a & b & c & d \\ \hline
\end{longtable}
\end{document}
When I run this through LaTeX I get the following error:
! Misplaced \noalign.
\hline ->\noalign
{\ifnum 0=`}\fi \penalty \@M \futurelet \@***@token
\LT@@h...
l.14 a & b & c & d \\ \hline
I have 4 columns in the table so I need 3 alignment characters (&) per
row which I have. I haven't missed the "\\" at the end of each row.
I'm sure I'm missing something very simple but I can't figure it out.
Please educate me.
John
\documentclass[12pt,letterpaper]{article}
\usepackage{longtable}
\usepackage{colortbl}
\usepackage{dcolumn}
\begin{document}
\newcolumntype{G}{>{\raggedright\columncolor[gray]{0.95}}m{2in}}
\newcolumntype{H}{>{\centering}m{1in}}
\begin{longtable}{GHGH}
\caption{My Caption} \\ \hline
\multicolumn{1}{c}{A} & \multicolumn{1}{c}{B} & \multicolumn{1}{c}{C}
& \multicolumn{1}{c}{D} \endhead \hline
a & b & c & d \\ \hline
a & b & c & d \\ \hline
\end{longtable}
\end{document}
When I run this through LaTeX I get the following error:
! Misplaced \noalign.
\hline ->\noalign
{\ifnum 0=`}\fi \penalty \@M \futurelet \@***@token
\LT@@h...
l.14 a & b & c & d \\ \hline
I have 4 columns in the table so I need 3 alignment characters (&) per
row which I have. I haven't missed the "\\" at the end of each row.
I'm sure I'm missing something very simple but I can't figure it out.
Please educate me.
John