0

I want to make diagrams similar to the left one below using LaTeX:

What I want to make in latex. What I want to make in latex, with lines added.

This is built up from BSicons on Wikimedia: in this example there are six of these icons below each other, the picture on the right shows the six sub-images with blue boxes. (I don't want the blue boxes, it's for illustration only.)

It almost looks like a list with custom bullets, so I decided to try to make it as a list:

%start.png, pass.png, test.png and finish.png are 30x30 pixel png images in the same folder.

\documentclass{article}
\usepackage{enumitem}
\usepackage{graphicx}
\begin{document}
\begin{itemize}[nosep]
    \item[$\vcenter{\hbox{\includegraphics{start}}}$] Start
    \item[$\vcenter{\hbox{\includegraphics{pass}}}$] Next
    \item[$\vcenter{\hbox{\includegraphics{sprint}}}$] Test
    \item[$\vcenter{\hbox{\includegraphics{pass}}}$] Nothing
    \item[$\vcenter{\hbox{\includegraphics{pass}}}$] Next
    \item[$\vcenter{\hbox{\includegraphics{finish}}}$] End
\end{itemize}
\end{document}

The result (after running pdflatex) is the following:

enter image description here

This is not exactly what I want, there are gaps between the images.

I looked in the enumitem documentation, but could not find the answer there. Is there a way to fix this mwe into what I wanted?

  • I would draw the left image using tikz, using tikzmarks to locate Start, Test and End. OTOH, you could just make \itemsep smaller or negative.. – John Kormylo Jan 24 '19 at 16:44
  • I know enough about tikz to know that it will give a superior result than what I did, but not (yet) enough to do it myself. Thanks for the hint though! – user178854 Jan 24 '19 at 19:25
0

You can use a small negative value for itemsep, but this needs careful choice not to cramp the items together and is not a general solution. As stated by @JohnKormylo, drawing the image using tikz can be better.

\documentclass{article}
\usepackage{enumitem}
\usepackage[demo]{graphicx}
\begin{document}
\begin{itemize}[itemsep=-.5em]
    \item[$\vcenter{\hbox{\includegraphics[height=2em,width=1em]{start}}}$] Start
    \item[$\vcenter{\hbox{\includegraphics[height=2em,width=1em]{pass}}}$] Next
    \item[$\vcenter{\hbox{\includegraphics[height=2em,width=1em]{sprint}}}$] Test
    \item[$\vcenter{\hbox{\includegraphics[height=2em,width=1em]{pass}}}$] Nothing
    \item[$\vcenter{\hbox{\includegraphics[height=2em,width=1em]{pass}}}$] Next
    \item[$\vcenter{\hbox{\includegraphics[height=2em,width=1em]{finish}}}$] End
\end{itemize}
\end{document}

enter image description here

| improve this answer | |
  • I did not think about putting a negative separation... This does what I want! – user178854 Jan 24 '19 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy