我有ThreePartTable
2 页的跨页。有些列有列表。我X
为此使用了列类型和\newline
命令。但是在以下示例中,我没有在第二行中获取换行符。我该如何解决这个问题?
\documentclass[12pt,a4paper]{article}
\usepackage{blindtext}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{ltablex}
\usepackage{threeparttable}
\usepackage[referable]{threeparttablex}
\usepackage{siunitx}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
\footnotesize
\begin{ThreePartTable}
\begin{TableNotes}
\item[a] \label{a} Note 1
\item[b] \label{b} Note 2
\end{TableNotes}
\centering
\begin{tabularx}{\linewidth}{cXXcc}
\caption{Table Title}\\%
\toprule
\textbf{Head 1}&%
\textbf{Head 2}&%
\textbf{Head 3}&%
\textbf{\makecell{Head 4.1\\Head 4.2}}&%
\textbf{\makecell{Head 5.1\\Head 5.2}}\\
\midrule
\endfirsthead
%
\multicolumn{5}{l}%
{\tablename\ \thetable~--~continued from previous page}\\
\toprule
\textbf{Head 1}&%
\textbf{Head 2}&%
\textbf{Head 3}&%
\textbf{\makecell{Head 4.1\\Head 4.2}}&%
\textbf{\makecell{Head 5.1\\Head 5.2}}\\
\midrule
\endhead
%
\midrule
\multicolumn{5}{r}%
{Continued in next page...}\\
\endfoot
%
\bottomrule
\insertTableNotes
\endlastfoot
%
\makecell{Parameter 1\\(\si{\ug}) \tnotex{a}}&$\bullet$ Item 1&$\bullet$ Item 2&5910&$\bullet$ Day\\
\\
\makecell{Parameter 2 \tnotex{b}\\(\si{\mg/\L})}& $\bullet$ Item 3&
$\bullet$ List 1\newline
$\bullet$ List 2\newline
$\bullet$ List 3&2320&$\bullet$ Day\\
\end{tabularx}%
\end{ThreePartTable}%
\end{landscape}%
\end{document}
答案1
以下是一个简化的代码,它使用指令执行您想要的操作\keepXColumns
,并将enumitem
实际列表环境调整为表格上下文。我删除了threeparttable
加载,因为 threeparttablex
加载了它:
\documentclass[12pt,a4paper]{article}
\usepackage{blindtext}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize\bfseries}
\usepackage{ltablex}
\usepackage[referable]{threeparttablex}
\usepackage{enumitem}
\usepackage{siunitx}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
\footnotesize\keepXColumns
\setlist[itemize]{wide=0pt, leftmargin=*, nosep, before=\vspace*{-\baselineskip}, after=\vspace*{-\baselineskip}}
\begin{ThreePartTable}
\begin{TableNotes}
\item[a] \label{a} Note 1
\item[b] \label{b} Note 2
\end{TableNotes}
\centering
\begin{tabularx}{\linewidth}{cXXcc}
\caption{Table Title}\\%
\toprule
\thead{Head 1}&%
\thead{Head 2}&%
\thead{Head 3}&%
\thead{Head 4.1\\Head 4.2} &%
\thead{Head 5.1\\Head 5.2} \\
\midrule
\endfirsthead
%
\multicolumn{5}{l}%
{\tablename\ \thetable~--~continued from previous page}\\
\toprule
\thead{Head 1}&%
\thead{Head 2}&%
\thead{Head 3}&%
\thead{Head 4.1\\Head 4.2} &%
\thead{Head 5.1\\Head 5.2} \\
\midrule
\endhead
%
\midrule
\multicolumn{5}{r}%
{Continued in next page...}\\
\endfoot
%
\bottomrule
\insertTableNotes
\endlastfoot
%
\makecell{Parameter 1\\(\si{\ug}) \tnotex{a}}&
\begin{itemize}
\item Item 1
\end{itemize}&
\begin{itemize}
\item Item 2
\end{itemize}
& 5910& $\bullet$ Day\\
\\
\makecell{Parameter 2 \tnotex{b}\\(\si{\mg/\L})}&
\begin{itemize}
\item Item 3
\end{itemize}
&
\begin{itemize}[]
\item List 1
\item List 2
\item List 3
\end{itemize}
&2320&$\bullet$ Day
\end{tabularx}%
\end{ThreePartTable}%
\end{landscape}%
\end{document}
答案2
一个不幸的特性是,如果它认为可以的话,ltablex
它会将X
列转换为列。l
只需使用tabularx
包或添加
\keepXColumns