我在已经很复杂的表格中遇到了问题。带有“Lekta”的列必须移到表格底部并在那里关闭。我认为使用多行应该可以实现,但我无法成功……
以下是示例:
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{hhline}
\usepackage{multirow}
\usepackage{supertabular}
\begin{document}
\begin{supertabular}{p{1.418cm}p{3.128cm}|p{3.467cm}|p{4.1270003cm}|}
\hhline{~~--}
&
&
\multicolumn{2}{p{7.7940006cm}|}{\textbf{Circumstance}}\\\hhline{~~--}
&
&
\textbf{Same} &
\textbf{Different}\\\hline
\multicolumn{1}{|p{1.418cm}|}{\textbf{Lekta}} &
\textbf{Same } &
Always in agreement
&
Never in agreement or disagreement
\\\hline
&
\textbf{Different \& }\textbf{contradictory} &
Always in disagreement
&
Sometimes in disagreement\\\hhline{~---}
\end{supertabular}
\end{document}
答案1
我提出了一个基于 的解决方案,它结合了和ltablex
的功能。我假设您的宽度是由某些软件计算出来的。如果您需要调整列的宽度, 可以用 指令替换它。以下代码中的剩余列被替换为以确保单元格内容垂直居中。longtable
tabularx
p(somelength)
>{\hsize= xx\hsize}
X
p{…}
m{…}
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{array, multirow}
\usepackage{ragged2e}
\usepackage{ltablex}
\renewcommand{\tabularxcolumn}[1]{>{\RaggedRight\arraybackslash}m{#1}}
\begin{document}
\renewcommand\arraystretch{1.2}
\begin{tabularx}{\linewidth}{|m{1.418cm}|>{\hsize=0.8\hsize}X|>{\hsize=1.1\hsize}X|>{\hsize=1.1\hsize}X|}%m{3.128cm}
\cline{3-4}
\multicolumn{2}{c|}{}
&
\multicolumn{2}{c|}{\textbf{Circumstance}}\\
\cline{3-4}
\multicolumn{2}{c|}{}
&
\textbf{Same} &
\textbf{Different}\\\hline
\multirow{4}{1.418cm}[1.8ex]{\textbf{Lekta}} &
\textbf{Same } &
Always in agreement
&
Never in agreement or disagreement\\
\cline{2-4}
&
\textbf{Different \& }\textbf{contradictory} &
Always in disagreement
&
Sometimes in disagreement\\
\hline
\end{tabularx}
\end{document}
答案2
您可以使用\multicolumn
它来删除或添加垂直线。
我不确定这是否是你想要的,但我觉得这很合理。最大的问题是在空间中垂直放置“Lekta”的位置。坦率地说,最简单的解决方案就是玩弄它,[fixup]
直到它看起来像你想要的那样。
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{hhline}
\usepackage{multirow}
\usepackage{supertabular}
\begin{document}
\begin{supertabular}{|p{1.418cm}|p{3.128cm}|p{3.467cm}|p{4.1270003cm}|}
\hhline{~~--}
\multicolumn{1}{c}{ }&
&
\multicolumn{2}{p{7.7940006cm}|}{\textbf{Circumstance}}\\ \hhline{~~--}
\multicolumn{1}{c}{ }&
&
\textbf{Same} &
\textbf{Different}\\ \hline
\multirow{2}{1.418cm}[1.5ex]{\textbf{Lekta}} &
\textbf{Same } &
Always in agreement
&
Never in agreement or disagreement
\\ \cline{2-4}
& \raggedright
\textbf{Different \& }\textbf{contradictory} &
Always in disagreement
&
Sometimes in disagreement\\ \hline
\end{supertabular}
\end{document}