2

I am tyring to make a table with longtable. At regular intervals, I replace the standard \hline with makecell's \Xhline{2\arrayrulewidth}. This mostly occurs below a \multicolumn cell.

\documentclass[a4paper,10pt]{article}
\usepackage{longtable}
\usepackage{makecell}
\begin{document}
    \begin{longtable}{|l|l|l|}
    \hline
    \multicolumn{3}{|c|}{Big header} \\
    \Xhline{2\arrayrulewidth}
    Some stuff & More stuff & Stuff without lipsums \\
    \hline
    \end{longtable}
\end{document}

In the above MWE, just as in my actual document, the \Xhline will wrap to the width of the page, not the width of the table. This leads to this kind of unconveniently ugly result:

Xhline too large

Questions:

  • What can be cause of this weird result?
  • How can I avoid it (i.e. the \Xhline stops at the table border)?
1
  • longtables are always full width so that is the expected result from a standard \hline (longtable locally gives \hline a completey different definition) Commented Jul 13, 2017 at 9:58

1 Answer 1

4

A work-around consists in using Xclineinstead.

Another solution uses the boldlinepackage, from the shipunov bundle: its \hlineB command takes longtable into account. Note that the argument for this command is just a number (the multiple of \arrayrulewidth), not a length as \Xhline. In addition, boldline has a simple syntax for thicker vertical lines.

\documentclass[a4paper,10pt]{article}
\usepackage{longtable}
\usepackage{makecell, boldline}

\begin{document}

\setlength\extrarowheight{3pt}
    \begin{longtable}{|l|l|l|}
    \hline
    \multicolumn{3}{|c|}{Big header} \\
    \Xcline{1-3}{2\arrayrulewidth}
    Some stuff & More stuff & Stuff without lipsums \\
    \hline
    \end{longtable}

    \begin{longtable}{|l|l|l|}
    \hline
    \multicolumn{3}{|c|}{Big header} \\
    \hlineB{2}
    Some stuff & More stuff & Stuff without lipsa \\
    \hline
    \end{longtable}

\end{document} 

enter image description here

2
  • Made it work with boldline. +1 for correcting the plural of "lipsum" '^^ Commented Jul 13, 2017 at 11:15
  • 'Twas just for fun: anyway, it's not really a Latin word ;o)
    – Bernard
    Commented Jul 13, 2017 at 11:22

You must log in to answer this question.

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