长度parbox LaTeX

时间:2015-03-08 03:57:02

标签: latex

我正在尝试使用parbox在LaTeX上构建一个表。我发现了如何处理parbox。但是,行之间的长度使文本如此打包。你知道如何增加长度吗?

\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 个答案:

答案 0 :(得分:0)

已使用tabular aragraph规范设置p列,因此无需使用\parbox(宽度相似)设置每个单元格。

您可能对tabularx感兴趣,因为它允许灵活宽度X - 列:

enter image description here

\documentclass{article}
\usepackage{tabularx}% Loads the array package

\begin{document}

\noindent
\begin{tabularx}{\linewidth}{|>{\raggedright}p{108pt}|>{\raggedright}X|>{\raggedright\arraybackslash}p{62pt}|}
  \hline
  Attribute & Description & Characteristic \\
  \hline
  Language & Programming language of the source code. & Project \\
  \hline
  Team\_size & Number of active core team members during the last 3 months prior to creation. & \\
  \hline
  Perc\_external\_contribs & Ratio of commits from external contributors over core team 
  members in the last 3 months prior to creation of pull request. & \\
  \hline
\end{tabularx}

\end{document}

如果您想进一步调整填充,请考虑阅读Column and row padding in tables