首先,我不太确定如何正确地用语言表达我的问题,更不用说加标题了,所以如果标题有点误导,我很抱歉。
我认为通过以下示例来描述是最容易的:
\documentclass[landscape]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{longtable,booktabs,tabulary,tabu}
\begin{document}
\begin{longtabu} to \textwidth {X[-0.5]X[1]X[1]}
c1 & c2 & c3 \\ \toprule
c1 c1 c1 c1 c1 c1 c1 c1 c1 c1 &c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 & c3\\
& c2-2 should continue w/o whitespace above & c3-2 \\
& c2-3 & c3-3 \\
& c2-4 & c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 \\
& c2-5 should continue w/o whitespace above & \\
c1-6 & c2-6 & c3-6 \\
\end{longtabu}
\end{document}
基本上,我希望c2
在可能的情况下保持“连续”(即当c1
和c3
为空时)。有什么想法吗?:)
答案1
我猜你想做的事可以用 来实现multirow
,但需要进行一些手动调整。例如,使用默认设置multirow
( \multirowsetup=\raggedright
,第五c3
行将溢出到第六行,因此你必须添加一个额外的行来释放第六行。
\documentclass[landscape]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{longtable,booktabs,tabulary,tabu}
\usepackage{multirow}
\begin{document}
\renewcommand{\multirowsetup}{} % not \raggedright
\begin{longtabu} to \textwidth {X[-0.5]X[1]X[1]}
c1 & c2 & c3 \\ \toprule
\multirow[t]{2}={c1 c1 c1 c1 c1 c1 c1 c1 c1 c1} &c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 & c3\\
& c2-2 should continue w/o whitespace above & c3-2 \\
& c2-3 & c3-3 \\
& c2-4 & \multirow[t]{2}={c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4} \\
& c2-5 should continue w/o whitespace above & \\
c1-6 & c2-6 & c3-6 \\
\end{longtabu}
\end{document}
这里采用默认的多行设置,导致溢出:
\documentclass[landscape]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{longtable,booktabs,tabulary,tabu}
\usepackage{multirow}
\begin{document}
\begin{longtabu} to \textwidth {X[-0.5]X[1]X[1]}
c1 & c2 & c3 \\ \toprule
\multirow[t]{2}={c1 c1 c1 c1 c1 c1 c1 c1 c1 c1} &c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 c2 & c3\\
& c2-2 should continue w/o whitespace above & c3-2 \\
& c2-3 & c3-3 \\
& c2-4 & \multirow[t]{2}={c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4 c3-4} \\
& c2-5 should continue w/o whitespace above & \\
\\ % extra row
c1-6 & c2-6 & c3-6 \\
\end{longtabu}
\end{document}