4

In my document, I need to increase \spaceskip in order to inject more space between words to make them more readable. However, the setting does not seem to apply to text that's inside a TikZ node:

\documentclass{article}
\usepackage{tikz}

\spaceskip 2ex

\begin{document}
  \noindent
  a b c\\
  \tikz{%
    \node [inner sep=0, outer sep=0] {%
      a b c%
    };
  }%
\end{document}

enter image description here

How can I get my customized word-spacing to work even inside TikZ nodes?

1 Answer 1

9

At the beginning of each tikzpicture, TikZ selects nullfont and sets \spaceskip to zero. Then, in each node content, TikZ resets \spaceskip to .3333em.

Here is a solution:

\documentclass{article}
\usepackage{tikz}
\spaceskip 2ex
\tikzset{every node/.style={execute at begin node={\spaceskip 2ex}}}
\begin{document}
  \noindent
  a b c\\
  \tikz{%
    \node [inner sep=0, outer sep=0] {%
      a b c%
    };
  }%
\end{document}
3
  • Ingenious! Can't believe it was that simple. =)
    – gablin
    Commented Nov 21, 2014 at 16:59
  • Mmm… still it would be nice to know why is that necessary.
    – Manuel
    Commented Nov 21, 2014 at 20:45
  • @Manuel I edited my answer. Commented Nov 22, 2014 at 7:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .