TransWikia.com

Longtable with repeating headers and horizontal rules

TeX - LaTeX Asked by AK16 on December 9, 2020

I am trying to make a longtable, that has repeating headers. Also, each row has rules. In the second page, however, the rule repeats twice.It looks unpolished. How do I fix this?

MWE

documentclass[11pt, a4paper, oneside]{memoir}
usepackage{longtable}
usepackage{booktabs}
usepackage{array}
usepackage{arydshln}
setlengthdashlinedash{0.2pt}
setlengthdashlinegap{1.5pt}
setlengtharrayrulewidth{0.3pt}

begin{document}
begin{longtable}{l} 
    toprule
    Title  
    midrule
    endfirsthead
    toprule
    Title 
    midrule
    endhead
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  bottomrule

end{longtable}
end{document}

enter image description here

enter image description here

The Economist too uses rules

Economist

One Answer

I kinda stumbled on a solution. It may have drawbacks but it works for me.

Adding these 2 lines removed the problem

setlength{aboverulesep}{0pt}
setlength{belowrulesep}{0pt}

The MWE now becomes

documentclass[11pt, a4paper, oneside]{memoir}
usepackage{longtable}
usepackage{booktabs}
usepackage{array}
usepackage{arydshln}
setlengthdashlinedash{0.2pt}
setlengthdashlinegap{1.5pt}
setlengtharrayrulewidth{0.3pt}
setlength{aboverulesep}{0pt}
setlength{belowrulesep}{0pt}

begin{document}
begin{longtable}{l} 
    toprule
    Title  
    midrule
    endfirsthead
    toprule
    Title 
    midrule
    endhead
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  hdashline
    D  hdashline
    A  hdashline
    B  hdashline
    C  bottomrule

end{longtable}
end{document}

Page 2 output is shown:

Output

Answered by AK16 on December 9, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP