如何为 LaTeX 表中的主要单元格制作多行“脚注行”?

如何为 LaTeX 表中的主要单元格制作多行“脚注行”?

我想通过以下方式尽量减少表格中大单元格的主导影响

  • 每行有两个主行,每个主行都有一个主导行,这样主导单元格将位于新主行中。我称此选项为“脚注行”,因为您要为主导内容创建一个新的全宽单单元格行。

数据是关于具有自己 ID 的 MCQ 问题。它们不相关,因此严格的表格结构不是强制性的。有一个 7 列的表格结构,其中一个单元格占主导地位(最大),导致表格中出现大量空白(见图 2)。参见图 1 中的单行演示,并重复 N 行,您将获得如图 2 所示的输出,其中有大量空白。

图 1 一行的输出,其中第一列设置为主导(但没有现在数据样本中的行 ID),图 2 低分辨率示例输出,其中到处都是太多的白色

在此处输入图片描述 在此处输入图片描述

两行数据data.tex,主要单元格分别位于第二列和第三列

1 & What is the difference between technical picture of acute donald duck between dragon in early adulthood comparing with elderly? & South Dragon & North Dragon & Manifold manifolds & Manifest colonisation & Upper limit    &5 \\ \hline
2 & South Dragon & What is the difference between technical picture of acute donald duck between dragon in early adulthood comparing with elderly? & North Dragon & Manifold manifolds & Manifest colonisation & Upper limit    &5 \\ \hline

伪代码

\documentclass{article}
\usepackage{tabularx}
\usepackage{ltablex} % Bernard
\begin{document}

\begin{ltablex}
\centering
\begin{tabularx}{\textwidth}{|l|p{.25\linewidth}|X|X|X|X|X|l|} % http://tex.stackexchange.com/a/340832/13173

1 & What is the difference between technical picture of acute donald duck between dragon in early adulthood comparing with elderly? & South Dragon & North Dragon & Manifold manifolds & Manifest colonisation & Upper limit    &5 \\ \hline
% TODO processhere the second dominating column cell into a new row taking full linewidth.  

\end{tabularx}
\end{ltablex}

\end{document}

TeXLive:2016年
操作系统:Debian 8.5

答案1

我不太确定我是否理解了您的问题...下表是您正在寻找的吗?

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx}
\usepackage{ltablex} % Bernard
\keepXColumns

\begin{document}
{\setlength\tabcolsep{3pt}
\begin{tabularx}{\textwidth}{|l|*{5}{X|}l|} %
    \hline
1   &   \multicolumn{6}{|p{\dimexpr\textwidth-2\tabcolsep\relax}|}{
        What is the difference between technical picture of acute donald duck between dragon in early adulthood comparing with elderly?}                \\ \hline
2   &   South Dragon & North Dragon & Manifold manifolds 
        &   Manifest colonisation & Upper limit    &    5   \\ \hline
\end{tabularx}
}
\end{document}

附录: 看看以下解决方案是否是您想要的:

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx}
\usepackage{ltablex} % Bernard
\keepXColumns
\usepackage{ragged2e}
\newcommand\subtab[2]{
    \multicolumn{6}{@{}>{\RaggedRight\arraybackslash}p{\textwidth}@{}}{%
    \begin{tabular*}{\hsize}%
    {|p{\dimexpr0.05\hsize-2\tabcolsep-3\arrayrulewidth\relax}|
      p{\dimexpr0.95\hsize-2\tabcolsep\relax}|}
      #1    &   #2    
     \end{tabular*}}
                      }

\begin{document}
{\setlength\tabcolsep{3pt}
\begin{tabularx}{\textwidth}{|*{5}{X|}l|} %
    \hline
\subtab{1}{What is the difference between technical picture of acute donald duck between dragon in early adulthood comparing with elderly?
                                     }                      \\ \hline
South Dragon & North Dragon & Manifold manifolds
        &   Manifest colonisation & Upper limit    &    5   \\ \hline
\end{tabularx}
}
\end{document}

相关内容