增加两行之间的空间?

增加两行之间的空间?

这可能是重复的增加两行之间的空间。但是因为里面有太多数学表达式,我可能没办法理解。很遗憾。

我想增加两行之间的间距,以便可以使用钢笔或铅笔手动填写表格。这是 MWE。

\documentclass[a4paper]{article}

%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{booktabs}
%% Sets page size and margins
\usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
\begin{document}
\begin{table}
\centering
\begin{tabular}{p{5cm} p{5cm}}
\toprule 
Item & Quantity \\
\midrule 
Widgets & \dotfill \\ 
Gadgets & \dotfill \\
\midrule 
\end{tabular}
\end{table}
\end{document}

答案1

这里我展示 3 种方法:

  1. 可选参数\\[]

  2. 手动添加空行

  3. 在需要的地方向线路添加自定义支柱。

方法 1 在以下情况下将不起作用\modrule

\documentclass[a4paper]{article}

%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{booktabs}
%% Sets page size and margins
\usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
\begin{document}
%\begin{table}
\centering
Use optional argument to \verb|\\|, but can't be used for line after a
\verb|\midrule|

\begin{tabular}{p{5cm} p{5cm}}
\toprule 
Item & Quantity \\
\midrule 
Widgets & \dotfill \\[10pt]
Gadgets & \dotfill \\
\midrule 
\end{tabular}
%\end{table}

\bigskip

Add blank lines manually

\begin{tabular}{p{5cm} p{5cm}}
\toprule 
Item & Quantity \\
\midrule 
&\\
Widgets & \dotfill \\
&\\
Gadgets & \dotfill \\
\midrule 
\end{tabular}

\bigskip

Add a strut where needed

\def\mystrut{\rule{0pt}{2\normalbaselineskip}}
\begin{tabular}{p{5cm} p{5cm}}
\toprule 
Item & Quantity \\
\midrule 
Widgets\mystrut & \dotfill \\
Gadgets\mystrut & \dotfill \\
\midrule 
\end{tabular}

\end{document}

在此处输入图片描述

答案2

您可以\addlinespace使用booktabs

\documentclass[a4paper]{article}

%% Language and font encodings
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{booktabs}
%% Sets page size and margins

\usepackage[a4paper,top=3cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

\begin{document}

\begin{table}
\centering
\begin{tabular}{p{5cm} p{5cm}}
\toprule
Item & Quantity \\
\midrule
\addlinespace[1cm]
Widgets & \dotfill \\
\addlinespace[0.8cm]
Gadgets & \dotfill \\
\midrule
\end{tabular}
\end{table}

\end{document} 

在此处输入图片描述

答案3

调整arraystretch

\documentclass{article}
\usepackage{booktabs}
\begin{document}
{ % begin box to localize effect of arraystretch change
\renewcommand{\arraystretch}{3.0}
\begin{table}
    \centering
    \begin{tabular}{p{5cm} p{5cm}}
        \toprule 
        Item & Quantity \\
        \midrule 
        Widgets & \dotfill \\ 
        Gadgets & \dotfill \\
        \midrule 
    \end{tabular}
\end{table}
} % end box
\end{document}

在此处输入图片描述

相关内容