I've a problem with parbox spacing in combination with hyphenation. What I like to achieve is setting parboxes in a tabular-like way as key value pairs. So I have two parboxes with a given width per line. The first problem was the hyphenation of the first word in parbox, that was solved by using \hspace{0pt}
. Now, when I have multiple lines, each with a key and a value parbox, there's no vertical spacing between.
So I tried to overcome this by using a \strut
. Now, I have the vertical spacing, but the hyphenation of the first word does no longer work.
Please see the following minimal working example:
\documentclass[10pt,a4paper]{article}
\newcommand{\myKey}{MyLongKeyLabel}
\newcommand{\myValue}{ThisIsMyLongValue}
\newcommand{\myKeyValuePair}{%
\parbox[t]{20mm}{\raggedright%
\hspace{0pt}\myKey%\strut%
}%
\hspace{3mm}%
\parbox[t]{20mm}{\raggedright%
\hspace{0pt}\myValue%\strut%
}\par
}
\begin{document}
\myKeyValuePair
\myKeyValuePair
\myKeyValuePair
\end{document}
When uncommenting the \strut
commands hyphenation will no longer work.
My question is: How can I achieve hyphenation of the first word in a parbox AND have vertical spacing between parboxes in consecutive lines?
Thanks in advance for any ideas.
\hyphenation{My-Long-Key-Label}
so that the breaks come only at "logical" places. – barbara beeton Mar 9 '15 at 13:16