I'm learning some formulas and in order to hide them (=print white) within my pdf-document using fcolorbox. I tried to create some macro, here's my mwe:
\documentclass[a4paper]{scrartcl} \nonstopmode
\usepackage{commath}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{calc}
\usepackage{mathtools}
\usepackage{xcolor}
\newcommand\f[2]{
% \text{#1: } & #2 \\ % works fine
\text{#1: } & \fcolorbox{white}{white}{#2} \\ % won't work
}
\begin{document}
\begin{align*}
\f{Pythagoras}{a^2 + b^2 &=& c^2}
\f{Plank Equation}{E &=& \hbar\,\omega}
\end{align*}
\end{document}
You can see I indicated two lines with comments. Why does the first line produce the expected output, but the second one yields errors? Namely: Missing $ inserted.
Is there a better command to colorize/hide equations? I tried \phantom{} which works fine but only without ampersands…

\fcolorboxsaves the contents in an extra box and so the ampersand is handled as a special token which has to escaped. – Marco Daniel Aug 17 '13 at 06:51\fand "&=&" into " = " on two places, where you use this macro. Then your document compiles. But the equation is not hidden. It is simply printed on white background in a rectangle with white boundary. To hide some content, tryocg-ppackage. – robert.marik.cz Aug 17 '13 at 07:20\newcommand\f[2]{\text{#1: } & \color{white}#2 \\}works as well. – karlkoeller Aug 17 '13 at 07:21ifthenpackage?\ifthenelse{show_equations}{$e=mc^2$}{}– Thruston Aug 17 '13 at 13:11