4

I am trying to add a left border to a column in a table (tabular, longtable) but I do not want the lines to connect between cells. Rather, I want a space between the rows, like this image here:

enter image description here

3

If you don't care about breaking the block across the page boundary, you can set each element (left and right) inside a tabular:

enter image description here

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

Here is a different approach using a single tabularx environment and and empty \multicolumn between each table row:

enter image description here

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

You can add a low-level TeX instruction \noalign with a vertical space between the rows.

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

Output of the above code

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.