gpt4 book ai didi

How to put table in full page when Document format is double column(文档格式为双栏时如何整页放置表格)

转载 作者:bug小助手 更新时间:2023-10-25 12:51:53 24 4
gpt4 key购买 nike



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.

我有一个带有els文章文档类(Elsevier Journal)的Latex文档,它在双列中。我试图将一张长表放在一列中,但这行不通,这张表杂乱无章,而且没有占据整个宽度。我尝试在long table命令中添加一个*,但也不起作用。


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.

更新:我还在Begin{Longtable}之后尝试了命令\onecolumn,并在结尾处尝试了命令\doublecolumn,但它不起作用,整篇论文变成了一个专栏,这是我不想要的。


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?

有什么办法解决这个问题吗?


更多回答
优秀答案推荐

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}

更多回答

Thank you for your answer. Your current approach does effectively make the tables full-width while keeping a double-column layout for the text. However, a significant problem arises with this solution. Due to the tables' length, my document encounters excessive empty space either below or sometimes before the tables. This can lead to one of the double-columns being entirely blank until the table starts on the next page. As a result, the text frequently continues on the following pages. Do you have any suggestions for addressing and resolving this issue?

谢谢你的回答。您当前的方法确实有效地使表格变得全宽,同时保持文本的双列布局。然而,这种解决方案出现了一个严重的问题。由于表的长度,我的文档在表的下面或前面遇到了过多的空白。这可能会导致其中一个双列完全空白,直到表格开始下一页。因此,案文经常在以下几页继续。你对解决这个问题有什么建议吗?

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com