0

I have noticed inconsistent spacing when using itemized lists in a TikZ node when the tikzpicture is inside a centering environment.

I have the following code:

\documentclass{memoir}
\usepackage{tikz}

\begin{document} \begin{center} \begin{tikzpicture} \node[align=left, text width=5cm] (0,0) { \textbf{Heading 1} \begin{itemize} \item{item 1} \end{itemize} }; \node[align=left, text width=5cm] at (0,2) { \textbf{Heading 2} \begin{itemize} \item{item 2} \end{itemize} }; \end{tikzpicture} \end{center} \end{document}

and I get a result like this:

example 1

However, when I have the nodes in different order like this:

\documentclass{memoir}
\usepackage{tikz}

\begin{document} \begin{center} \begin{tikzpicture} \node[align=left, text width=5cm] at (0,2) { \textbf{Heading 2} \begin{itemize} \item{item 2} \end{itemize} }; \node[align=left, text width=5cm] (0,0) { \textbf{Heading 1} \begin{itemize} \item{item 1} \end{itemize} }; \end{tikzpicture} \end{center} \end{document}

I get this output:

example 2

If I remove the centering environment around the tikzpicture, then both lists are rendered with similar spacing like this:

example 3

Why is this happening? Is this a bug? Is there a way that I can fix this?

I'm using TeX Live 2023 on Linux.

ttsc
  • 371
  • 2
    Don't know, lists inside nodes can be tricky. Loading the enumitem package and adding [itemsep=0pt,partopsep=0pt,topsep=0pt] after each \begin{itemize} like in A160457 seem to overwrite and egalize any weird things that are happening. – Qrrbrbirlbel Sep 24 '23 at 21:06

0 Answers0