我需要打印一个包含多列的表格。我正在考虑两种方法:
打印表格如下(假设纸张每行只能打印 6 个日期):
Measure date1 date2 date3 date4 date5 date6 1 2 3 4 5 6 date 7 date8 date8 date10 date11 date12 2 8 10 12 10 12
这是我的 MWE:
%!TEX TS-Program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage{tabularx}
\usepackage[margin=2.5cm]{geometry}
\newcommand\zcolumn[1]{%
\begin{tabular}{c}#1\end{tabular}\linebreak[0]}
\begin{document}
\begin{tabularx}{\textwidth}{lX}
VOID \\
AWAKE &
\begin{raggedright}
\zcolumn{5/31/16\\ a}
\zcolumn{6/1/16\\ b}
\zcolumn{6/2/16\\ c}
\zcolumn{6/3/16\\ d}
\zcolumn{6/4/16\\ e}
\zcolumn{6/5/16\\ a}
\zcolumn{6/6/16\\ b}
\zcolumn{6/7/16\\ c}
\zcolumn{6/8/16\\ d}
\zcolumn{6/9/16\\ e}
\zcolumn{6/10/16\\ d}
\zcolumn{6/11/16\\ e}
\zcolumn{6/12/16\\ d}
\zcolumn{6/13/16\\ e}
\end{raggedright}
\\
\hline
\end{tabularx}
\newpage
\end{document}
它正确打印此表 - 日期和值在一行并溢出到下一行
但是当我将相同的逻辑应用到我的实际代码时,它会垂直打印日期和值。
有人可以帮忙吗?
我的最小真实代码:
%!TEX TS-Program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass{article}
\usepackage{graphics}
\usepackage{fancyhdr}
\usepackage{ctable}
\usepackage{array}
\usepackage{tabularx}
\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{}
\begin{document}
\thispagestyle{empty}
\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}