I'm using phantom to maintain even spacing between the teacher version and the student version of a document. I have a newcommand that puts text from the teacher version into a phantom in the student version. However, phantom doesn't seem to like the double dollar sign mathmode.
Is there a workaround?
MWE:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
I want this phantom to work:
\phantom{$$\mathit{\dfrac{14}{20} = 0.7 = 70%}$$ }
It works when there's no phantom
$$\mathit{\dfrac{14}{20} = 0.7 = 70%}$$
It works with a single $ around the math:
\phantom{$\mathit{\dfrac{14}{20} = 0.7 = 70%}$ }
bla bla bla
\end{document}

\mathitwrappers? – Mico Jul 14 '23 at 01:18\displaymath, since typically one shouldn't leave a blank line before a math display. – Werner Jul 14 '23 at 01:22\phantomuses a savebox to compute the size needed. In particular, it uses an\hboxtype savebox, and you need a\vboxtype savebox to handle $$ (or { or \begin{equation) etc.) – John Kormylo Jul 14 '23 at 15:43