答案1
如果你不介意跨页面边界打破块,那么可以将每个元素(左和右)设置在tabular
:
\documentclass{article}
\usepackage{xcolor,lipsum}
\newenvironment{labelitem}[1]{%
\par\addvspace{\medskipamount}
\noindent
\begin{tabular}[t]{@{} p{\dimexpr.35\linewidth-\tabcolsep} }
#1
\end{tabular}%
{\color{blue!75!white}\vrule width 4pt\relax}%
\begin{tabular}[t]{ p{\dimexpr.65\linewidth-\tabcolsep-4pt} @{} }
}{%
\end{tabular}%
}
\begin{document}
\begin{labelitem}{Label 1}
Lorem ipsum dolor sit amet.
\end{labelitem}
\begin{labelitem}{Label 2}
Lorem ipsum dolor sit amet.
\end{labelitem}
\begin{labelitem}{Label 3}
Lorem ipsum dolor sit amet.
\end{labelitem}
\begin{labelitem}{Label 4}
\lipsum*[1]
\end{labelitem}
\end{document}
答案2
tabularx
下面是使用单个环境和\multicolumn
表行之间留空的不同方法:
\documentclass{article}
\usepackage{tabularx}
\newcommand{\mymc}{\multicolumn{2}{c}{}\\}
\usepackage{lipsum}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{p{3cm}|X}
label 1 & Lorem ipsum dolor sit amet. \\ \mymc
label 2 & Lorem ipsum dolor sit amet. \\ \mymc
label 3 & Lorem ipsum dolor sit amet. \\ \mymc
label 4 with longer text & \lipsum[5] \\
\end{tabularx}
\end{document}
答案3
您可以添加一个低级 TeX 指令\noalign
,在行之间留出垂直空间。
\documentclass{article}
\usepackage{tabularx}
\usepackage{lipsum}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{p{3cm}|X}
label 1 & Lorem ipsum dolor sit amet. \\ \noalign{\vskip5mm}
label 2 & Lorem ipsum dolor sit amet. \\ \noalign{\vskip5mm}
label 3 & Lorem ipsum dolor sit amet. \\ \noalign{\vskip5mm}
label 4 with longer text & \lipsum[5] \\
\end{tabularx}
\end{document}