1

I have a longtable spreading over 2 pages. Unfortunately, since I decided to use the booktabs package, I get a duplicate line separator between the table header of the second page and the next table entry. I found solutions like adding a * behind the \\ but they didn't work.

I want to remove the annoying dashed line on the second page:

visualization of example

My minimal example:

\documentclass[a4paper, 12pt]{article}
\usepackage{longtable}
\usepackage{arydshln}
\usepackage{booktabs}

\begin{document}
\vspace*{17cm}

\begin{longtable}[c]{@{}llll@{}}\toprule
\# & A & B & C\\
\midrule
\endhead
1 & A & B & C \\
\hdashline
2 & A & B & C \\
\hdashline
A & A & B & C \\
\hdashline
3 & A & B & C \\
\hdashline
4 & A & B & C \\
\hdashline
5 & A & B & C\\
\hdashline
6 & A & B & C\\
\hdashline
7 & A & B & C \\
\bottomrule
\end{longtable}

\end{document}
8
  • Do you know \endfirsthead etc. commands? But in this case, it's sufficient to interchange \midrule and \endhead, in my point of view
    – user31729
    Commented Jul 30, 2015 at 15:00
  • I believe that arydshline breaks a little bit the advantages of booktabs, reducing the space, perhaps this only my impression
    – user31729
    Commented Jul 30, 2015 at 15:07
  • I've tracked the 'error' back that the page break occurs right before a \hdashline, such that this is shifted to the next page, making a double line with the midrule from \endhead
    – user31729
    Commented Jul 30, 2015 at 15:19
  • @ChristianHupfer: no, then I have a dashed line as separator and not the midrule I want to have. Which other package do you suggest for dashed lines?
    – flp
    Commented Jul 30, 2015 at 15:19
  • For dashed lines I have no other suggestion, it can be cured of course. I've some idea in mind ;-)
    – user31729
    Commented Jul 30, 2015 at 15:21

1 Answer 1

3

Now you can try the new LaTeX3 package tabularray. It always uses \toprule, and \bottomrule in any table pages, and doesn't make duplicate line separators.

\documentclass{article}

\usepackage[paperwidth=8cm,paperheight=5cm,width=7cm,height=4.4cm]{geometry}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\NewTableCommand{\hdashline}{\hline[dashed]}

\begin{document}

\begin{longtblr}[
  halign = c,
  caption = {Long Caption},
  label = {tblr:test},
]{
  colspec = {@{}XXXX@{}}, rowhead = 1,
}
\toprule
  \# & A & B & C\\
\midrule
  1 & A & B & C \\
\hdashline
  2 & A & B & C \\
\hdashline
  3 & A & B & C \\
\hdashline
  4 & A & B & C \\
\hdashline
  5 & A & B & C\\
\hdashline
  6 & A & B & C\\
\hdashline
  7 & A & B & C \\
\hdashline
  8 & A & B & C \\
\bottomrule
\end{longtblr}

\end{document}

enter image description here

You must log in to answer this question.

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