# Two equations on the same line

I have seen some posts close to what I need, but not quite what I need.

I would like to produce two equations on the same line with one equation number adjusted to left and one to the right. Both equations should be multiline.

And I want to generate a \tag for both equation labels.

So the output should look like what is produced by the code below.

\begin{array}{llrr}
&    a=b                  &      x=y    &   \\
(eq1) &    c=d                  &      y=z    & (eq2)     \\
&    e=f                 &       u=v
\end{array}

• 1) Welcome. 2) Please provide a so-called MWE: tex.meta.stackexchange.com/questions/228. 3) Maybe you can provide a link to the close posts that you are referring to. 4) At least I have trouble understanding exactly what you want to achieve. Maybe you can draw an example/illustration by hand and provide the picture. 5) I also enjoyed the movie District 9 (assuming you are referring to it with your name) :). – Dr. Manuel Kuehner Dec 29 '18 at 14:00

I propose this solution, with a code borrowed on this site from @DavidCarlisle:

\documentclass{article}
\usepackage[utf8]{inputenc}%
\usepackage{tabularx}
\usepackage{mathtools, nccmath}

\makeatletter
\newcommand{\leqnomode}{\tagsleft@true\let\veqno\@@leqno}%
\newcommand{\reqnomode}{\tagsleft@false\let\veqno\@@eqno}%
\newcommand*{\compress}{\@minipagetrue}
\makeatother

\begin{document}

Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.

{\centering\compress
\begin{tabularx}{\linewidth}{>{\leqnomode}XX}
\begin{aligned} a & =b \\ c & =d \\ e & =f \end{aligned}
&
\begin{aligned} x & =y \\ y & =z \\ u & =v \end{aligned}
\end{tabularx} \vspace{-\baselineskip}}

Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text. Some more text.

\end{document}


Like this:

\documentclass{article}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage{amsmath}

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}

\begin{document}
\lipsum*[66]
\begin{center}
\begin{tabularx}{\linewidth}{@{} lCCr @{}}
\refstepcounter{equation}
(\theequation)\label{eq:left}
&   \begin{aligned} a & = b \\ c & = d \end{aligned}
&   \begin{aligned} x & = y \\ z & = w \end{aligned}
&   \refstepcounter{equation}
(\theequation)\label{eq:right}
\end{tabularx}
\end{center}
\dots, see \eqref{eq:left} and \eqref{eq:right} \dots
\lipsum*[66]
\end{document}


Addendum: I figured out how to use my own tags for equations:

\documentclass{article}

\usepackage{amsmath}
\makeatletter
\newcommand{\leqnomode}{\tagsleft@true}
\newcommand{\reqnomode}{\tagsleft@false}
\makeatother

%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}

\begin{document}
\lipsum*[66]
\begin{center}
\vspace{-\baselineskip}
\begin{minipage}{0.5\linewidth}\leqnomode
$$\label{eq:left} \begin{split} a & = b \\ c & = d \end{split}\tag{*}$$
\end{minipage}\begin{minipage}{0.5\linewidth}
$$\label{eq:right} \begin{split} x & = y \\ z & = uvw \end{split}\tag{**}$$
\end{minipage}
\end{center}
\dots, see \eqref{eq:left} and \eqref{eq:right} \dots
\lipsum*[66]
\end{document}


• +1: So there is no pre-defined environment for this kind of equation layout? – Dr. Manuel Kuehner Dec 29 '18 at 14:48
• Thank you, this works. One more thing I need is: I want to define my own tags, say myeq1" and myeq2" to show up in place of (1) and (2). So far I could not figure out where to insert \tag{myeq1} and \tag{myeq2} without getting an error message from Latex. – district9 Dec 29 '18 at 14:54
• @district9, using \tag{...} command is not possible here. you can insert in place of the \theequation the content of \tag, however, tags is not possible to cite in text. – Zarko Dec 29 '18 at 15:07
• @Zarko: Thank you. Well, in my paper the \tag would be essential, and I would even want to use it with \hypperref. (If I click on an equation number, then I should be taken to the equation). – district9 Dec 29 '18 at 15:21
• @district9, see edited answer. – Zarko Dec 29 '18 at 15:49

I'm not sure it is a good idea.

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\usepackage{lipsum} % for context

\newenvironment{doublynumberedequation}[2]
{%
\unskip
\refstepcounter{equation}\label{#1}%
\refstepcounter{equation}\label{#2}%
\def\secondlabel{#2}%
\begin{equation*}
\begin{tabular*}{\displaywidth}{
@{\extracolsep{\stretch{1}}}
l
>{$\displaystyle}c<{$}
@{\extracolsep{\stretch{2}}}
>{$\displaystyle}c<{$}
@{\extracolsep{\stretch{1}}}
r
@{}
}
\eqref{#1} &
}
{& \eqref{\secondlabel}\end{tabular*}\end{equation*}}

\begin{document}

\lipsum*[4]
\begin{doublynumberedequation}{left}{right}% use two meaningful labels
\begin{aligned}
a&=b \\
c&=d \\
e&=f
\end{aligned}
&
\begin{aligned}
x&=y \\
y&=z \\
u&=v
\end{aligned}
\end{doublynumberedequation}
\lipsum[5]

\end{document}