如何在双栏文档中制作包含大量文字的表格?

如何在双栏文档中制作包含大量文字的表格?

我一直试图将一个表格(本质上非常简单)插入到两列文档中。它一直抛出各种警告(最令人困惑的是:Missing number, treated as zero针对begin{tabular*}行。

我希望它看起来像一个简单的十字形表格,但插入\hlines 会使整个表格崩溃。此代码(参见下面的示例)发生的情况是,表格浮动在页面的右侧,显示{p|p}在表格的左侧(如果我将其替换为 ,则不会发生这种情况{c|c}),并且“&”符号似乎没有被识别为列更改。

该表不应注意文档其余部分的双列性,*我相信这就是添加 s 的原因。

\documentclass[a4paper, twocolumn]{article}
\usepackage{dblfloatfix} % floats in twocolumns come out in the right order

\begin{document}

\begin{table*}[t]
    \caption{problematic table}
    \label{tab:ohNo}
    \begin{tabular*}{p|p} 
    Title 1 & Title 2 \\
    there is no definitive formulation of a wicked problem & Energy efficiency can be framed as a techno-economic problem, or a problem related to fundamental issues as lifestyle and such. \\ 
    wicked problems have no stopping rule & Energy efficiency is a continuous process and must be related to many different factors such as cost efficiency and employees health and safety. 
    \end{tabular*}
\end{table*}

\end{document}

答案1

  • 环境tabular*需要指定表格宽度。在你的例子中,\begin{tabular*}{\linewidth}{<column specification>}
  • p必须有定义的宽度。例如p{0.45\linewidth}
  • 看来,tabularx带有X列类型(其宽度决定 LaTeX)的包以最简单的方式解决了您的问题:
\documentclass[a4paper, twocolumn]{article}
\usepackage{tabularx}

\begin{document}

\begin{table*}[t]
    \caption{problematic table}
    \label{tab:ohNo}
    \begin{tabularx}{\linewidth}{X|X}
    Title 1 & Title 2 \\
there is no definitive formulation of a wicked problem  
            & Energy efficiency can be framed as a techno-economic problem, or a problem related to fundamental issues as lifestyle and such. \\
wicked problems have no stopping rule 
            & Energy efficiency is a continuous process and must be related to many different factors such as cost efficiency and employees health and safety.
    \end{tabularx}
\end{table*}

\end{document}

在此处输入图片描述

相关内容