我正在尝试使用 Parbox 在 LaTeX 上创建表格。我找到了如何使用\parbox
。但是,行之间的长度使得文本太拥挤。你知道如何增加长度吗?
我已尝试\parbox[15em]{108pt}{\raggedright
根据:\parbox[position][height][inner-pos]{width}{text}
包括在内herbert.the-little-red-haired-girl.org/html/latex2e/…
但是,我没有得到行之间的空间:(
我的表格代码如下:
\documentclass{article}
\usepackage{multirow}
\begin{document}
{\raggedright
\vspace{3pt} \noindent
\begin{tabular}{|p{108pt}|p{223pt}|p{52pt}|}
\hline
\parbox{108pt}{\raggedright
Attribute
} & \parbox{223pt}{\raggedright
Description
} & \parbox{52pt}{\raggedright
Characteristic
} \\
\hline
\parbox{108pt}{\raggedright
Language
} & \parbox{223pt}{\raggedright
Programming language of the source code.
} & \parbox{52pt}{\raggedright \multirow{5}{*}{
Project
}} \\
\cline{1-3}
\parbox{108pt}{\raggedright
Team\_size
} & \parbox[70em]{223pt}{\raggedright
Number of active core team members during the last 3 months prior to creation.
} & \\
\cline{1-3}
\parbox[15em]{108pt}{\raggedright
Perc\_external\_contribs
} & \parbox{223pt}{\raggedright
Ratio of commits from external contributors over core team members in the last 3 months prior to creation of pull request.
} & \\
\cline{1-2}
\hline
\end{tabular}
\vspace{2pt}
\end{document}
感谢您的帮助。
答案1
由于您使用的是p
列类型,因此不需要所有这些\parbox
。\raggedright
可以插入到列定义中,使代码整洁。 我已经使用\RaggedRight
fromragged2e
包来启用连字符。 最后\cline{1-3}
已更改为\cline{1-2}
。 并且列的宽度已被指定为线宽的分数,而不是硬编码值。
\documentclass{article}
\usepackage{multirow}
\usepackage{array}
\usepackage{ragged2e}
\begin{document}
{\raggedright
\vspace{3pt} \noindent
\begin{tabular}{|>{\RaggedRight}p{0.275\linewidth}|>{\RaggedRight}p{0.55\linewidth}|
>{\RaggedRight\arraybackslash}p{0.18\linewidth}|}
\hline
Attribute
&
Description
&
Characteristic
\\
\hline
Language
&
Programming language of the source code.
& \multirow{5}{*}{
Project
} \\
\cline{1-2}
Team\_size
&
Number of active core team members during the last 3 months prior to creation.
& \\
\cline{1-2}
Perc\_external\_contribs
&
Ratio of commits from external contributors over core team members in the last 3 months prior to creation of pull request.
& \\
\cline{1-2}
\hline
\end{tabular}
\vspace{2pt}
\end{document}