하위 방정식을 사용할 때 방정식 번호 매기기가 수식과 겹칩니다.

하위 방정식을 사용할 때 방정식 번호 매기기가 수식과 겹칩니다.

amsmath를 사용하여 LaTeX에서 멋지게 보이는 최적화 문제를 만들려고 합니다. MWE는 다음과 같습니다.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{subequations}
\begin{alignat}{2}
    \text{maximize} \quad & \rlap{some looooooooooooooong objective function of $x,u$ } \\
    \text{with} \quad & \text{constraint 1} \quad & k=0,\ldots N{-}1 \\
    & \text{constraint 2} & k=0,\ldots N{-}1
\end{alignat}
\end{subequations}
\end{document}

MWE의 출력

\rlap'k=0...'이 수직으로 정렬되어야 하고 목적 함수에 정렬 문자를 도입하고 싶지 않기 때문에 이 필요합니다 .

보시다시피, 방정식 번호 1a는 첫 번째 줄의 공식과 겹칩니다. 이를 방지할 수 있는 깨끗한 방법이 있나요?

답변1

나는 이것이 두 제약 조건의 크기가 동일한지 여부와 무관한 솔루션이라고 생각합니다.

\begin{subequations}
\begin{alignat}{3}
    \text{maximize} \quad & \text{some looooooo}&&\text{oooooooong objective function of $x,u$} \\
    \text{with} \quad & \text{constraint 1} && k=0,\ldots N{-}1 \\
    & \text{constraint 2} && k=0,\ldots N{-}1
\end{alignat}
\end{subequations}

출력:

산출

답변2

다음은 사용하지 않는 또 다른 옵션입니다.\rlap다음은 를 사용하지 않고 길이만큼 작동하는제약 1는 다음과 같습니다제약 2.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{subequations}
  \begin{alignat}{2}
    \text{maximize} \quad & \text{some looooooooooooooong objective function of $x,u$} \\
    \text{with} \quad & \text{constraint 1} \quad k=0,\ldots N{-}1 \\
    & \text{constraint 2} \quad k=0,\ldots N{-}1
  \end{alignat}
\end{subequations}

\end{document}

출력은 다음과 같습니다.

최종 출력

관련 정보