2

I'm using longtable and trying to use \marks. So far I've got no luck.

MWE:

\documentclass[a5paper,pagesize]{scrartcl}
\usepackage{longtable}
\usepackage{scrpage2}
\chead[\firstmark/\botmark]{\firstmark/\botmark}
\pagestyle{scrplain}
\newcommand*{\tablerow}[1]{%
  #1\mark{#1}\tabularnewline[2cm]}
\begin{document}
\begin{longtable}{p{.9\textwidth}}
\tablerow{1}\tablerow{2}\tablerow{3}\tablerow{4}\tablerow{5}
\tablerow{6}\tablerow{7}\tablerow{8}\tablerow{9}\tablerow{10}
\tablerow{11}\tablerow{12}\tablerow{13}\tablerow{14}\tablerow{15}
\end{longtable}
\end{document}

In the result \firstmark and \botmark are always empty. Am I doing something wrong or is this a bug/limitation of longtable/LaTeX?

1 Answer 1

2

Clearly it could only be a limitation in longtable as my packages don't have bugs but you might want to read

longtable changes the page heading

However apart from that the marks in your example will have no effect as they only ever have effect in tex if they are in the main vertical list (or can migrate to the main vertical list from horizontal mode). Marks in \parbox and friends do nothing unless the box is eventually unboxed.

Your marks are in a p columns which is a \parbox essentially. They need to be in lcr columns.

6
  • O.K. And I need to use \firstmark. But why is \firstmark=\botmark on the last page? Sep 7, 2012 at 9:36
  • Latex's output routine has \let\firstmark\botmark you are not supposed to use bare marks always marks with two fields accessed by leftmark and rightmark (not that I always follow the rules either) Sep 7, 2012 at 9:48
  • So how do I get the first and last element of a page with LaTeXs macros? Because even if I use \markboth and \rightmark and \leftmark in the example, on the last page it's still \rightmark==\leftmark. Sep 7, 2012 at 9:54
  • actually I may have been wrong to blame the standard output routine it may be a feature of the way longtable switches to the longtable output routine. I'll think about it. Have you got a MWE not using p cols that shows the problem (either here or just mail it to me:-) Sep 7, 2012 at 10:18
  • Just change the p-column to an l-column in the MWE. I'm still using TL2011/longtable 4.11, though. Sep 7, 2012 at 10:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .