答案1
根据单元格宽度是否固定,有两种方法:
- 对于标准单元格(列说明符
r, l
或c
),您可以使用makecell
命令, - 对于固定宽度的单元格,使用
m{some length}
列类型
两者的演示:
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\usepackage{array}
\usepackage{makecell}
\renewcommand\theadalign{cb}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}
\begin{document}
\sffamily
\begin{tabular}{ | c | c !{\vrule width2.5pt}}
\hline
\makecell{multi-lined \\ contents} & single line \\
\Xhline{2.5pt}
\end{tabular}
%
\qquad
%
\setlength{\extrarowheight}{3pt}
\begin{tabular}{|>{\centering}m{20mm}|>{\centering\arraybackslash}m{20mm} !{\vrule width2.5pt}}
\hline
multi-lined \newline contents & single line \\
\Xhline{2.5pt}
\end{tabular}
\end{document}