1

In my overall document, I have many subequations like:

\documentclass[a4paper]{report}

\usepackage{mleftright}
\usepackage{amsmath}
\usepackage{mathtools}

\begin{document}

These two operators, which in turn map pairs of operators $ \mleft( \hat{A} ; \hat{B} \mright) $ onto another operator, are defined as:
\newline
\begin{subequations}
\begin{minipage}[t]{0.5\textwidth}
    \begin{equation}
    \label{DefComm}
        \mleft[ \hat{A} ; \hat{B} \mright] \coloneqq \hat{A} \hat{B} - \hat{B} \hat{A}
    \end{equation}
\end{minipage}\hfill
\begin{minipage}[t]{0.5\textwidth}
    \begin{equation}
    \label{DefAntiComm}
        \text{and } \{ \hat{A} ; \hat{B} \} \coloneqq \hat{A} \hat{B} + \hat{B} \hat{A} \, ,
    \end{equation}
\end{minipage}
\end{subequations}
\newline
\newline
\newline
respectively.

\end{document}

This working example gives the following output: enter image description here

I would like Latex/tex to do the spacing itself with me only having to specify what parts belong to distinct subequations. Is that possible. As is, I have to manually tweak the size of the minipages and also the intertext doesn't look nice. I'd like the end to be sort of central and equally spaced from the parenthesis (1a) and the next equation. Or whatever your suggestions for how it should look are, but it certainly doesn't look nice as it is.

  • Do you really want \mleft(\hat{A};\hat{B}\mright)? The output is not really pretty compared to (\hat{A};\hat{B}). Just look at your equation 1a and 1b. The latter is good, the former isn't. – egreg Jun 2 at 10:14
1

Here is a proposal that measures the widths of the expressions and allocates the minipage widths accordingly.

\documentclass[a4paper]{report}

\usepackage{mleftright}
\usepackage{xfp}
\usepackage{mathtools}
\newcommand\SideBySideEquations[3][3em]{%
\setbox0\hbox{$\displaystyle#2$}%
\setbox1\hbox{$\displaystyle#3$}%
\par\noindent
\begin{minipage}[t]{\fpeval{(\wd0+#1)/(\wd0+\wd1+#1+#1)}\textwidth}
\begin{equation}
#2\vphantom{#3}
\end{equation}
\end{minipage}%
\begin{minipage}[t]{\fpeval{(\wd1+#1)/(\wd0+\wd1+#1+#1)}\textwidth}
\begin{equation}
#3\vphantom{#2}
\end{equation}
\end{minipage}\vskip\belowdisplayskip\par\noindent
}
\begin{document}



These two operators, which in turn map pairs of operators $ \mleft( \hat{A} ; \hat{B} \mright) $ onto another operator, are defined as
\begin{subequations}
\SideBySideEquations{%
\mleft[ \hat{A} ; \hat{B} \mright] \coloneqq \hat{A}\hat{B} - \hat{B} \hat{A}}{%
\text{and}\quad \{ \hat{A} ; \hat{B} \} \coloneqq \hat{A} \hat{B} + \hat{B} \hat{A}}
\end{subequations}
respectively.

Here is another example,
\begin{subequations}
\SideBySideEquations{%
 \hat{A}}{%
\text{and}\quad \{ \hat{A} ; \hat{B} \} \coloneqq \hat{A} \hat{B} + \hat{B} \hat{A}}
\end{subequations}
and another one
\begin{subequations}
\SideBySideEquations{%
\mleft[ \hat{A} ; \hat{B} \mright] \coloneqq \hat{A}\hat{B} - \hat{B} \hat{A}}{%
\text{and}\quad \hat{A}}
\end{subequations}
and a normal equation
\begin{equation}
 E=\hbar\omega\;.
\end{equation}
\end{document}

enter image description here

Just for the records: I personally would not use such notation, but this is just a personal opinion.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.