# Why is the height of superscripts different in tikzpicture compared to maths environments?

Consider this minimal example:

Why is the height of the superscript slightly lower in the tikzpicture and how can I get it to look like it does in the equation (or in this case flalign*) environment?

Code

\documentclass{article}
\usepackage{tikz}
\usepackage{mathtools}
\setlength\parindent{0cm}
\begin{document}

\begin{flalign*}
F_i^x &&
\end{flalign*}

\begin{tikzpicture}
\node [inner sep=0pt] at (0,0) {$F_i^x$};
\end{tikzpicture}

\end{document}


Because the first is typeset in display style and the second is in inline style maths. To get the same formatting in the TikZ picture as in the flalign* environment (or any other displayed maths environment), you can use \displaystyle:

\documentclass{article}
\usepackage{tikz}
\usepackage{mathtools}
\setlength\parindent{0cm}
\begin{document}

\begin{flalign*}
F_i^x &&
\end{flalign*}

\begin{tikzpicture}
\node [inner sep=0pt] at (0,0) {$\displaystyle F_i^x$};
\end{tikzpicture}

\end{document}

• +1 Thanks! Is there a way to activate \displaystyle for all $...$ text within a tikzpicture? – Milo Jun 11 '18 at 20:42
• @Milo I think you could do \usepackage{etoolbox}\AtBeginEnvironment{tikzpicture}{\everymath{\displaystyle}}. – Phelype Oleinik Jun 11 '18 at 20:47
• @PhelypeOleinik I recommend \everymath\expandafter{\the\everymath\displaystyle} if doing something at all, else you erase whatever \everymath may contain. – user4686 Jun 12 '18 at 12:49
• @PhelypeOleinik I am biased because my package mathastext uses \everymath/\everydisplay for some tasks :) – user4686 Jun 12 '18 at 13:31