我有一个简单的表格,可以使用下面的简单 MWE 重新创建,我正在使用 XeLaTeX 进行编译:
\documentclass[12pt]{article}
\usepackage[letterpaper, left=19mm, right=19mm, top=3.52cm, bottom=2.84cm, headheight=38.7pt]{geometry}
\usepackage{setspace}
\setstretch{1.15}
\usepackage{tabularx}
\usepackage{array}
\usepackage{fontspec}
\setmainfont{Arial}
\usepackage{microtype}
\begin{document}
\begin{flushleft}
\begin{tabular}{@{}m{4.4cm}m{12.5cm}@{}}
\hline
\textbf{TO:} & Mr.\noindent and Mrs.\noindent J. Doe \\[0.54cm]
\hline
\textbf{SUBJECT:} & This is just a sample subject that is design to illustrate the text wrapping\\[0.54cm]
\hline
\textbf{DATE:} & \today \\
\hline
\end{tabular}
\end{flushleft}
\end{document}
生成下表:
正如您在前两行中看到的,相邻单元格的内容并未按各自的中心垂直对齐,我添加了hline
s 以使其明显。我如何才能正确居中它们?
答案1
如果您想增加行高,您应该通过\renewcommand{\arraystretch}{<someFactor>}
。
% arara: xelatex
\documentclass[12pt]{article}
\usepackage[letterpaper, left=19mm, right=19mm, top=3.52cm, bottom=2.84cm, headheight=38.7pt]{geometry}
\usepackage{setspace}
\setstretch{1.15}
\usepackage{booktabs}
\usepackage{array}
\begin{document}
%\renewcommand{\arraystretch}{1.5} % adjust value to your needs
\noindent
\begin{tabular}{@{}m{4.4cm}m{12.95cm}@{}} % increased to maximum width
\toprule
\textbf{TO:} & Mr.\ and Mrs.\ J.~Doe \\%\addlinespace % if you need some space after your row
\midrule
\textbf{SUBJECT:} & This is just a sample subject that is design to illustrate the text wrapping\\
\midrule
\textbf{DATE:} & \today \\
\bottomrule
\end{tabular}
\end{document}