1

I use a lot of tikz diagrams in my equations, but I've noticed the spacing around them is weirdly inconsistent. This probably isn't a tikz issue but using tikz diagrams makes it particularly noticeable.

My question is both "how can I change this" and "should I change this?" The spacing looks weird to me but maybe there are good reasons for it that I don't know about.

Consider the following MWE:

\documentclass{article}
\usepackage{tikz}
\begin{document}

A diagram: \begin{equation} \begin{tikzpicture}[baseline=(current bounding box.center)] \node[draw]{foo}; \end{tikzpicture} \end{equation}

Another diagram, in another equation: \begin{equation} \begin{tikzpicture}[baseline=(current bounding box.center)] \node[draw]{foo}; \end{tikzpicture} \end{equation}

Yet another diagram, in yet another equation: \begin{equation} \begin{tikzpicture}[baseline=(current bounding box.center)] \node[draw]{foo}; \end{tikzpicture} \end{equation}

\end{document}

Here is its output:

enter image description here

There is noticeably more space after equation 2 than there is after equation 1. I think this is because the text "A diagram:" is shorter than the text "Another diagram, in another eqution:", because if I make them the same then the spacing becomes the same. So I expect that this behaviour is by design.

However, somehow when the equations contain diagrams like this it tends to look a bit odd. So I'm wondering if there is a sensible way to change this behaviour, or whether it's something I should just put up with and leave alone.

N. Virgo
  • 4,289
  • 2
  • 26
  • 41

0 Answers0