Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

\begin{longtable}{lp{99mm}}
    \caption{Work plan schedule for the dissertation}\\
        \textbf{Work week} & \centering \textbf{Observations}\\
        %\firsthline\\
        \endhead

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

&

Some text here\\

\label{tab:Schedule}
\end{longtable}

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

share|improve this question
    
\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

1 Answer 1

up vote 3 down vote accepted

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.

share|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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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