# narrow mode math environment in tikz nodes

I'm looking for a way to enforce a 'narrow' math mode in the following sense:

Instead of writing every where the brackets {+} to reduce the spacing like here

\documentclass[10pt,a4paper]{article}
\usepackage{amsmath,tikz}
\begin{document}
\tikz{\node {$d {+} e {=} f$}; }
\end{document}


I'm looking for a way to set a corresponding node property or something similar.

• the attributes which govern the spacing are part of the font information. one could make changes there, but (out of curiosity) why do you not want the recommended spacing? this is quite unorthodox. – barbara beeton Apr 13 '16 at 16:10
• @barbarabeeton its actually about tikz node labels where the font is quite small and the spacing a bit too large (and I don't want to change or scale the font) – bonanza Apr 13 '16 at 16:15
• put that information in the question -- it's very important -- and add the tag [tikz]. the suggestion i made would not be at all appropriate in that situation. – barbara beeton Apr 13 '16 at 16:22
• See the answer to How to get less spacing in math mode – erik Apr 13 '16 at 16:37
• The example you've given does not involve the situation you described to @barbarabeeton. The maths in the code you've posted is not in a label and the font size is simply the current default. – cfr Apr 13 '16 at 22:53

As described in the answer to How to get less spacing in math mode, you could make this work by setting \thinmuskip, \medmuskip, and \thickmuskip all to zero, and by limiting this spacing to within TikZ nodes using execute at begin node= (although there's probably a less redundant way to do this).

\documentclass[10pt,a4paper]{article}
\usepackage{amsmath,tikz}

\begin{document}
\tikz{\node {$d + e = f$}; } % normal behavior

\tikz{\node {$d {+} e {=} f$}; } % with braces

\tikzset{execute at begin node={\thinmuskip=0mu\medmuskip=0mu\thickmuskip=0mu}}

\tikz{\node {$d + e = f$}; } %compact, without braces

$$d+e=f$$ % normal spacing outside of TikZ nodes
\end{document}
`

• OK. That's helpful. I just meant that the question linked didn't really apply here because in that case, the main issue is really that the code in the question is adding additional space, which isn't so here. And that it is not obvious how to apply that in the TikZ node case, of course. – cfr Apr 14 '16 at 0:21