If 条件不能在多行环境中使用?

If 条件不能在多行环境中使用?

Incomplete \ifx编译以下 tex 代码时出现错误。

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{multline} % <- Replacing `multline` with `equation` can fix the problem.
  \iftrue
    \begin{aligned} h \end{aligned} % <- Removing `aligned` can fix the problem.
  \fi
\end{multline}
\end{document}

答案1

这可能是分组的问题。如果你将aligned环境括在括号中,代码就会编译:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{multline} % <- Replacing `multline` with `equation` can fix the problem.
  \iftrue {
    \begin{aligned} h \end{aligned} % <- Removing `aligned` can fix the problem.
      }
  \fi
\end{multline}
\end{document}

相关内容