我对 Latex 还不太熟悉,不确定我的问题的解决方法是否显而易见。我试图让这些 parboxes 的行间距均匀分布;项目与其描述以及描述与下一个项目名称之间的距离相同。描述有多行似乎有点混乱。此外,即使我将基线设置为字体大小的 1.2 倍,'g' 或 'y' 也会增加间距。
\documentclass{article}
% remove indentation of the first line of a paragraph
\setlength{\parindent}{0pt}
% set the length of spacing between paragraphs
\setlength{\parskip}{0pt}
\newcommand*\Entry[3]{%
\fontsize{10pt}{12pt}\selectfont
\parbox[m]{0.8\linewidth}%
{\textbf{#1}\;\dotfill}\;\textbf{\$\hfill#2}%
\ifx&%
\par%
\else%
\par\parbox[m]{0.8\linewidth}{#3}\par%
\fi%
}
\begin{document}
\Entry{Item 1}{100}{Description 1}
\Entry{Item 2}{120}{Description 2}
\Entry{Item 3}{120}{word word word word word word word word word word word word word word word }
\Entry{Item 4}{120}{Description 4}
\Entry{Item 5}{120}{Description 5 that is so long that it gets split up into multiple lines.}
\Entry{Item 6}{120}{Description 6 that is so long that it gets split up into multiple lines.}
\Entry{Item 7}{120}{Description 7}
\Entry{Item 8}{180}{word word word word word word word word word word word word word word word with g or y }
\Entry{Item name with y or g}{120}{Description 9}
\Entry{Item name with y or g}{120}{}
\Entry{Item name with y or g}{120}{}
\Entry{Item }{120}{}
\Entry{Item 10}{120}{Description 10}
\end{document}
答案1
你可以尝试一下
\documentclass{article}
% remove indentation of the first line of a paragraph
\setlength{\parindent}{0pt}
% set the length of spacing between paragraphs
\setlength{\parskip}{0pt}
\newcommand*\Entry[3]{%
\fontsize{10pt}{13pt}\selectfont
\begingroup
\makebox[0.8\linewidth][l]{\textbf{#1}\;\dotfill}\;\textbf{\$\hfill#2}%
\ifx&%
\par
\else
\par\rightskip0.2\linewidth #3\par
\fi
\endgroup
% \medskip % better no to separate items ?
}
\begin{document}
\Entry{Item 1}{100}{Description 1}
\Entry{Item 2}{120}{Description 2}
\Entry{Item 3}{120}{word word word word word word word word word word word word word word word }
\Entry{Item 4}{120}{Description 4}
\Entry{Item 5}{120}{Description 5 that is so long that it gets split up into multiple lines.}
\Entry{Item 6}{120}{Description 6 that is so long that it gets split up into multiple lines.}
\Entry{Item 7}{120}{Description 7}
\Entry{Item 8}{180}{word word word word word word word word word word word word word word word with g or y }
\Entry{Item name with y or g}{120}{Description 9}
\Entry{Item 10}{120}{Description 10}
\end{document}
这似乎实现了你的疑问
一个项目与其描述以及描述与下一个项目名称之间的距离相同。
但我宁愿在那里留出一些空间,正如评论中所指出的那样。