Wie kann ich den vertikalen Abstand um eine Gleichung auf einer Miniseite beibehalten?

Wie kann ich den vertikalen Abstand um eine Gleichung auf einer Miniseite beibehalten?

Das folgende Beispiel:

\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}

woher das prevdepthZeug kommthttps://tex.stackexchange.com/a/34982/41112, ergibt

Ausgabe

Wie kann ich die Spalte rechts mit der Spalte links in Übereinstimmung bringen, ohne die Miniseite zu entfernen? Beachten Sie, dass die Zeile $x=1$ ebenfalls falsch ausgerichtet ist, wenn auch nur geringfügig.


Bearbeiten: Es stellt sich heraus, dass dies ein XY-Problem ist und die Lösung für meine obige Frage bei einem echten Problem nicht funktioniert. Das heißt:

\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}

Das Ergebnis ist: Bildbeschreibung hier eingeben

Antwort1

Lassen Sie mich Ihr Beispiel ändern, sodass die zweite äußere Miniseite nur dazu dient, den Effekt neben der ersten Miniseite anzuzeigen. Auf der zweiten Miniseite befinden sich die erste Zeile und die Gleichung auf einer Miniseite und der folgende Text außerhalb.

\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}

Dies könnte jedoch auf verschiedene Weise fehlschlagen, da der Sprung nach der Gleichung möglicherweise vorhanden ist \belowdisplayshortskipund eine ziemlich komplexe Routine erforderlich wäre, um ihn festzustellen.

Bildbeschreibung hier eingeben


Über dierealProblem, schlage ich vor, nach dem Vorbild vonhttps://tex.stackexchange.com/a/550010/4427

Bevorzugen .\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}

Bildbeschreibung hier eingeben

verwandte Informationen