乳胶中的长表不会形成整齐的列

乳胶中的长表不会形成整齐的列

我有一张长表,需要将其拆分为多个表。我知道我不在 \begin{longtable} 环境中使用 \begin{tabular},但我不知道如何让长表中的列对齐。

这是我的桌子

\documentclass[12pt,letterpaper]{article}
\usepackage{longtable}
\begin{document}
 
\begin{longtable}\footnotesize 
{|p{0.5\textwidth}|p{0.5\textwidth}|}       
\hline       
\textbf{Positive Diplomacy Actions} & \textbf{Negative Diplomacy Actions} \\ 
\hline       
\endfirsthead       
\hline      \\
\hline       
\endhead 

Accede to demands for change in institutions, regime    & Accuse \\
Accede to demands for change in leadership &    Accuse of aggression \\
Accede to demands for change in policy  &Accuse of crime, corruption \\
Accede to demands for rights    &Accuse of espionage, treason\\
Acknowledge or claim responsibility & Accuse of human rights abuses\\
Allow humanitarian access   & Accuse of war crimes\\
Apologize   & Appeal for change in institutions, regime \\
Appeal for aid  & Appeal for change in leadership \\
Appeal for diplomatic cooperation (such as policy support)& Appeal for de-escalation of military engagement\\
\end{longtable}

\end{document}

它看起来是这样的:

在此处输入图片描述 有没有关于如何让第二列像使用表格环境时那样排列的帮助?谢谢!

答案1

  • 考虑@DavidCarlisle 注释并footnotesize在其之前移动longtable或者直接删除它们,您的代码就可以被编译并给出以下结果:

在此处输入图片描述

(红线表示页面布局)

  • 因此,不清楚您的问题是什么。该表比 更宽,\textwidth因为您将列宽指定为p{0.5\textwidth}
  • 在这种情况下,您需要将列规范更改为:
\begin{longtable}{|*{2}{p{\dimexpr 0.5\textwidth-2\tabcolsep-1.5\arrayrulewidth}|}}

并将得到一个不会突出文本块的表格:

在此处输入图片描述

  • 通过使用 longtable`,您可以获得更简单的代码和更好的结果(根据我的观点)tabularray˙ package instead of

\documentclass[12pt,letterpaper]{article}
%--------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document}
\begin{longtblr}[
caption = {Long table},
  label = {tab:long}
                ]{vlines,
                  colspec = {X[l] X[l]},
                  cells= {font=\small\linespread{0.84}\selectfont},
                  row{1} = {font=\small\bfseries},
                  rowhead = 1
                  }
    \toprule
Positive Diplomacy Actions & Negative Diplomacy Actions    \\
    \midrule
%%%%
Accede to demands for change in institutions, regime    & Accuse \\
Accede to demands for change in leadership &    Accuse of aggression \\
Accede to demands for change in policy  &Accuse of crime, corruption \\
Accede to demands for rights    &Accuse of espionage, treason\\
Acknowledge or claim responsibility & Accuse of human rights abuses\\
Allow humanitarian access   & Accuse of war crimes\\
Apologize   & Appeal for change in institutions, regime \\
Appeal for aid  & Appeal for change in leadership \\
Appeal for diplomatic cooperation (such as policy support)& Appeal for de-escalation of military engagement\\
    \bottomrule
\end{longtblr}

\end{document}

在此处输入图片描述

相关内容