从这些MWE开始进入两个链接
- 如何在一行中放置和编号 3 个简短方程式?(Stefan Kottwitz 的回答) 有这个 MWE:
\documentclass[11pt,a4paper]{scrbook}
\usepackage{amsmath}
\usepackage{tabularx}
\begin{document}
\chapter{Equations}
See equations \eqref{eqn:1}, \eqref{eqn:2} and \eqref{eqn:3}.
\noindent\begin{tabularx}{\textwidth}{@{}XXX@{}}
\begin{equation}
x_{1} = \frac{A-A_{0}}{\frac{1}{2}
\cdot \left( A_{\mathrm{A}} - A_{\mathrm{a}} \right)}
\label{eqn:1}
\end{equation} &
\begin{equation}
x_{2} = \frac{B-B_{0}}{\frac{1}{2}
\cdot \left( B_{\mathrm{A}} - B_{\mathrm{a}} \right)}
\label{eqn:2}
\end{equation} &
\begin{equation}
x_{3} = \frac{C-C_{0}}{\frac{1}{2}
\cdot \left( C_{\mathrm{A}} - C_{\mathrm{a}} \right)}
\label{eqn:3}
\end{equation}
\end{tabularx}
\end{document}
- 我之前的问题列举书中方程式的一个优雅方面(沃纳的回答)我做了一些修改,
\documentclass{book}
\usepackage[top=2.5cm,bottom=2.2cm,
left=3.2cm,right=1.5cm,headsep=10pt,
a4paper]{geometry} %%%%%%%%%%% <--------- added
\usepackage{mathtools,amssymb}
\usepackage[svgnames, dvipsnames, table, x11names]{xcolor}
\usepackage{pifont}
\usepackage{tabularx} %%%%%%%%%%% <--------- added
\definecolor{ocre}{RGB}{243,102,25}
\usepackage{lipsum} %%%%%%%%%%% <--------- added
%----------------------------------------------------------------------------------
% Change number equations with sections
%----------------------------------------------------------------------------------
\usepackage{chngcntr}
\counterwithin{equation}{section}
\renewcommand{\theequation}{\thesection-\arabic{equation}}
\newcommand{\eqnnumsymbol}{\textcolor{ocre}{\reflectbox{\ding{228}}}}
\makeatletter
\newtagform{bbrackets}% <name>
[\textbf]% Internal style
{(}% Left bracket
{\ifnum\pdfstrcmp{\@currenvir}{equation}=0
\eqnnumsymbol%
\else
\ifnum\pdfstrcmp{\@currenvir}{align}=0
\eqnnumsymbol%
\fi
\fi
)}% Right bracket
\makeatother
\usetagform{bbrackets}
\begin{document}
\lipsum[3][1-7]
\begin{tabularx}{\textwidth}{@{}XXX@{}}
\begin{equation}
f(x + y) = f(x) + f(y),
\label{eqn:1}
\end{equation} &
\begin{equation}
f(ax) = af(x),\,
x,y\in V, a\in\mathbb{C}
\label{eqn:2}
\end{equation}
\end{tabularx}
\lipsum[2][1-4]
\end{document}
我们观察到同一行中的枚举超出了边距。请参见(图中红色箭头指向外)。但是,我想要一些这种类型的内容,我已经修改了画为了澄清我的问题:
然而,这种可能的输出必须在两个或多个方程(不同行上有二乘二方程)时才能实现。
请问,有哪些可能的解决方案?
答案1
我提出这个建议(基于我对您上一个问题的解决方案)。请注意,您必须使用 amsmath 环境,即替换equation
为gather
。
\documentclass{book}
\usepackage[top=2.5cm,bottom=2.2cm,
left=3.2cm,right=1.5cm,headsep=10pt,
a4paper]{geometry} %%%%%%%%%%% <--------- added
\usepackage{mathtools,amssymb}
\usepackage[svgnames, dvipsnames, table, x11names]{xcolor}
\usepackage{pifont}
\usepackage{tabularx} %%%%%%%%%%% <--------- added
\definecolor{ocre}{RGB}{243,102,25}
\usepackage{lipsum} %%%%%%%%%%% <--------- added
%----------------------------------------------------------------------------------
% Change number equations with sections
%----------------------------------------------------------------------------------
\usepackage{chngcntr}
\counterwithin{equation}{section}
\renewcommand{\theequation}{\thesection-\arabic{equation}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Added
\makeatletter
\newcommand{\leqnomode}{\tagsleft@true\usetagform{larrowtip}}
\newcommand{\reqnomode}{\tagsleft@false}
\newcommand*{\compress}{\@minipagetrue}
\newcommand*{\depress}{\@minipagefalse}
\makeatother
\usepackage{nccmath}
\usepackage{adforn}
\newtagform{arrowtip}[\bfseries\sffamily]{\bfseries(}{\textmd{)}\,\textcolor{IndianRed3}{\Large\adforn{42}}}
\usetagform{arrowtip}
\newtagform{larrowtip}[\bfseries\sffamily]{\textcolor{IndianRed3}{\Large\adforn{43}}\,(}{)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\lipsum[3][1-7]
{\noindent\begin{tabularx}{\textwidth}{@{}>{\compress\leqnomode}X<{\depress}>{\compress}X <{\depress}@{}}
\begin{gather}
f(x + y) = f(x) + f(y),
\label{eqn:1}
\end{gather} &
\begin{gather}
f(ax) = af(x),\,
x,y\in V, a\in\mathbb{C}
\label{eqn:2}
\end{gather}
\end{tabularx}}
\lipsum[2][1-4]
\begin{gather}
f(x + y) = f(x) + f(y),
\label{eqn:1}
\end{gather}
\leqnomode
\begin{gather}
f(ax) = af(x),\,
x,y\in V, a\in\mathbb{C}
\label{eqn:2}
\end{gather}
\end{document}