3

I am trying to build a table on LaTeX with Parbox. I have found how to do with \parbox. However, the length between rows makes the text so pack. Do you know how to increase the length?

I have tried with \parbox[15em]{108pt}{\raggedright according to: \parbox[position][height][inner-pos]{width}{text} included on herbert.the-little-red-haired-girl.org/html/latex2e/… However, I don't get the space between the rows :(

My table code is given below:

\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}

Thank you for your help.

  • 2
    One problem here is that a parbox (and minipage) loses its baseline skips for the first/last lines, as discussed in How to keep a constant baseline skip when using minipages (or \parboxes)? (possible duplicate). Of course, there are other problems with your setup, but that doesn't seem to be relevant to the actual question, since you only pose the problem with the spacing (related to the \parbox baseline skip). – Werner Mar 8 '15 at 5:04
3

Since you are using p column type, there is no need for all those \parboxes. The \raggedright can be inserted in to the column defintion making the code tidy. I hace used \RaggedRight from ragged2e package to enable hyphenation. And at last \cline{1-3} has been changed to \cline{1-2}. And the width of columns have been specified as a fraction of line width instead of hard coded values.

\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}

enter image description here

  • Thank you for your help. I have already added the changes to the complete table – Juan Perez Mar 8 '15 at 22:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.