tabular
在另一列的单元格内使用环境后,我在垂直对齐四个多行单元格时遇到了问题。
由于表格宽度超出了边距,我决定使用环境tabular
将单元格的内容放在两行上。它解决了宽度问题,但在右侧创建了另一个单元格,multirow
单元格无法正确垂直居中。
\PassOptionsToPackage{table,dvipsnames}{xcolor}
%%%
\documentclass[12pt,footinput=true,headinput=true, openright]{scrbook} % KOMA-Script book
\usepackage[a5paper]{geometry}
\usepackage[T1]{fontenc}
\usepackage[scottish, french]{babel}
\usepackage{graphicx}
\usepackage[labelformat=empty]{caption}
\usepackage[np]{numprint}
\usepackage{palatino}
\usepackage{amsthm}
\usepackage{setspace}
\linespread{1.2}
\usepackage[dvipsnames]{xcolor}
\newcommand\gae[1]{\textcolor{NavyBlue}{\textbf{#1}}}
\usepackage{tipa}
\usepackage{multirow}
\usepackage{gensymb}
\usepackage{parskip}
\usepackage{etoolbox}
\usepackage[many]{tcolorbox}
\AtBeginEnvironment{tcolorbox}{\small}
\usepackage{tikz}
\usepackage{placeins}
\usepackage{url}
\usepackage{wrapfig}
%%%%%%%%%%%%%
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{|l|c|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{\multirow{2}{*}{}} & \multicolumn{2}{c|}{Déclaration} & \multicolumn{2}{c|}{Question} \\ \cline{3-6}
\multicolumn{2}{|c|}{} & être & ne pas ... & être & ne pas... \\ \hline
\textbf{je} & \begin{tabular}[c]{@{}c@{}}\gae{mi} \\ {[}mi{]}\end{tabular} & \multirow{7}{*}{\begin{tabular}[c]{@{}c@{}}\gae{tha}\\ {[}ha{]}\end{tabular}} & \multirow{7}{*}{\begin{tabular}[c]{@{}c@{}}\gae{chan eil}\\ {[}xan yil{]}\end{tabular}} & \multirow{7}{*}{\begin{tabular}[c]{@{}c@{}}\gae{a' bheil}\\ {[}a vil{]}\end{tabular}} & \multirow{7}{*}{\begin{tabular}[c]{@{}c@{}}\gae{nach eil}\\ {[}nax yil{]}\end{tabular}} \\ \cline{1-2}
\textbf{tu} & \begin{tabular}[c]{@{}c@{}}\gae{thu}\\{[}hu{]} \end{tabular} & & & & \\ \cline{1-2}
\textbf{elle} & \begin{tabular}[c]{@{}c@{}}\gae{i}\\ {[}i{]}\end{tabular} & & & & \\ \cline{1-2}
\textbf{il} & \begin{tabular}[c]{@{}c@{}}\gae{e}\\ {[}e{]} \end{tabular} & & & & \\ \cline{1-2}
\textbf{nous} & \begin{tabular}[c]{@{}c@{}}\gae{sinn}\\ {[}hèn{]}\end{tabular} & & & & \\ \cline{1-2}
\textbf{vous} & \begin{tabular}[c]{@{}c@{}}\gae{sibh}\\ {[}siv{]}\end{tabular} & & & & \\ \cline{1-2}
\textbf{ils / elles} & \begin{tabular}[c]{@{}c@{}}\gae{iad}\\ {[}yad{]}\end{tabular} & & & & \\ \hline
\end{tabular}
\end{table}
\end{document}
怎么解决呢?
先感谢您
答案1
为了简化表格,您可以系统地使用\makecell
和multirowcell
。为了确保多行单元格的垂直对齐效果更好,您不必使用完全相同的等效行数 - 您甚至可以使用十进制数来调整对齐效果。在这里,13 行就可以产生正确的对齐效果。
\PassOptionsToPackage{table,dvipsnames}{xcolor}
%%%
\documentclass[12pt,footinput=true,headinput=true, openright]{scrbook} % KOMA-Script book
\usepackage[a5paper]{geometry}
\usepackage[T1]{fontenc}
\usepackage[scottish, french]{babel}
\usepackage{graphicx}
\usepackage[labelformat=empty]{caption}
\usepackage[np]{numprint}
\usepackage{palatino}
\usepackage{amsthm}
\usepackage{setspace}
\linespread{1.2}
\usepackage[dvipsnames]{xcolor}
\newcommand\gae[1]{\textcolor{NavyBlue}{\textbf{#1}}}
\usepackage{tipa}
\usepackage{multirow}
\usepackage{gensymb}
\usepackage{parskip}
\usepackage{etoolbox}
\usepackage[many]{tcolorbox}
\AtBeginEnvironment{tcolorbox}{\small}
\usepackage{tikz}
\usepackage{placeins}
\usepackage{url}
\usepackage{wrapfig}
\usepackage{makecell}
%%%%%%%%%%%%%
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{|l|c|c|c|c|c|}
\hline
\multicolumn{2}{|c|}{\multirow{2}{*}{}} & \multicolumn{2}{c|}{Déclaration} & \multicolumn{2}{c|}{Question} \\ \cline{3-6}
\multicolumn{2}{|c|}{} & être & ne pas ... & être & ne pas... \\ \hline
\textbf{je} & \makecell{\gae{mi} \\ {[}mi{]}} & \multirowcell{13}{\gae{tha}\\ {[}ha{]}} & \multirowcell{13}{\gae{chan eil}\\ {[}xan yil{]}}& \multirowcell{13}{\gae{a' bheil}\\ {[}a vil{]}} & \multirowcell{13}{\gae{nach eil}\\ {[}nax yil{]}} \\ \cline{1-2}
\textbf{tu} & \makecell{\gae{thu}\\{[}hu{]}} & & & & \\ \cline{1-2}
\textbf{elle} & \makecell{\gae{i}\\ {[}i{]}} & & & & \\ \cline{1-2}
\textbf{il} & \makecell{\gae{e}\\ {[}e{]}} & & & & \\ \cline{1-2}
\textbf{nous} & \makecell{\gae{sinn}\\ {[}hèn{]}} & & & & \\ \cline{1-2}
\textbf{vous} & \makecell{\gae{sibh}\\ {[}siv{]}} & & & & \\ \cline{1-2}
\textbf{ils / elles} & \makecell{\gae{iad}\\ {[}yad{]}} & & & & \\ \hline
\end{tabular}
\end{table}
\end{document}