3

Consider this minimal example:

enter image description here

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}
9

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
  • 4
    @Milo I think you could do \usepackage{etoolbox}\AtBeginEnvironment{tikzpicture}{\everymath{\displaystyle}}. – Phelype Oleinik Jun 11 '18 at 20:47
  • 2
    @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
  • 1
    @PhelypeOleinik I am biased because my package mathastext uses \everymath/\everydisplay for some tasks :) – user4686 Jun 12 '18 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.