# Bulleted list with vertical lines

I want to add different positions within a company in a similar fashion to what LinkedIn uses, i.e. the vertical line connecting the dots of the bullet list. How can this be done?

Edit: now with a minimal working example after doing some research:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{tikzpicture}[remember picture]%
\node (#1) [gray,circle,fill,inner sep=1.5pt]{};
\end{tikzpicture}%
}
\begin{document}

\begin{itemize}
\item[\linkedlist{a}] test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph.
\end{itemize}
\begin{tikzpicture}[remember picture,overlay]
\draw[gray] ($(a)!0.1!(b)$) -- ($(a)!0.9!(b)$);
\draw[gray] ($(b)!0.2!(c)$) -- ($(b)!0.8!(c)$);
\end{tikzpicture}

\end{document}


The problem currently is that I need to add the lines manually in a second overlay picture and that I specify the "gap" between the dot and the start/end of the line using a percentage instead of a fixed value (e.g. 2pt). This causes the gaps to be of different size depending on the length of the paragraph.

• Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – albert Oct 11 '18 at 10:55
• I've added an MWE. – Tommiie Oct 11 '18 at 11:39

## Final solution (edit3)

Now, the code should work with page breaks in lists as well. Hope you like it :) If anything is unclear or you want some explanation about parts, just let me know!

\documentclass{article}
\usepackage{tikz,tikzpagenodes}
\usetikzlibrary{calc}
\usepackage{refcount}

\newcounter{mylist} % new counter for amount of lists
\newcounter{mycnt}[mylist] % create new item counter
\newcounter{mytmp}[mylist] % tmp counter needed for checking before/after current item

\newcommand{\drawoptionsconn}{gray, shorten <= .5mm, shorten >= .5mm, thick}
\newcommand{\drawoptionsshort}{gray, shorten <= .5mm, shorten >= -1mm, thick}

\newcommand{\myitem}{% Modified \item to update counter and save nodes
\stepcounter{mycnt}%
i\alph{mylist}\arabic{mycnt}}]%
\label{item-\alph{mylist}\arabic{mycnt}}%
\ifnum\value{mycnt}>1%
\ifnum\getpagerefnumber{item-\alph{mylist}\arabic{mytmp}}<\getpagerefnumber{item-\alph{mylist}\arabic{mycnt}}%
\begin{tikzpicture}[remember picture,overlay]%
\expandafter\draw\expandafter[\drawoptionsshort] (i\alph{mylist}\arabic{mycnt}) --
++(0,3mm) --
(i\alph{mylist}\arabic{mycnt} |- current page text area.north);% draw short line
\end{tikzpicture}%
\else%
\begin{tikzpicture}[remember picture,overlay]%
\expandafter\draw\expandafter[\drawoptionsconn] (i\alph{mylist}\arabic{mytmp}) -- (i\alph{mylist}\arabic{mycnt});% draw the connecting lines
\end{tikzpicture}%
\fi%
\fi%
\IfRefUndefinedExpandable{item-\alph{mylist}\arabic{mytmp}}{}{% defined
\ifnum\getpagerefnumber{item-\alph{mylist}\arabic{mytmp}}>\getpagerefnumber{item-\alph{mylist}\arabic{mycnt}}%
\begin{tikzpicture}[remember picture,overlay]%
\expandafter\draw\expandafter[\drawoptionsshort] (i\alph{mylist}\arabic{mycnt}) --
++(0,-3mm) --
(i\alph{mylist}\arabic{mycnt} |- current page text area.south);% draw short line
\end{tikzpicture}%
\fi%
}%
}

\raisebox{0pt}[0pt][0pt]{\begin{tikzpicture}[remember picture]%
\node (#1) [gray,circle,fill,inner sep=1.5pt]{};
\end{tikzpicture}}%
}

\newenvironment{myitemize}{%
% Create new myitemize environment to keep track of the counters
\stepcounter{mylist}% increment list counter
\begin{itemize}
}{\end{itemize}%
}

\begin{document}

\rule[-32\baselineskip]{2pt}{32\baselineskip}
\begin{myitemize}
\myitem test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph.
\myitem test
\myitem test
\end{myitemize}

And a new list:
\begin{myitemize}
\myitem test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph.
\myitem test
\end{myitemize}

\end{document}


edit2: I managed to solve the problems @Tom mentioned by using \pgfmathsetmacro\result{int(\x-1)} and \result rather than \pgfmathparse{int(\x-1)} and \pgfmathresult. It looks like tikz uses \pgfmathparse for internal calculations that crashed the code. Using a name for it (\result), solves this issue. Also, I used the easier shorten syntax by @Ignasi.

TL;DR: Now thick works as it should, as well as the other options.

edit: Made the code work with many lists on many pages.

I used a list counter mylist and iterate over each node to plot the connecting line in the end of the newly created environment myitemize. This supports multiple lists on multiple pages.

Original solution: works as long as you have a single list. If you need multiple lists, page breaking, etc., you need to expand the code.

I used a new counter to name and save the nodes automatically and iterate over them in the end.

• I want to replace the \draw command with the one provided by Ignasi but \draw[gray, shorten >=1mm, shorten <=1mm] (i\pgfmathresult) -- (i\x); gives me a dimension too large error. What am I doing wrong? – Tommiie Oct 11 '18 at 13:31
• Also, simple adding thick to the draw options results in an error: No shape named i0 is known. – Tommiie Oct 11 '18 at 13:54
• Hm, sorry @Tom - I don't know why, I'll investigate. – nox Oct 11 '18 at 14:02
• @Tom I fixed the issue =) – nox Oct 11 '18 at 14:22
• @marmot Have you read the edits? The new code works with as many pages and as many lists as you want, as long as there is no page break between two items in the same list. I currently have a solution that takes care of page breaks as well, but want to give it a final touch. I will post it soon. – nox Oct 11 '18 at 15:53

You can use shorten option to fix a certain distance between node's border and end of line. There's no nees for calc:

\documentclass{article}
\usepackage{tikz}
%\usetikzlibrary{calc}

\begin{tikzpicture}[remember picture]%
\node (#1) [gray,circle,fill,inner sep=1.5pt]{};
\end{tikzpicture}%
}
\begin{document}

\begin{itemize}
\item[\linkedlist{a}] test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph. test with a very long paragraph.
\end{itemize}
\begin{tikzpicture}[remember picture,overlay]
\draw[gray, shorten >=1mm, shorten <=1mm] (a)-- (b);
\draw[gray, shorten >=1mm, shorten <=1mm] (b)-- (c);
\end{tikzpicture}

\end{document}


Update

If itemize list is replaced by an enumerate list, it's possible to declare a new linkedlist environment which does all the work and uses regular \items.

It works with only for one level lists and it doesn't break between pages.

\documentclass{article}
\usepackage{tikz}

\begin{tikzpicture}[remember picture]%
\node (#1) [gray,circle,fill,inner sep=1.5pt]{};
\end{tikzpicture}%
}

\renewcommand{\labelenumi}{\theenumi}
\begin{enumerate}
}{ \end{enumerate} \begin{tikzpicture}[remember picture,overlay]
\ifnum\value{enumi}>1% Only if there are at least 2 bullet points
\foreach \x [remember=\x as \lastx (initially 1)]
in {2,...,\value{enumi}}{% iterate over them
\draw[gray, shorten >=1mm, shorten <=1mm] (\lastx) -- (\x);}% and draw the connecting lines
\fi
\end{tikzpicture}
}

\begin{document}


• I once knew about this shorten command and was searching for it but could not find it. Thanks for the input! – Tommiie Oct 11 '18 at 13:17
• @Tom It appears in examples in pgfmanual but I could not find any comment about it. It seems it desappeared in some update. – Ignasi Oct 11 '18 at 13:22
• @Tom I've updated my answer with a new linkedlist environment. – Ignasi Oct 12 '18 at 7:32