1

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.

bonanza
  • 2,141
  • 2
  • 26
  • 37
  • 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
  • 1
  • 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
  • @erik Yes, but that doesn't apply in this case, does it? – cfr Apr 13 '16 at 22:55
  • @cfr It seemed to work when I tried it. Please see my answer. – erik Apr 13 '16 at 23:38
  • @cfr to the best of my knowledge, a label of a tikz node is only another node with text in it. So in the end, it comes down to the example above, doesn't it? – bonanza Apr 14 '16 at 08:00
  • @bonanza Only if you don't mind defining the skips for each node. You could do that, but using execute at begin node is much better, I think. That answer says how to change the spacing for a document but what's needed here as shown below is a way to adapt that so that it only affects the spacing within TikZ nodes. – cfr Apr 14 '16 at 15:00

1 Answers1

2

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}

enter image description here

erik
  • 12,673
  • 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 00:21