3

Does anyone know how to make a list with the dots linked by a line, like in the picture below?

enter image description here

fma
  • 407

1 Answers1

5

A version with enumitem and TikZ, applying overlay and remember picture, drawing circle nodes and connectors to them.

It won't work for lists that break over pages, however.

\documentclass{article}


\usepackage{tikz}
\usetikzlibrary{calc}

\usepackage{enumitem}

\newcounter{itemdot}
\DeclareRobustCommand{\dottedlinked}{%
  \begin{tikzpicture}[remember picture,overlay]
    \node[draw,anchor=base,inner sep=0pt,outer sep=0pt,circle,cyan] (itemdot\number\value{itemdot}) {\phantom{\textbullet}};
    \ifnum0<\value{itemdot}
    \draw[cyan,line width=0.5pt] (itemdot\number\value{itemdot}) -- (itemdot\the\numexpr\value{itemdot}-1);
    \fi
    \stepcounter{itemdot}
  \end{tikzpicture}%
}
\makeatletter
\g@addto@macro{\itemize}{\setcounter{itemdot}{0}} % reset the itemdot counter for a new itemize environment
\makeatother
\setlist[itemize,1]{label={\dottedlinked}}

\begin{document}
\begin{itemize}
  \item foo
  \item foobar
  \item foobar foobar
\end{itemize}

\begin{itemize}
  \item foo
  \item foobar
  \item foobar foobar
\end{itemize}

\end{document}

enter image description here

Edit -- with a new list

\documentclass{article}

\usepackage{blindtext}
\usepackage{tikz}

\usepackage{enumitem}

\newcounter{itemdot}
\DeclareRobustCommand{\dottedlinked}{%
  \begin{tikzpicture}[remember picture,overlay]
    \node[draw,anchor=base,inner sep=0pt,outer sep=0pt,circle,cyan,line width=1pt,yshift=0.1ex] (itemdot\number\value{itemdot}) {\phantom{\textbullet}};
    \ifnum0<\value{itemdot}
    \draw[cyan,line width=1pt,] (itemdot\number\value{itemdot}) -- (itemdot\the\numexpr\value{itemdot}-1);
    \fi
    \stepcounter{itemdot}%
  \end{tikzpicture}%
}
\makeatletter
\g@addto@macro{\itemize}{\setcounter{itemdot}{0}} % reset the itemdot counter for a new itemize environment
\makeatother

\newlist{itemcon}{itemize}{1}
\setlist[itemcon,1]{label={\dottedlinked}}

\begin{document}
\begin{itemcon}
  \item foo
  \item foobar

    \blindtext
  \item foobar foobar
  \item foobar foobar
  \item foobar foobar
    \blindtext[2]
  \item Foo
\end{itemcon}

\begin{itemize}
  \item foo
  \item foobar

        \blindtext
  \item foobar foobar
\end{itemize}



\end{document}
  • @JPi: Thanks, I have to rise the circles a little bit, yet –  May 06 '17 at 14:12
  • Wow, super nice, thanks! However what should I do if I want to mantain also the standard dot list? – fma May 06 '17 at 18:06
  • @Francesco: I've added another version, defining a special itemcon list type (i.e. itemize connected). –  May 06 '17 at 18:09
  • @ChristianHupfer thanks again! Is there any counterindication is using your solution in a different class w.r.t. article? I am trying to use it in the altacv class but at the level of the first \item I get this kind of error: `./main.tex:116: Missing number, treated as zero. \enit@cv@itemdot` Do you have any idea of what may be causing this? – fma May 06 '17 at 18:41
  • @Francesco: Do you have used a nested list there? –  May 06 '17 at 18:46
  • @ChristianHupfer I have tried both with a nested list and without a nested list and I get the same result. Could I show you the source code somewhere? – fma May 06 '17 at 18:50
  • @Francesco: You could send it via the contact form on my website (the link is on my profile page here), but I don't have the altacv class at all –  May 06 '17 at 18:57
  • @ChristianHupfer ok thank you for your availability! – fma May 06 '17 at 19:02