# Vertical line enclosing items in itemize

I want to LaTeX some notes. The result should look like this:

The numbers are fine with me. The problem is how to draw those vertical lines (with the hook), particularly inside the itemize environment.

The result should be a new environment which automatically draws these vertical lines (with the right colours and the hooks). Note that there shouldn't be a line if the input is only one line long (or maybe a very short line with a hook).

Here is a quick try with Tikz:

\documentclass{standalone}

\usepackage{tikz}

\newenvironment{itemizewithline}[3]{%
\newcommand{\itemwithline}[1]{%
\begin{tikzpicture}
\node (box){%
\begin{minipage}{\textwidth}
\item   ##1
\end{minipage}
};
\coordinate[shift={(-\itemsep,-0.75em)}] (boxne) at (box.north west);
\coordinate[shift={(-\itemsep,0.25em)}] (boxse) at (box.south west);
\draw[\colorhook] (boxne) -- (boxse) -- ++ (0.2,0);
\end{tikzpicture}
}
\edef\colorhook{#1}
\edef\titletext{{#2}}
\edef\subtitletext{{#3}}
\begin{tikzpicture}
\node (box)\bgroup
\begin{minipage}{\textwidth}
\begin{itemize}
}{%
\end{itemize}
\end{minipage}
\egroup;
\node[anchor=south west,color=\colorhook] (title) at (box.north west){\titletext};
\node[anchor=west] (subtitle) at (title.east){\subtitletext};
\draw[\colorhook] (title.south west) -- (title.south east);
\coordinate[shift={(2em,0)}] (hookstart) at (title.south west);
\coordinate[shift={(0,0)}] (boxsw) at (box.south west);
\draw[\colorhook,line width=1.5pt] (hookstart) -- (hookstart|-boxsw) -- ++ (0.2,0);
\end{tikzpicture}
}

\begin{document}

\begin{itemizewithline}{red}{Title}{subtitle}
\itemwithline{one}
\itemwithline{two

three

four}
\itemwithline{five

six}
\end{itemizewithline}

\end{document}


The result:

tikz can do that if the page does not change, quite easily (it probably can also do that if the page changes, but it will be more tricky) using remember picture option and redefining \item.

• Just give us an MWE, that we can try it without study the documentation. – Holle Feb 26 '12 at 8:24