在我改用 ltablex 包后,我发现额外的对齐标签已更改为 \cr。如果我使用 tabularx 包,就不会出现这个问题。
这是我的 MWE,错误出现在第 46 行:
%!TEX TS-Program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage{graphics}
\usepackage{fancyhdr}
\usepackage{ctable}
\usepackage{array}
\usepackage{ltablex}
\usepackage[margin=2.5cm]{geometry}
\setlength\parindent{0pt}
\newcommand{\sectionheader}[1] {
\textbf{#1}
\rule{\textwidth}{6pt}
}
\newcommand\zcolumn[1]{%
{\begin{tabular}{c}#1\end{tabular}\linebreak[0]}}
\setlength{\heavyrulewidth}{0.12em}
\pagenumbering{arabic}
\pagestyle{fancy}
\lhead{Patient Name: Claire Roberts}
\rhead{\thepage}
\cfoot{}
\keepXColumns
\begin{document}
\sectionheader{PATIENT INFORMATION}
\begin{tabularx}{\textwidth}{lX}
Birth Date: & 10/10/69 \\
Gender: & F \\
\end{tabularx}
\sectionheader{CONTACT INFORMATION}
\begin{tabularx}{\textwidth}{lX}
Phone: & 206.555.1212 \\
Email: & [email protected] \\
Address: & {\begin{tabularx}{\textwidth}{l}7000 Central Ave NE\\default location
line2\\Minneapolis MN 55432\\ \end{tabularx}}
\end{tabularx}
\bigskip
\newpage
\sectionheader{SYMPTOMS}
\begin{tabularx}{\textwidth}{lX}
\textbf{PERCEPTION}\\
SATISFACTION &
\begin{raggedright}
\zcolumn{5/31/16 \\ -}
\zcolumn{6/1/16 \\ -}
\zcolumn{6/2/16 \\ -}
\zcolumn{6/3/16 \\ -}
\zcolumn{6/4/16 \\ -}
\zcolumn{6/5/16 \\ 2}
\zcolumn{6/6/16 \\ -}
\zcolumn{6/7/16 \\ 2}
\zcolumn{6/8/16 \\ -}
\zcolumn{6/9/16 \\ -}
\zcolumn{6/10/16 \\ -}
\zcolumn{6/11/16 \\ -}
\zcolumn{6/12/16 \\ -}
\zcolumn{6/13/16 \\ -}
\zcolumn{6/14/16 \\ -}
\zcolumn{6/15/16 \\ -}
\end{raggedright}
\\
\hline
\textbf{VOID}\\
AWAKE &
\begin{raggedright}
\zcolumn{5/31/16 \\ -}
\zcolumn{6/1/16 \\ -}
\zcolumn{6/2/16 \\ -}
\zcolumn{6/3/16 \\ 5}
\zcolumn{6/4/16 \\ -}
\zcolumn{6/5/16 \\ -}
\zcolumn{6/6/16 \\ 2}
\zcolumn{6/7/16 \\ 1}
\zcolumn{6/8/16 \\ -}
\zcolumn{6/9/16 \\ -}
\zcolumn{6/10/16 \\ -}
\zcolumn{6/11/16 \\ -}
\zcolumn{6/12/16 \\ -}
\zcolumn{6/13/16 \\ -}
\zcolumn{6/14/16 \\ -}
\zcolumn{6/15/16 \\ -}
\end{raggedright}
\\SLEEPING &
\begin{raggedright}
\zcolumn{5/31/16 \\ -}
\zcolumn{6/1/16 \\ -}
\zcolumn{6/2/16 \\ 5}
\zcolumn{6/3/16 \\ -}
\zcolumn{6/4/16 \\ -}
\zcolumn{6/5/16 \\ 1}
\zcolumn{6/6/16 \\ -}
\zcolumn{6/7/16 \\ -}
\zcolumn{6/8/16 \\ -}
\zcolumn{6/9/16 \\ -}
\zcolumn{6/10/16 \\ -}
\zcolumn{6/11/16 \\ -}
\zcolumn{6/12/16 \\ -}
\zcolumn{6/13/16 \\ -}
\zcolumn{6/14/16 \\ -}
\zcolumn{6/15/16 \\ -}
\end{raggedright}
\\URGENCY &
\begin{raggedright}
\zcolumn{5/31/16 \\ -}
\zcolumn{6/1/16 \\ -}
\zcolumn{6/2/16 \\ -}
\zcolumn{6/3/16 \\ -}
\zcolumn{6/4/16 \\ 2}
\zcolumn{6/5/16 \\ -}
\zcolumn{6/6/16 \\ -}
\zcolumn{6/7/16 \\ -}
\zcolumn{6/8/16 \\ -}
\zcolumn{6/9/16 \\ -}
\zcolumn{6/10/16 \\ -}
\zcolumn{6/11/16 \\ -}
\zcolumn{6/12/16 \\ -}
\zcolumn{6/13/16 \\ -}
\zcolumn{6/14/16 \\ -}
\zcolumn{6/15/16 \\ -}
\end{raggedright}
\\
\hline
\textbf{UR}\\
UR\_LEAK\_AMOUNT &
\begin{raggedright}
\zcolumn{5/31/16 \\ -}
\zcolumn{6/1/16 \\ -}
\zcolumn{6/2/16 \\ -}
\zcolumn{6/3/16 \\ -}
\zcolumn{6/4/16 \\ -}
\zcolumn{6/5/16 \\ -}
\zcolumn{6/6/16 \\ Moderate}
\zcolumn{6/7/16 \\ -}
\zcolumn{6/8/16 \\ -}
\zcolumn{6/9/16 \\ -}
\zcolumn{6/10/16 \\ -}
\zcolumn{6/11/16 \\ -}
\zcolumn{6/12/16 \\ -}
\zcolumn{6/13/16 \\ -}
\zcolumn{6/14/16 \\ -}
\zcolumn{6/15/16 \\ -}
\end{raggedright}
\\TOTAL &
\begin{raggedright}
\zcolumn{5/31/16 \\ -}
\zcolumn{6/1/16 \\ -}
\zcolumn{6/2/16 \\ -}
\zcolumn{6/3/16 \\ -}
\zcolumn{6/4/16 \\ -}
\zcolumn{6/5/16 \\ 1}
\zcolumn{6/6/16 \\ -}
\zcolumn{6/7/16 \\ -}
\zcolumn{6/8/16 \\ -}
\zcolumn{6/9/16 \\ -}
\zcolumn{6/10/16 \\ -}
\zcolumn{6/11/16 \\ -}
\zcolumn{6/12/16 \\ -}
\zcolumn{6/13/16 \\ -}
\zcolumn{6/14/16 \\ -}
\zcolumn{6/15/16 \\ -}
\end{raggedright}
\\
\hline
\textbf{BM}\\
AWAKE &
\begin{raggedright}
\zcolumn{5/31/16 \\ -}
\zcolumn{6/1/16 \\ -}
\zcolumn{6/2/16 \\ -}
\zcolumn{6/3/16 \\ -}
\zcolumn{6/4/16 \\ -}
\zcolumn{6/5/16 \\ -}
\zcolumn{6/6/16 \\ -}
\zcolumn{6/7/16 \\ 3}
\zcolumn{6/8/16 \\ -}
\zcolumn{6/9/16 \\ -}
\zcolumn{6/10/16 \\ -}
\zcolumn{6/11/16 \\ -}
\zcolumn{6/12/16 \\ -}
\zcolumn{6/13/16 \\ -}
\zcolumn{6/14/16 \\ -}
\zcolumn{6/15/16 \\ -}
\end{raggedright}
\\SLEEPING &
\begin{raggedright}
\zcolumn{5/31/16 \\ -}
\zcolumn{6/1/16 \\ -}
\zcolumn{6/2/16 \\ -}
\zcolumn{6/3/16 \\ -}
\zcolumn{6/4/16 \\ -}
\zcolumn{6/5/16 \\ -}
\zcolumn{6/6/16 \\ 5}
\zcolumn{6/7/16 \\ -}
\zcolumn{6/8/16 \\ -}
\zcolumn{6/9/16 \\ -}
\zcolumn{6/10/16 \\ -}
\zcolumn{6/11/16 \\ -}
\zcolumn{6/12/16 \\ -}
\zcolumn{6/13/16 \\ -}
\zcolumn{6/14/16 \\ -}
\zcolumn{6/15/16 \\ -}
\end{raggedright}
\\SOIL\_AMOUNT &
\begin{raggedright}
\zcolumn{5/31/16 \\ -}
\zcolumn{6/1/16 \\ -}
\zcolumn{6/2/16 \\ -}
\zcolumn{6/3/16 \\ -}
\zcolumn{6/4/16 \\ -}
\zcolumn{6/5/16 \\ -}
\zcolumn{6/6/16 \\ -}
\zcolumn{6/7/16 \\ -}
\zcolumn{6/8/16 \\ -}
\zcolumn{6/9/16 \\ -}
\zcolumn{6/10/16 \\ -}
\zcolumn{6/11/16 \\ -}
\zcolumn{6/12/16 \\ -}
\zcolumn{6/13/16 \\ -}
\zcolumn{6/14/16 \\ -}
\zcolumn{6/15/16 \\ -}
\end{raggedright}
\\
\hline
\textbf{BOWEL}\\
AMOUNT &
\begin{raggedright}
\zcolumn{5/31/16 \\ -}
\zcolumn{6/1/16 \\ -}
\zcolumn{6/2/16 \\ -}
\zcolumn{6/3/16 \\ -}
\zcolumn{6/4/16 \\ 6}
\zcolumn{6/5/16 \\ -}
\zcolumn{6/6/16 \\ 5}
\zcolumn{6/7/16 \\ -}
\zcolumn{6/8/16 \\ -}
\zcolumn{6/9/16 \\ -}
\zcolumn{6/10/16 \\ -}
\zcolumn{6/11/16 \\ -}
\zcolumn{6/12/16 \\ -}
\zcolumn{6/13/16 \\ -}
\zcolumn{6/14/16 \\ -}
\zcolumn{6/15/16 \\ -}
\end{raggedright}
\\TOTAL &
\begin{raggedright}
\zcolumn{5/31/16 \\ -}
\zcolumn{6/1/16 \\ -}
\zcolumn{6/2/16 \\ -}
\zcolumn{6/3/16 \\ -}
\zcolumn{6/4/16 \\ -}
\zcolumn{6/5/16 \\ 8}
\zcolumn{6/6/16 \\ -}
\zcolumn{6/7/16 \\ 9}
\zcolumn{6/8/16 \\ -}
\zcolumn{6/9/16 \\ -}
\zcolumn{6/10/16 \\ -}
\zcolumn{6/11/16 \\ -}
\zcolumn{6/12/16 \\ -}
\zcolumn{6/13/16 \\ -}
\zcolumn{6/14/16 \\ -}
\zcolumn{6/15/16 \\ -}
\end{raggedright}
\\
\hline
\textbf{PADS}\\
TOTAL &
\begin{raggedright}
\zcolumn{5/31/16 \\ -}
\zcolumn{6/1/16 \\ -}
\zcolumn{6/2/16 \\ -}
\zcolumn{6/3/16 \\ -}
\zcolumn{6/4/16 \\ -}
\zcolumn{6/5/16 \\ 9}
\zcolumn{6/6/16 \\ -}
\zcolumn{6/7/16 \\ 8}
\zcolumn{6/8/16 \\ -}
\zcolumn{6/9/16 \\ -}
\zcolumn{6/10/16 \\ -}
\zcolumn{6/11/16 \\ -}
\zcolumn{6/12/16 \\ -}
\zcolumn{6/13/16 \\ -}
\zcolumn{6/14/16 \\ -}
\zcolumn{6/15/16 \\ -}
\end{raggedright}
\\
\hline
\end{tabularx}
\newpage
\bigskip
\end{document}
以下是第 46 行附近的代码:
\sectionheader{CONTACT INFORMATION}
\begin{tabularx}{\textwidth}{lX}
Phone: & 206.555.1212 \\
Email: & [email protected] \\
Address: & {\begin{tabularx}{\textwidth}{l}7000 Central Ave NE\\default location
line2\\Minneapolis MN 55432\\ \end{tabularx}}
\end{tabularx} % line#46
答案1
由于某种原因,嵌套的 tabularx 不起作用。我用一个\makecell
命令替换它们并重新定义该\zcolumn
命令,以便第二行(主要是连字符,我将其更改为更相关的 endash)成为选修的参数。这样代码就更简单了。我在行组之间添加了一些填充,并将\hline
s 替换为\midrule
s。
%!TEX TS-Program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage{graphics}
\usepackage{fancyhdr}
\usepackage{ctable}
\usepackage{url}
\usepackage{array, booktabs, makecell}
\usepackage{ltablex}
\usepackage[margin=2.5cm]{geometry}
\setlength\parindent{0pt}
\newcommand{\sectionheader}[1] {
\textbf{#1}
\rule{\textwidth}{6pt}
}
%\newcommand\zcolumn[1]{%
%{\begin{tabular}{c}#1\end{tabular}\linebreak[0]}}
\newcommand\zcolumn[2][\textendash]{\makecell[tc]{#2\\#1}}
\setlength{\heavyrulewidth}{0.12em}
\pagenumbering{arabic}
\pagestyle{fancy}
\lhead{Patient Name: Claire Roberts}
\rhead{\thepage}
\cfoot{}
\keepXColumns
\begin{document}
\sectionheader{PATIENT INFORMATION}
\begin{tabularx}{\textwidth}{lX}
Birth Date: & 10/10/69 \\
Gender: & F \\
\end{tabularx}
\sectionheader{CONTACT INFORMATION}
\begin{tabularx}{\textwidth}{lX}
Phone: & 206.555.1212 \\
Email: & \url{[email protected]} \\[1ex]
Address: & \makecell[lt]{7000 Central Ave NE\\default location
line2\\Minneapolis MN 55432}
\end{tabularx}
\bigskip
\newpage
\sectionheader{SYMPTOMS}
\setlength\tabcolsep{5pt}
\begin{tabularx}{\textwidth}{@{}l*{8}{X}}
\\\midrule
\endfoot
\\\bottomrule
\endlastfoot
\textbf{PERCEPTION} \\[1ex]
SATISFACTION
& \zcolumn{5/31/16}
& \zcolumn{6/1/16}
& \zcolumn{6/2/16}
& \zcolumn{6/3/16}
& \zcolumn{6/4/16}
& \zcolumn[2]{6/5/16}
& \zcolumn{6/6/16}
& \zcolumn[2]{6/7/16}\\
\addlinespace
& \zcolumn{6/8/16}
& \zcolumn{6/9/16}
& \zcolumn{6/10/16}
& \zcolumn{6/11/16}
& \zcolumn{6/12/16}
& \zcolumn{6/13/16}
& \zcolumn{6/14/16}
& \zcolumn{6/15/16} \\
\midrule
\addlinespace
\textbf{VOID}\\[1ex]
AWAKE
&\zcolumn{5/31/16}
& \zcolumn{6/1/16}
& \zcolumn{6/2/16}
& \zcolumn[5]{6/3/16}
& \zcolumn{6/4/16}
& \zcolumn{6/5/16}
& \zcolumn[2]{6/6/16}
& \zcolumn[1]{6/7/16}\\
\addlinespace
& \zcolumn{6/8/16}
& \zcolumn{6/9/16}
& \zcolumn{6/10/16}
& \zcolumn{6/11/16}
& \zcolumn{6/12/16}
& \zcolumn{6/13/16}
& \zcolumn{6/14/16}
& \zcolumn{6/15/16}\\[5ex]
SLEEPING
& \zcolumn{5/31/16}
& \zcolumn{6/1/16}
& \zcolumn[5]{6/2/16}
& \zcolumn{6/3/16}
& \zcolumn{6/4/16}
& \zcolumn[1]{6/5/16}
& \zcolumn{6/6/16}
& \zcolumn{6/7/16}\\
\addlinespace
& \zcolumn{6/8/16}
& \zcolumn{6/9/16}
& \zcolumn{6/10/16}
& \zcolumn{6/11/16}
& \zcolumn{6/12/16}
& \zcolumn{6/13/16}
& \zcolumn{6/14/16}
& \zcolumn{6/15/16}\\[5ex]
URGENCY
& \zcolumn{5/31/16}
& \zcolumn{6/1/16}
& \zcolumn{6/2/16}
& \zcolumn{6/3/16}
& \zcolumn[2]{6/4/16}
& \zcolumn{6/5/16}
& \zcolumn{6/6/16}
& \zcolumn{6/7/16} \\
\addlinespace
& \zcolumn{6/8/16}
& \zcolumn{6/9/16}
& \zcolumn{6/10/16}
& \zcolumn{6/11/16}
& \zcolumn{6/12/16}
& \zcolumn{6/13/16}
& \zcolumn{6/14/16}
& \zcolumn{6/15/16} \\
\midrule
\addlinespace
\textbf{UR}\\[1ex]
UR\_LEAK\_AMOUNT
& \zcolumn{5/31/16}
& \zcolumn{6/1/16}
& \zcolumn{6/2/16}
& \zcolumn{6/3/16}
& \zcolumn{6/4/16}
& \zcolumn{6/5/16}
& \zcolumn[\footnotesize Moderate]{6/6/16}
& \zcolumn{6/7/16} \\
\addlinespace
& \zcolumn{6/8/16}
& \zcolumn{6/9/16}
& \zcolumn{6/10/16}
& \zcolumn{6/11/16}
& \zcolumn{6/12/16}
& \zcolumn{6/13/16}
& \zcolumn{6/14/16}
& \zcolumn{6/15/16}\\[5ex]
TOTAL
& \zcolumn{5/31/16}
& \zcolumn{6/1/16}
& \zcolumn{6/2/16}
& \zcolumn{6/3/16}
& \zcolumn{6/4/16}
& \zcolumn[1]{6/5/16}
& \zcolumn{6/6/16}
& \zcolumn{6/7/16} \\
\addlinespace
& \zcolumn{6/8/16}
& \zcolumn{6/9/16}
& \zcolumn{6/10/16}
& \zcolumn{6/11/16}
& \zcolumn{6/12/16}
& \zcolumn{6/13/16}
& \zcolumn{6/14/16}
& \zcolumn{6/15/16} \\
\midrule
\addlinespace
\textbf{BM}\\[1ex]
AWAKE
& \zcolumn{5/31/16}
& \zcolumn{6/1/16}
& \zcolumn{6/2/16}
& \zcolumn{6/3/16}
& \zcolumn{6/4/16}
& \zcolumn{6/5/16}
& \zcolumn{6/6/16}
& \zcolumn[3]{6/7/16} \\
\addlinespace
& \zcolumn{6/8/16}
& \zcolumn{6/9/16}
& \zcolumn{6/10/16}
& \zcolumn{6/11/16}
& \zcolumn{6/12/16}
& \zcolumn{6/13/16}
& \zcolumn{6/14/16}
& \zcolumn{6/15/16} \\[5ex]
SLEEPING
& \zcolumn{5/31/16}
& \zcolumn{6/1/16}
& \zcolumn{6/2/16}
& \zcolumn{6/3/16}
& \zcolumn{6/4/16}
& \zcolumn{6/5/16}
& \zcolumn[5]{6/6/16}
& \zcolumn{6/7/16} \\
\addlinespace
& \zcolumn{6/8/16}
& \zcolumn{6/9/16}
& \zcolumn{6/10/16}
& \zcolumn{6/11/16}
& \zcolumn{6/12/16}
& \zcolumn{6/13/16}
& \zcolumn{6/14/16}
& \zcolumn{6/15/16} \\[5ex]
SOIL\_AMOUNT
& \zcolumn{5/31/16}
& \zcolumn{6/1/16}
& \zcolumn{6/2/16}
& \zcolumn{6/3/16}
& \zcolumn{6/4/16}
& \zcolumn{6/5/16}
& \zcolumn{6/6/16}
& \zcolumn{6/7/16} \\
\addlinespace
& \zcolumn{6/8/16}
& \zcolumn{6/9/16}
& \zcolumn{6/10/16}
& \zcolumn{6/11/16}
& \zcolumn{6/12/16}
& \zcolumn{6/13/16}
& \zcolumn{6/14/16}
& \zcolumn{6/15/16} \\
\midrule
\addlinespace
\textbf{BOWEL}\\
AMOUNT
& \zcolumn{5/31/16}
& \zcolumn{6/1/16}
& \zcolumn{6/2/16}
& \zcolumn{6/3/16}
& \zcolumn{6/4/16 \\ 6}
& \zcolumn{6/5/16}
& \zcolumn{6/6/16 \\ 5}
& \zcolumn{6/7/16} \\
\addlinespace
& \zcolumn{6/8/16}
& \zcolumn{6/9/16}
& \zcolumn{6/10/16}
& \zcolumn{6/11/16}
& \zcolumn{6/12/16}
& \zcolumn{6/13/16}
& \zcolumn{6/14/16}
& \zcolumn{6/15/16} \\[5ex]
TOTAL
& \zcolumn{5/31/16}
& \zcolumn{6/1/16}
& \zcolumn{6/2/16}
& \zcolumn{6/3/16}
& \zcolumn{6/4/16}
& \zcolumn[8]{6/5/16}
& \zcolumn{6/6/16}
& \zcolumn[9]{6/7/16} \\[5ex]
& \zcolumn{6/8/16}
& \zcolumn{6/9/16}
& \zcolumn{6/10/16}
& \zcolumn{6/11/16}
& \zcolumn{6/12/16}
& \zcolumn{6/13/16}
& \zcolumn{6/14/16}
& \zcolumn{6/15/16} \\
\midrule
\addlinespace
\textbf{PADS}\\
TOTAL
& \zcolumn{5/31/16}
& \zcolumn{6/1/16}
& \zcolumn{6/2/16}
& \zcolumn{6/3/16}
& \zcolumn{6/4/16}
& \zcolumn[9]{6/5/16}
& \zcolumn{6/6/16}
& \zcolumn[8]{6/7/16}\\
\addlinespace
& \zcolumn{6/8/16}
& \zcolumn{6/9/16}
& \zcolumn{6/10/16}
& \zcolumn{6/11/16}
& \zcolumn{6/12/16}
& \zcolumn{6/13/16}
& \zcolumn{6/14/16}
& \zcolumn{6/15/16}
\end{tabularx}
\newpage
\bigskip
\end{document}