미니페이지에서 방정식 주위의 세로 간격을 유지하려면 어떻게 해야 합니까?

미니페이지에서 방정식 주위의 세로 간격을 유지하려면 어떻게 해야 합니까?

다음 예:

\documentclass{standalone}

\begin{document}
% outer minipages are not part of the test, and just demonstrate the inconsistency
\begin{minipage}[t]{0.5\textwidth}
    
    This is an equation
    \begin{equation}
        x = 1,
    \end{equation}
    which ends in a comma.
    
\end{minipage}%
\begin{minipage}[t]{0.5\textwidth}
    
    This is a minipage equation\par
    \begin{minipage}[t]{\textwidth}
        \begin{equation}
            x = 1,
        \end{equation}
        \par\nointerlineskip\xdef\tpd{\the\prevdepth}
    \end{minipage}%
    \par\prevdepth\tpd\noindent
    which ends in a comma.
    
\end{minipage}%

\end{document}

물건을 어디서 prevdepth가져오는지https://tex.stackexchange.com/a/34982/41112, 다음과 같이 렌더링됩니다.

산출

미니페이지를 제거하지 않고 오른쪽 열을 왼쪽 열과 일치시키려면 어떻게 해야 합니까? $x=1$ 줄도 아주 약간만 잘못 정렬되어 있습니다.


편집: 이것은 XY 문제인 것으로 밝혀졌으며 위의 질문에 대한 해결책은 실제로 실제 문제에서는 작동하지 않습니다. 그건:

\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}

\begin{document}

This is some text that is long enough to wrap across multiple lines, or at least it ought to be. This gap is too big:\par\nointerlineskip\noindent
\begin{minipage}[t]{.5\textwidth}%
    \begin{subequations}\label{eq:tensor_tensor_tensor_left}%
    \begin{alignat}{2}%
    &
        (M \otimes_{\color{red} R} N) \otimes_{\color{blue} A} (P \otimes_{\color{red} R} Q) \nonumber \\
    \cong_{\color{blue} A} {}&
        ((M \otimes_{\color{red} R} N) \otimes_{\color{blue} A} P) \otimes_{\color{red} R} Q) \label{eq:ttt-left-assoc-1}
    \end{alignat}%
    \end{subequations}%
\end{minipage}%
\begin{minipage}[t]{.5\textwidth}%
    \begin{subequations}\label{eq:tensor_tensor_tensor_right}%
    \begin{alignat}{2}%
    &
        (M \otimes_{\color{red} R} N) \otimes_{\color{blue} A} (P \otimes_{\color{red} R} Q) \nonumber \\
    \cong_{\color{blue} A} {}&
        M \otimes_{\color{red} R} (N \otimes_{\color{blue} A} (P \otimes_{\color{red} R} Q) \label{eq:ttt-right-assoc-1}
    \end{alignat}%
    \end{subequations}%
  \par\xdef\tpd{\the\prevdepth}%
  \vspace*{\belowdisplayskip}\vspace*{-\baselineskip}%
  \end{minipage}\par\prevdepth=\tpd\noindent
and some more unindented text. The gap above is too small. Toegther they add to the right amount.
\begin{alignat}{2}%
&
    (M \otimes_{\color{red} R} N) \otimes_{\color{blue} A} (P \otimes_{\color{red} R} Q) \nonumber \\
\cong_{\color{blue} A} {}&
    M \otimes_{\color{red} R} (N \otimes_{\color{blue} A} (P \otimes_{\color{red} R} Q) \label{eq:ttt-right-assoc-1}
\end{alignat}%
These two gaps are just right, and is a bit bigger than the one above

\end{document}

이는 다음을 제공합니다: 여기에 이미지 설명을 입력하세요

답변1

예제를 수정하겠습니다. 두 번째 외부 미니페이지는 첫 번째 미니페이지와 나란히 효과를 표시하기 위한 것입니다. 두 번째 미니페이지에서는 첫 번째 줄과 방정식이 미니페이지에 있고 그 뒤에 오는 텍스트가 외부에 있습니다.

\documentclass{article}

\begin{document}
% outer minipages are not part of the test, and just demonstrate the inconsistency
\noindent
\begin{minipage}[t]{0.5\textwidth}
  This is an equation
  \begin{equation}
    x = 1,
  \end{equation}
  which ends in a comma.
\end{minipage}%
\begin{minipage}[t]{0.5\textwidth}
  \begin{minipage}[t]{\linewidth}
    This is a minipage equation
        \begin{equation}
            x = 1,
        \end{equation}
  \par\xdef\tpd{\the\prevdepth}%
  \vspace*{\belowdisplayskip}\vspace*{-\baselineskip}
  \end{minipage}\par\prevdepth=\tpd
   which ends in a comma.
\end{minipage}

\end{document}

그러나 방정식 뒤의 건너뛰기가 있을 수 있고 \belowdisplayshortskip이를 확인하려면 다소 복잡한 루틴이 필요할 수 있기 때문에 이는 여러 가지 방법으로 실패할 수 있습니다.

여기에 이미지 설명을 입력하세요


대한진짜문제가 있는 경우 다음 사항에 따라 관리하는 것이 좋습니다.https://tex.stackexchange.com/a/550010/4427

선호 \mathcolor{red}{R}하다 \color{red} R.

\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}

\newcommand{\sidebysidesubequations}[5][0.5]{%
  $$% Yes! We're consciously doing it
  \begin{minipage}{#1\displaywidth}%
  \setlength{\abovedisplayskip}{0pt}%
  \begin{subequations}\label{#2}
  \noindent#3
  \end{subequations}
  \end{minipage}
  \begin{minipage}{\dimeval{\displaywidth-#1\displaywidth}}
  \setlength{\abovedisplayskip}{0pt}%
  \begin{subequations}\label{#4}
  \noindent#5
  \end{subequations}
  \end{minipage}
  $$%
}

\begin{document}

This is some text that is long enough to wrap across multiple lines, or 
at least it ought to be.
\sidebysidesubequations{eq:tensor_tensor_tensor_left}{
  \begin{align}
    & (M \otimes_{\mathcolor{red}{R}} N)
    \otimes_{\mathcolor{blue}{A}}
    (P \otimes_{\mathcolor{red}{R}} Q) \nonumber \\
  \cong_{\mathcolor{blue}{A}} {}&
    M \otimes_{\mathcolor{red}{R}}
    (N \otimes_{\mathcolor{blue}{A}} (P \otimes_{\mathcolor{red}{R}} Q) \label{eq:ttt-left-assoc-1}
 \\
    & (M \otimes_{\mathcolor{red}{R}} N)
    \otimes_{\mathcolor{blue}{A}}
    (P \otimes_{\mathcolor{red}{R}} Q) \nonumber \\
  \cong_{\mathcolor{blue}{A}} {}&
    M \otimes_{\mathcolor{red}{R}}
    (N \otimes_{\mathcolor{blue}{A}} (P \otimes_{\mathcolor{red}{R}} Q) \label{foo1}
  \end{align}
}{eq:tensor_tensor_tensor_right}{
  \begin{align}
    & (M \otimes_{\mathcolor{red}{R}} N)
    \otimes_{\mathcolor{blue}{A}} (P \otimes_{\mathcolor{red}{R}} Q) \nonumber \\
  \cong_{\mathcolor{blue}{A}} {}&
      M \otimes_{\mathcolor{red}{R}}
  (N \otimes_{\mathcolor{blue}{A}} (P \otimes_{\mathcolor{red}{R}} Q) \label{eq:ttt-right-assoc-1}
  \\
    & (M \otimes_{\mathcolor{red}{R}} N)
    \otimes_{\mathcolor{blue}{A}} (P \otimes_{\mathcolor{red}{R}} Q) \nonumber \\
  \cong_{\mathcolor{blue}{A}} {}&
      M \otimes_{\mathcolor{red}{R}}
  (N \otimes_{\mathcolor{blue}{A}} (P \otimes_{\mathcolor{red}{R}} Q) \label{foo2}
  \end{align}
}
and some more unindented text
and some more unindented text
and some more unindented text
and some more unindented text.
\begin{align}
  & (M \otimes_{\mathcolor{red}{R}} N)
    \otimes_{\mathcolor{blue}{A}} (P \otimes_{\mathcolor{red}{R}} Q) \nonumber \\
  \cong_{\mathcolor{blue}{A}} {}&
    M \otimes_{\mathcolor{red}{R}}
    (N \otimes_{\mathcolor{blue}{A}}
    (P \otimes_{\mathcolor{red}{R}} Q) \label{eq:ttt-right-assoc-2}
  \end{align}
These two gaps are just right, and is a bit bigger than the one above

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보