我见过一些帖子接近我需要的,但不完全是我需要的。
我想在同一行生成两个方程,其中一个方程编号向左调整,另一个向右调整。两个方程都应该是多行的。
我想为两个方程标签生成一个 \tag。
因此输出应该类似于下面的代码生成的输出。
\begin{array}{llrr}
& a=b & x=y & \\
(eq1) & c=d & y=z & (eq2) \\
& e=f & u=v
\end{array}
答案1
我提出了这个解决方案,并从这个网站上的@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{equation}
\begin{aligned}
a & =b \\
c & =d \\
e & =f
\end{aligned}
\end{equation}
&
\begin{equation}
\begin{aligned}
x & =y \\
y & =z \\
u & =v
\end{aligned}
\end{equation}
\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}
答案2
像这样:
\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}
附录:我弄清楚了如何使用自己的方程式标签:
\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
\begin{equation}\label{eq:left}
\begin{split}
a & = b \\
c & = d
\end{split}\tag{*}
\end{equation}
\end{minipage}\begin{minipage}{0.5\linewidth}
\begin{equation}\label{eq:right}
\begin{split}
x & = y \\
z & = uvw
\end{split}\tag{**}
\end{equation}
\end{minipage}
\end{center}
\dots, see \eqref{eq:left} and \eqref{eq:right} \dots
\lipsum*[66]
\end{document}
答案3
我不确定这是不是个好主意。
\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}