Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is it possible to have list environments (itemize, enumerate, ...) which have a vertical line between the label (i.e. the bullet/number) and the listing content?

Probably this is best explained using an image, I want to achieve something like this:

List

Edit: Some more info on the intended behaviour: If a pagebreak occurs, the line should naturally continue on the new page.

share|improve this question
1  
If you don't mind to use several tcolorbox instead of one itemize, take a look at Gonzalo's answer in How to align tcolorbox at the top?. You'll have to change box dimensions and use $\bullet$ as optional parameter. –  Ignasi May 7 at 14:06

3 Answers 3

Here is my not so elegant and very lame solution: using tabular within the itemize.

\documentclass{article}
\usepackage{lipsum}
\newcommand{\LinedItem}[1]{\item \begin{tabular}[t]{|p{10cm}}#1\end{tabular}}
\begin{document}
\lipsum[1]
\begin{itemize} 
    \LinedItem{\lipsum[2]}
    \LinedItem{\lipsum[3]}
    \LinedItem{A fairly small one!}
\end{itemize}
\lipsum[4]
\end{document}

enter image description here

Few possible updates that I leave to you to test are: Instead of p{10cm}, try something more general like p{\SomeInterestingWidth}. Secondly, you can try with other packages such as tabularx to change the behavior in the line break.

share|improve this answer
    
\begin{tabular}[t] would be more intuitive. –  egreg May 7 at 15:29
    
@egreg, indeed you are right. I did as you suggested. Thanks. –  Pouya May 7 at 15:41

A solution with mdframed, that also allows page breaks in the item. Not that I endorse this layout.

\documentclass{article}
\usepackage{lipsum,mdframed}

\mdfdefinestyle{litem}{
  skipabove=0pt,
  skipbelow=0pt,
  leftmargin=\dimexpr\leftmargini-\fboxrule-2pt\relax,
  rightmargin=0pt,
  innerleftmargin=2pt,
  innerrightmargin=0pt,
  innertopmargin=0pt,
  innerbottommargin=0pt,
  leftline=true,
  rightline=false,
  topline=false,
  bottomline=false,
}

\newenvironment{litemize}{\trivlist\item\relax}{\endtrivlist}
\newenvironment{litem}
  {%
   \par\addvspace{3\itemsep}
   \begin{mdframed}[style=litem]
   \makebox[0pt][r]{\textbullet\hspace{\dimexpr\labelsep+2pt+\fboxrule}}\ignorespaces
  }
  {%
   \end{mdframed}
  }

\begin{document}
\lipsum[2]
\begin{itemize}
\item a
\item b
\end{itemize}
Some text to separate the two environments
\begin{litemize}
  \begin{litem}
  \lipsum*[2]
  \end{litem}

  \begin{litem}
  \lipsum*[3]
  \end{litem}

  \begin{litem}
  A fairly small one!
  \end{litem}
\end{litemize}
\lipsum[4]
\end{document}

enter image description here

share|improve this answer

A tcolorbox version which allows page breaks and is heavily customizable:

\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins,breakable}
\usepackage{lipsum}


\newtcolorbox{mybox}{
  freelance,
  breakable,
  colback=white,
  top=0pt,
  frame code={                          %%decoration code for unbreakable version
    \draw(frame.north west)--(frame.south west);
    \node[at=(frame.north west),anchor=north east,xshift=-5pt,circle,fill=black, inner sep=3pt]{};
  },
  extend freelancefirst={               %%decoration code for breakable version, first page
    frame code={
      \draw(frame.north west)--(frame.south west);
      \node[at=(frame.north west),anchor=north east,xshift=-5pt,circle,fill=black]{};
    },
  },
  extend freelancemiddle={              %%decoration code for breakable version, middle pages
    frame code={
      \draw(frame.north west)--(frame.south west);
    },
  },
  extend freelancelast={                %%decoration code for breakable version, last page
    frame code={
      \draw(frame.north west)--(frame.south west);
    },
  },
}

\newcommand{\myitem}[1]{\item\begin{mybox}#1\end{mybox}}
\begin{document}
\begin{itemize}
  \myitem{one line}
  \myitem{two

  lines}
  \myitem{\lipsum}
\end{itemize}

\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.