Skip to content

Instantly share code, notes, and snippets.

@danmosergist
Created January 2, 2016 22:26
Show Gist options
  • Save danmosergist/59253b9691db18a0366c to your computer and use it in GitHub Desktop.
Save danmosergist/59253b9691db18a0366c to your computer and use it in GitHub Desktop.
Latex: long table twocolumn mode with xtab
% \usepackage{xtab,afterpage}
\begin{center}
\topcaption{Top caption xtab}
\tablefirsthead{\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} & \multicolumn{1}{|c|}{\textbf{Extra}}
\\ \hline }
\tablehead{\multicolumn{3}{c}%
{{\captionsize \tablename\ \thetable{} -- continued from previous page}} \\
\hline \multicolumn{1}{|c|}{\textbf{Command}} &
\multicolumn{1}{c|}{\textbf{Effect}} & \multicolumn{1}{|c|}{\textbf{Extra}}
\\ \hline }
\tabletail{\hline \multicolumn{3}{|r|}{{Continued on next page}} \\ \hline}
\tablelasttail{\hline \hline}
% \begin{xtabular}{ccc}
% for custom column width:
\begin{xtabular}{@{\extracolsep{\fill}}|*{3}{p{1.8cm}|}}
column1 &column2 &column3 \\
column1 &column2 &column3 \\
column1 &column2 &column3 \\
\end{xtabular}
\end{center}
% Spanning over the two columns.
% Problem: no text in the same pages of the table.
\afterpage{\onecolumn
% {\onecolumn % in case of not using afterpage...
\begin{center}
\topcaption{Top caption xtab*}
\tablefirsthead{}
\tablehead{}
\tabletail{}
\tablelasttail{}
\begin{xtabular*}{.8\textwidth}{c@{\extracolsep{\fill}}ccccc}
\hline
column1 &column2 &column3 &column4 &column5 &column6\\
column1 &column2 &column3 &column4 &column5 &column6\\
column1 &column2 &column3 &column4 &column5 &column6\\
\hline
\end{xtabular*}
\end{center}
\twocolumn}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment