我遇到了一个奇怪的问题,最后一列最后一个单元格中的单词不想与该特定单元格的中间对齐。这是我的 LaTeX 代码:
\documentclass{article}
\usepackage{tabu}
\usepackage{hyperref}
\begin{document}
\setcounter{footnote}{2} % mimic actual document
\begin{table}
\centering
\begin{tabu} to 0.95\textwidth {|X[2,c,m]|X[1,c,m]|X[1,c,m]|X[1,c,m]|}
\hline Proposed syllabification & Sonority Ranking Hierarchy & Maximum Onset Principle\footnotemark & Morpheme Boundaries \\[9pt]
\hline\hline
\end{tabu}
\end{table}
\end{document}
它看起来是这样的:
有人能提出解决方案吗?
答案1
虽然我没有尝试使用你的确切框架来解决这个问题,但我通过切换到booktabs
风格的表格,我觉得这样更好。
请查看下面的修改后的代码,下面的渲染结果,以及下面的代码背页。
\documentclass{article}
\usepackage{booktabs}
\usepackage{tabu}
\usepackage{hyperref}
\begin{document}
\setcounter{footnote}{2} % mimic actual document
\begin{table}
\centering
\begin{tabu} to 0.95\textwidth {X[2,c,m]X[1,c,m]X[1,c,m]X[1,c,m]}
\toprule
Proposed syllabification & Sonority Ranking Hierarchy & Maximum Onset Principle\footnotemark & Morpheme Boundaries \\
\midrule
%
\bottomrule
\end{tabu}
\end{table}
\end{document}
虽然我没有这样做,但我也建议你使用tabu
,C
将最接近您当前的(X
)版本,但也可以进行定制修改。
最后,请注意页眉或其他 表格 线[9em]
通常可以通过其他方式更好地控制,而不是在换行符分隔符()后手动添加间距修饰符(例如) \\
。
答案2
[Xpt]
以我的经验来看,当您使用像本帖中的粗线时,使用负值才能补偿不需要的空间:\hhline 在彩色表格中覆盖 \vline;你只需擦除它或使用 来控制垂直间距\vspace{-\baselineskip}
,tabu
使用主框架tabularx
和其他方法带来了更友好的语法,但作为衍生产品,并不是完全灵活的。
结果:
梅威瑟:
% arara: pdflatex: {synctex: yes, action: nonstopmode}
\documentclass{article}
\usepackage{tabu}
\usepackage{longtable}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{array}
\usepackage[longtable]{multirow}
\begin{document}
\tabulinesep=3pt
Result using tabu: Erasing {\color{red}{\verb+...[9pt]+}} in {\color{red}{\verb+...ndaries\\[9pt]+}}
\begin{center}
then {\color{red}{\verb+... ndaries\\+}}:\\
\end{center}
\begin{tabu} to 0.95\linewidth {|X[2cm]| X[1cm]| X[1cm]| X[1cm]|}
\hline
Proposed syllabification
&Sonority Ranking Hierarchy
& Maximum Onset Principle\footnotemark&
Morpheme Boundaries \\
\hline
text which is considerably longer than the width of the column
&text which is considerably longer than the width of the column
&text which is considerably longer than the width of the column
&text which is considerably longer than the width of the column\\
\hline\hline
\end{tabu}
\vspace{\baselineskip}
If you need to control the vertical position in a cell, just use:
\begin{center}
{\color{red}{\verb+\vspace{-\baselineskip}Morphe...+}}\\
\end{center}
\begin{tabu} to 0.95\linewidth {|X[2cm]| X[1cm]| X[1cm]| X[1cm]|}
\hline
Proposed syllabification
&Sonority Ranking Hierarchy
& Maximum Onset Principle\footnotemark&
\vspace{-\baselineskip}Morpheme Boundaries \\
\hline
text which is considerably longer than the width of the column
&text which is considerably longer than the width of the column
&text which is considerably longer than the width of the column
&text which is considerably longer than the width of the column\\
\hline\hline
\end{tabu}
\end{document}