我在兩個 parbox 之間以及 parbox 與新文本段落開頭之間的垂直空間不均勻。如何解決這些問題?這是一個最小的工作範例。
\documentclass{article}
\usepackage{calc}
\begin{document}
Hello 0!!
\parbox[t]{\textwidth-2.5cm}{\noindent{\textsc{\bfseries{First Document Management System}:} This is a long description of Document Management System. Very long indeed to fill two lines.}}\parbox[t]{2.5cm}{\hfill{2005-2009}}
\parbox[t]{\textwidth-2.5cm}{\noindent{\textsc{\bfseries{Second Document Management System}:} This is a long description of Document Management System. Very long indeed to fill two lines.}}\parbox[t]{2.5cm}{\hfill{2009-Present}}
\parbox[t]{\textwidth-2.5cm}{\noindent{\textsc{\bfseries{Last Document Management System}:} This is a long description of Document Management System. Very long indeed to fill two lines.}}\parbox[t]{2.5cm}{\hfill{2009-Present}}
Hello 1!!
Hello 2!!
\end{document}
我想要一個類似的間隙,例如兩個 paraboxes 之間的 Hello 1 和 Hello 2 之間的間隙以及最後一個 parbox 和 Hello 1 之間的類似間隙。
答案1
你應該使用以下方式來寫所有\parbox
es
\parbox[.]{<len>}{\strut ... \strut}
為了獲得適當的行高 -\strut
確保這一點。
但是,您的輸入可以使用以下方式以稍微不同的方式呈現tabularx
方法並且更容易管理:
\documentclass{article}
\usepackage{tabularx,array}
\newcommand{\highlight}[1]{\textbf{#1}}
\begin{document}
Hello 0!!\strut
\noindent
\begin{tabularx}{\linewidth}{@{} X >{\raggedleft\arraybackslash}p{2.5cm}@{}}
\highlight{First Document Management System}:
This is a long description of Document Management System. Very long indeed to fill two lines. &
2005--2009 \\
\highlight{Second Document Management System}: This is a long description of Document Management System.
Very long indeed to fill two lines. &
2009--Present \\
\highlight{Last Document Management System}: This is a long description of Document Management System.
Very long indeed to fill two lines. &
2009--Present
\end{tabularx}
Hello 1!!
Hello 2!!
\end{document}
請注意,tabularx
不可跨頁面邊界破壞。
答案2
你可以使用你可以找到的技巧我的答案到使用小型頁面(或 \parboxes)時如何保持恆定的基線跳過?
您還應該透過定義環境來避免重複的明確標記。
\documentclass{article}
\usepackage{calc,xparse}
\NewDocumentEnvironment{entry}{O{2.5cm}mm}
{\noindent\begin{minipage}[t]{\textwidth-#1}
\textsc{#3:} \ignorespaces}
{\par\xdef\tpd{\the\prevdepth}% the trick in https://tex.stackexchange.com/a/34982/
\end{minipage}%
\makebox[#1][r]{#2}\par
\prevdepth\tpd}
\begin{document}
Hello!!
\begin{entry}{2005-2009}{First Document Management System}
This is a long description of Document Management System. Very long
indeed to fill two lines.
\end{entry}
\begin{entry}{2009-Present}{Second Document Management System}
This is a long description of Document Management System. Very long
indeed to fill two lines.
\end{entry}
\begin{entry}{2009-Present}{Last Document Management System}
This is a long description of Document Management System. Very long
indeed to fill two lines.
\end{entry}
Hello 1!!
Hello 2!!
\end{document}