I've been trying to use a command as \firsthline within a longtable environment.

\cline does not work, neither \toprule does.

This is my code example:

    \caption{Work plan schedule for the dissertation}\\
        \textbf{Work week} & \centering \textbf{Observations}\\

   [every calendar/.style={
       month label above left,
       month text={\textit{\%mt, \ \%y0}},
       week list}]
   \calendar[dates=2013-07-01 to 2013-07-last];


Some text here\\


If I change the %\firsthline for \hline I get the following errors:

pdflatex > ! Misplaced \noalign

pdflatex > ! Misplaced \omit

pdflatex > ! Extra alignment tab has been changed to \cr

  • \firsthline is used for adjusting the vertical alignment of a tabular environment when the [t] option is used. It has no meaning for longtable, as far as I can see, because longtable doesn't make a box. In any case you need array for \firsthline and booktabs for \toprule – egreg Apr 29 '13 at 13:15
  • @egreg Yeap, I know firsthline does not work, but what could be a workaround? – Mario S. E. Apr 29 '13 at 13:16
  • @MarioS.E. just use \hline – David Carlisle Apr 29 '13 at 13:17
  • @egreg, I get an error if I use \hline (see updated question). Any other ideas? – Mario S. E. Apr 29 '13 at 13:33
  • \centering changes the meaning of \\; either put it in a group ({\centering\bfseries Observations\par}\\) or simply use \multicolumn{1}{c}{\bfseries Observations}. There shouldn't be \\ after \hline – egreg Apr 29 '13 at 13:37

The difference between \firsthline and \hline is in the position of the reference point for a \begin{tabular}[t] so that text on the same horizontal line as the table aligns on its top row not on the line. However longtable is a vertical mode display construct so there can be no text on the same horizontal line, so you only need \hline.

| improve this answer | |
  • How do I get the amazing capability of firsthline to give some space? Should I just "hammer" it with vspace? – Mario S. E. Apr 29 '13 at 13:18
  • Your suggested use of \firsthline is mid table which is not ever the intended use. Any space it makes in that position in a tabular is purely accidental. Where do you want space: above the line or below it? – David Carlisle Apr 29 '13 at 13:20
  • David, I get an error. See the updated question – Mario S. E. Apr 29 '13 at 13:33
  • You shouldn't have \\ after \hline (or after \firstline) – David Carlisle Apr 29 '13 at 14:09
  • Also you need \centering\arraybackslash \textbf{Observations}\` if you use \centering` in the last column as it changes the meaning of \\ – David Carlisle Apr 29 '13 at 14:11

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.