3

i want to typeset a long table across several columns / pages and want the table rows to keep register. my code looks basically like this:

\documentclass{book}
\usepackage{pagegrid}
\usepackage{fontspec}
\usepackage{tabu}
\usepackage{hhline}
\usepackage{multicol}
\setlength{\parskip}{0mm}
\setlength{\parindent}{0mm}
\setlength{\arrayrulewidth}{0.15mm}
\setlength{\doublerulesep}{0.5mm}
\begin{document}

\begin{multicols}{3}

{\setlength{\tabcolsep}{2mm}
\begin{tabu} to \linewidth { | X[1,l,m] | }
\hhline{|=|}
1 first line \\
\hhline{|=|}
2 secondline \\
\hhline{|=|}
\end{tabu}}

\vfill
\columnbreak

{\setlength{\tabcolsep}{2mm}
\begin{tabu} to \linewidth { | X[1,l,m] | }
\hhline{|-|}
1 first line \\
\hhline{|-|}
2 secondline \\
\hhline{|-|}
\end{tabu}}

\vfill
\columnbreak

{\setlength{\tabcolsep}{2mm}
\begin{tabu} to \linewidth { | X[1,l,m] | }
\hhline{|~|}
1 first line \\
\hhline{|~|}
2 secondline \\
\hhline{|~|}
\end{tabu}}

\end{multicols}
\end{document}

in reality those two-line tables really have 50 rows and extend over the entire page height. i need to insert double horizontal lines at various points in the tables, and of course those need space and add to table height—which causes the rows accross the pages to get out of sync. i should add that each partial table will have different numbers of lines occurring at different points, so using 'vertical glue' between rows (if that's possible) to make each stretch to page height wouldn't be ideal.

is there any way to force all rows to maintain height? in the past when faced with this problem in HTML/CSS, i always tried to typeset all the typographic elements but hid them from view where not needed. this greatly simplified things because you get away without many calculations, you just switch on what's need at a certain point. i'm not aware of any way to do that in (Xe)LaTeX.

how can i make all table rows keep in sync and 'add lines between table cells where needed', as it were?

1 Answer 1

3

You can make hhline always use a double line space:

\documentclass{book}
\usepackage{pagegrid}
\usepackage{fontspec}
\usepackage{tabu}
\usepackage{hhline}
\usepackage{multicol}
\setlength{\parskip}{0mm}
\setlength{\parindent}{0mm}
\setlength{\arrayrulewidth}{0.15mm}
\setlength{\doublerulesep}{0.5mm}
\makeatletter
\def\HH@add#1{\toks@\expandafter{\the\toks@#1\HH@box\z@\z@}}
\makeatletter
\begin{document}

\begin{multicols}{3}

{\setlength{\tabcolsep}{2mm}
\begin{tabu} to \linewidth { | X[1,l,m] | }
\hhline{|=|}
1 first line \\
\hhline{|=|}
2 secondline \\
\hhline{|=|}
\end{tabu}}

\vfill
\columnbreak

{\setlength{\tabcolsep}{2mm}
\begin{tabu} to \linewidth { | X[1,l,m] | }
\hhline{|-|}
1 first line \\
\hhline{|-|}
2 secondline \\
\hhline{|-|}
\end{tabu}}

\vfill
\columnbreak

{\setlength{\tabcolsep}{2mm}
\begin{tabu} to \linewidth { | X[1,l,m] | }
\hhline{|~|}
1 first line \\
\hhline{|~|}
2 secondline \\
\hhline{|~|}
\end{tabu}}

\end{multicols}
\end{document}
3
  • ok that's greek to me. if i understand correctly, this solution should work with tables where each row is delimited by single or double horizontal rulers. my use case is rows that are delimited by either no rulers or else double rulers (single rulers may occur later perhaps, still experimenting), so maybe i can find a way to make invisible rulers... and vertical rulers will still have to line up... omeomy.—i observe that most examples i come across in the package descriptions have quite arbitrary and often unsightly heights and all you get is fixes, no real solutions...
    – flow
    Commented Aug 28, 2013 at 21:19
  • @flow your example had rules every row, you can use \hhline{~~~~~} to get no rule but the same padding. Commented Aug 28, 2013 at 21:44
  • sounds legit, i'll try! cheers!
    – flow
    Commented Aug 29, 2013 at 9:08

You must log in to answer this question.

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