嵌套表格的问题

嵌套表格的问题

我在以下代码片段中使用嵌套表环境:

\begin{document}
\noindent
\begin{tabularx}{\textwidth}{rX lX}

  COURSEWORK & Machine Learning, Probabilitistic Learning, Probabilistic Graphical Models, Intermediate Statistics A \& B, Statistical Methodology I \& II, Statistical Computing, Information Retreival, Principles of Data Management, Data Structures, Computer Architecture\\
 \\*
  COURSEWORK & \begin{tabular}{ l l l }
   Machine Learning & Probabilistic Learning & Probabilistic Graphical Models \\
   Intermediate Statistics & Statistical Computing & Statistical Methods \\
   Principles of Data  & Data Structures & Computer Architecture \\
  \end{tabular}\\

\end{tabularx}

生成以下文件:

在此处输入图片描述

现在,此渲染存在三个问题:

  1. 课程的表格列表似乎有额外的缩进(注意条目已经左对齐)&
  2. 表格列表中的章节标题“课程作业”出现在中间行的前面,我希望它从表格列表的顶部开始。我尝试使用,\multirow但它没有将章节标题放在中间行的上方。

请建议如何实现这些目标。

答案1

使用删除s\tabcolsep开头和结尾的长度;可以使用 的可选参数来纠正对齐问题:tabular@{}ttabular

\documentclass{article}
\usepackage{tabularx}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{@{} r X l X @{}}
  COURSEWORK & Machine Learning, Probabilitistic Learning, Probabilistic Graphical Models, Intermediate Statistics A \& B, Statistical Methodology I \& II, Statistical Computing, Information Retreival, Principles of Data Management, Data Structures, Computer Architecture\\
 \\*
  COURSEWORK & \begin{tabular}[t]{@{} l l l @{} }
   Machine Learning & Probabilistic Learning & Probabilistic Graphical Models \\
   Intermediate Statistics & Statistical Computing & Statistical Methods \\
   Principles of Data  & Data Structures & Computer Architecture \\
  \end{tabular}\\
\end{tabularx}

\end{document}

在此处输入图片描述

相关内容