여러 줄 환경에서는 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}

관련 정보