7

I'm trying to create a list of notation, but I've been unable to use nomencl as I would like so I'm using a table. I'd like the table to split as it goes over to the second column (the working example below doesn't have enough lines to split, but you get the idea). It would be nice if when it split it would also redo the table column titles at the top of the next column as well, is there any way of doing this?

EDIT: I can see that supertabular may be the thing I need, how can I implement that code with it? It seems to not like \columnwidth and \toprule.

\documentclass[11pt, a4paper]{article}
\usepackage{multicol}
\usepackage[left=17.5mm,right=17.5mm,top=24.5mm,bottom=33.95mm]{geometry}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{array}
\usepackage{supertabular}
\begin{document}
\begin{multicols*}{2}
\tablehead{\hline
Symbol&Description&Unit \hline}\\
\tabletail{\hline}\\
\begin{supertabular}{l l l}
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\

\end{supertabular}
\end{multicols*}
\end{document}

I've also tried the following to get the table widths right, but then it doesn't use the second column of multicols.

{
    p{\dimexpr.5\columnwidth-2\tabcolsep}
    >{\centering\arraybackslash}p{\dimexpr.3\columnwidth-2\tabcolsep}
    >{\raggedleft\arraybackslash}p{\dimexpr.2\columnwidth-2\tabcolsep}
    }
David Carlisle
  • 757,742
Andy
  • 1,363
  • http://tex.stackexchange.com/questions/45980/balancing-long-table-inside-multicol-in-latex shows how to do this if you don't want headings, otherwise you could use supertabular instead of longtable as discussed http://tex.stackexchange.com/questions/39686/longtable-alternative-for-twocolumn-documents – David Carlisle Mar 05 '12 at 13:57
  • I've looked at http://tex.stackexchange.com/questions/39686/longtable-alternative-for-twocolumn-documents but I'm not really sure how I should go about implementing that with my code, I don't have a file that is called – Andy Mar 05 '12 at 14:05
  • Edited my original question to ask about using supertabular with my code. – Andy Mar 05 '12 at 14:14
  • \toprule etc come from booktabs you can do without that originally and just use the standard \hline (you can fiddle with the line thickness later, supertabular* works like tabular* (rather than tabularx) to allow you to specify table width – David Carlisle Mar 05 '12 at 14:59
  • There's no need to use tabularx: just use for the first column the same syntax as for the other two and do the math. :) The question I marked for duplicate shows how to tweak \newpage for turning it into \newcolumn when needed. – egreg Mar 05 '12 at 15:04
  • @egreg, I've updated my question with what I've tried but i'm not sure what I need to put where, I'm still pretty new to tabular as it is. – Andy Mar 05 '12 at 15:30

1 Answers1

3

I suggest you to use xtab instead of supertabular, but the result should be the same:

\documentclass[11pt, a4paper]{article}
\usepackage[textheight=12cm,textwidth=18cm]{geometry}
\usepackage{multicol}
\usepackage{xtab}
\usepackage{booktabs}
\usepackage{array}

\makeatletter
\let\mcnewpage\newpage
\newcommand{\changenewpage}{%
  \renewcommand\newpage{%
    \if@firstcolumn
      \hrule width\linewidth height0pt
      \columnbreak
    \else
      \mcnewpage
    \fi
}}
\makeatother


\begin{document}
\begin{multicols*}{2}
\changenewpage
\tablehead{
\toprule
Symbol&Description&Unit\\
\midrule
}
\begin{xtabular}{
    >{\raggedright\arraybackslash}p{\dimexpr.2\columnwidth-2\tabcolsep}
    >{\raggedright\arraybackslash}p{\dimexpr.5\columnwidth-2\tabcolsep}
    >{\raggedright\arraybackslash}p{\dimexpr.3\columnwidth-2\tabcolsep}
    }
%\toprule
%Symbol&Description&Unit\\
%\midrule
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
$X$ &Description & $J\,kg^{-1}K^{-1}$ \\
\end{xtabular}
\end{multicols*}
\end{document}

The dimensions specified for geometry are just to show the example.

The \changenewpage implements the suggestion drawn from multicolumn long table or enumeration

David Carlisle
  • 757,742
egreg
  • 1,121,712
  • That almost works perfectly for me, thank you so much for the example (and your patience with my questions). It breaks to the next column in the correct place, but it seems to break from the second column to the next page a bit early, what do I need to change to alter this position? Thanks :) – Andy Mar 05 '12 at 16:35
  • To elaborate a little, if you triple the table length by copy and pasting $X$ &Description & $J\,kg^{-1}K^{-1}$ \\ with \usepackage[left=17.5mm,right=17.5mm,top=24.5mm,bottom=33.95mm]{geometry} then it acts as if the bottom margin is higher than it is actually set. – Andy Mar 05 '12 at 16:50
  • @Andy It happens that supertabular and xtabular (which is defined in terms of the former) overestimate the row height and this may turn into premature page/column breaks. The effect is more evident with uniform rows. – egreg Mar 05 '12 at 16:55
  • In my actual table the row height is non-uniform, there are both single and double line height rows. Is there any way that I can work around this so it breaks in the correct place? – Andy Mar 05 '12 at 17:03
  • it seems that by adding \xentrystretch{-0.085} before my table (I had to arrive at the 0.085 value by trial and error) works ok, but is this the best solution? – Andy Mar 05 '12 at 17:36