Reputation: 59
I have a Latex document with the elsarticle document class (Elsevier Journal) which is in double column. I'm trying to fit a long table into a single column, but it doesn't work, the table is messy and doesn't take up the full width. I've tried adding a * to the longtable command, but that doesn't work either.
UPDATE: I also tried the command \onecolumn
after begin{longtable}
and the command \doublecolumn
at the end, but it didn't work, the full paper becomes one column, which I don't want.
An extract of my table with sample data (but with far fewer rows) is below :
\documentclass[5p,times,twocolumn,authoryear]{elsarticle}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{multirow}
\usepackage{afterpage}
\usepackage{xcolor}
\usepackage{longtable}
\begin{document}
\afterpage{%
\begingroup
\scriptsize
\centering
\begin{longtable} [c]{p{1cm}p{1.8cm}p{1cm}p{2cm}p{2.1cm}p{1.3cm}p{2cm}}
\caption{High Level Overview of Existing Frameworks}
\label{tab:general-description-v1}\\
\hline
%\rowcolor[HTML]{9B9B9B}
\textbf{Name} &
\textbf{Authors} &
\textbf{Year} &
\textbf{Column A} &
\textbf{Column B} &
\textbf{Column C} &
\textbf{Column D} \\ \hline
\endfirsthead
%
\multicolumn{6}{c}%
{{\bfseries Table \thetable\ continued from previous page}} \\
\hline
%\rowcolor[HTML]{9B9B9B}
\textbf{Name} &
\textbf{Authors} &
\textbf{Year} &
\textbf{Column A} &
\textbf{Column B} &
\textbf{Column C} &
\textbf{Column D} \\ \hline
\endhead
%
AA\textsuperscript{*}&
citation 1 &
2019 - 2020 &
data 1 &
data 2 &
\begin{tabular}[c]{@{}l@{}}data 3\end{tabular} &
\begin{tabular}[c]{@{}l@{}}data 4\end{tabular} \\ \hline
\multirow{2}{*}{BB\textsuperscript{*} }
&citation 2 &
2010 &
\begin{tabular}[c]{@{}l@{}}data 1 \end{tabular} &
\begin{tabular}[c]{@{}l@{}}data 2\end{tabular} &
\begin{tabular}[c]{@{}l@{}}data 3\end{tabular} &
\begin{tabular}[c]{@{}l@{}}data 4\end{tabular} \\ \cline{2-7}
&citation 3 &
2013 &
data 1 &
\begin{tabular}[c]{@{}l@{}}data 2\end{tabular} &
\begin{tabular}[c]{@{}l@{}}data 3\end{tabular} &
\begin{tabular}[c]{@{}l@{}}data 4\end{tabular} \\ \hline
\end{longtable}
\endgroup
}%
\raggedbottom
\end{document}
Any ideas how to fix this?
Upvotes: 2
Views: 1402
Reputation: 38977
Switch to oncolumn mode before you start the longtable
:
\documentclass[5p,times,twocolumn,authoryear]{elsarticle}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{multirow}
\usepackage{afterpage}
\usepackage{xcolor}
\usepackage{longtable}
\usepackage{lipsum}
\begin{document}
\lipsum
\afterpage{%
\begingroup
\onecolumn
\scriptsize
\centering
\begin{longtable} [c]{p{1cm}p{1.8cm}p{1cm}p{2cm}p{2.1cm}p{1.3cm}p{2cm}}
\caption{High Level Overview of Existing Frameworks}
\label{tab:general-description-v1}\\
\hline
%\rowcolor[HTML]{9B9B9B}
\textbf{Name} &
\textbf{Authors} &
\textbf{Year} &
\textbf{Column A} &
\textbf{Column B} &
\textbf{Column C} &
\textbf{Column D} \\ \hline
\endfirsthead
%
\multicolumn{6}{c}%
{{\bfseries Table \thetable\ continued from previous page}} \\
\hline
%\rowcolor[HTML]{9B9B9B}
\textbf{Name} &
\textbf{Authors} &
\textbf{Year} &
\textbf{Column A} &
\textbf{Column B} &
\textbf{Column C} &
\textbf{Column D} \\ \hline
\endhead
%
AA\textsuperscript{*}&
citation 1 &
2019 - 2020 &
data 1 &
data 2 &
\begin{tabular}[c]{@{}l@{}}data 3\end{tabular} &
\begin{tabular}[c]{@{}l@{}}data 4\end{tabular} \\ \hline
\multirow{2}{*}{BB\textsuperscript{*} }
&citation 2 &
2010 &
\begin{tabular}[c]{@{}l@{}}data 1 \end{tabular} &
\begin{tabular}[c]{@{}l@{}}data 2\end{tabular} &
\begin{tabular}[c]{@{}l@{}}data 3\end{tabular} &
\begin{tabular}[c]{@{}l@{}}data 4\end{tabular} \\ \cline{2-7}
&citation 3 &
2013 &
data 1 &
\begin{tabular}[c]{@{}l@{}}data 2\end{tabular} &
\begin{tabular}[c]{@{}l@{}}data 3\end{tabular} &
\begin{tabular}[c]{@{}l@{}}data 4\end{tabular} \\ \hline
\end{longtable}
\twocolumn
\endgroup
}%
\raggedbottom
\lipsum
\end{document}
Upvotes: 0