我想创建一个包含大量公式和大量phantom
空白的完形填空。但最终我需要两个版本,一个有空白,一个没有空白。手动删除所有phantom
不是解决方案。有没有办法在编译时保留所有幻像命令但禁用幻像功能(针对整个文档)?换句话说,有没有办法为不同的编译打开/关闭幻像?
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
L(\lambda, x_1, x_2) &= U (x_1, x_2) - \lambda ( \phantom{p_1 x_1 + p_2 x_2 - m} ) \\
\frac{\partial L}{\partial x_1} &= \frac{ \partial u}{\partial x_1} - \lambda p_1 \stackrel{!}{=} 0 \Rightarrow \phantom { \lambda = \frac{ 1}{p_1} \frac{ \partial u}{\partial x_1} } \tag{I} \\
\frac{\partial L}{\partial x_2} &= \frac{ \partial u}{\partial x_2} - \lambda p_2 \stackrel{!}{=} 0 \Rightarrow \lambda = \frac{ 1}{p_2} \frac{ \partial u}{\partial x_2} \tag{II} \\
\frac{\partial L }{\partial \lambda} &= - p_1 x_1 - p_2 x_2 + m \stackrel{!}{=} 0 \tag{III} \\
\frac{ 1}{p_1} \frac{ \partial u}{\partial x_1} &= \frac{ 1}{p_2} \frac{ \partial u}{\partial x_2} \\
\frac{ \frac{ \partial u}{\partial x_1}}{\frac{ \partial u}{\partial x_2}} &= \phantom { \frac{ p_1}{p_2}}
\end{align*}
\end{document}