# Horizontal space between \items in a list with pictures

Im trying to get something like the picture but Im not able to get the rectangle to the next line and have a horizontal space between the items

\usepackage[inline]{enumitem}
\begin{document}
\begin{enumerate*}[label=(\alph*)]
\item eigth  \addtocounter{enumi}{1}
\begin{tikzpicture}[%
baseline=(current bounding box.north west),
level/.style={sibling distance=10mm/#1},scale =0.5
]

\draw [draw=black] (2,4) rectangle (0,0);

\end{tikzpicture}

\item
\begin{tikzpicture}[%
baseline=(current bounding box.north),
level/.style={sibling distance=10mm/#1},scale =0.5
]

\draw [draw=black] (2,4) rectangle (0,0);

\end{tikzpicture}
\end{enumerate*}
\end{document}

• Do you really need a hammersledge like tikz for that? – Bernard May 13 '20 at 18:27

## 1 Answer

Just make the text a node the baseline of which you make the baseline of the tikzpicture.

\documentclass{article}
\usepackage{tikz}
\usepackage[inline]{enumitem}
\begin{document}
\begin{enumerate*}[label=(\alph*)]
\item  \begin{tikzpicture}[baseline=(X.base)]
\node(X) {eigth};

\draw [draw=black,path picture={
\draw (path picture bounding box.south) --
(path picture bounding box.north);
}] ([yshift=-1ex]X.south west) rectangle ++ (2,-4);

\end{tikzpicture}\addtocounter{enumi}{1}

\item \begin{tikzpicture}[baseline=(X.base)]
\node(X) {eleven};

\draw [draw=black,path picture={
\draw (path picture bounding box.south) --
(path picture bounding box.north);
}] ([yshift=-1ex]X.south west) rectangle ++ (2,-4);

\end{tikzpicture}
\end{enumerate*}
\end{document}


This does not introduce horizontal spacing between the items, but you can add such spacing e.g. by adding \path ([xshift=2em]current bounding box.east); to the tikzpicture.

• It could be easier to add the horizontal spacing using enumitem's itemjoin key in the options of the enumerate environment. – Vincent May 13 '20 at 17:48
• @Vincent Thanks! Yes, this is a good point. I was meaning to say that this does not introduce unwanted additional spacing but you are right, the enumitem methods are more appropriate to obtain consistent spacing. – user194703 May 13 '20 at 17:50
• @JoesphMama It is the ,path picture={ \draw (path picture bounding box.south) -- (path picture bounding box.north); }. This is a trick that adds a vertical line in the middle, which will be in the middle even when you change the dimensions of the rectangle. – user194703 May 13 '20 at 18:37
• @JoesphMama Then you may need a different construction. It depends on which lines (horizontal, vertical, whatever), equally spaced or not, and so on. This post was written to produce something along the lines of the screen shot you posted. – user194703 May 13 '20 at 18:41
• @JoesphMama One example: add \usetikzlibrary{calc} to the preamble and use \draw [draw=black,path picture={ \draw foreach \X in {1,2}{($(path picture bounding box.south west)!\X/3!(path picture bounding box.south east)$) -- ($(path picture bounding box.north west)!\X/3!(path picture bounding box.north east)$)}; }] ([yshift=-1ex]X.south west) rectangle ++ (2,-4);. There are zillions of possibilities, and if one proposes one typically many additional answers pop up suggesting the poster of the first option was unaware of all the other options.... ;-) – user194703 May 13 '20 at 21:05