同一行上两个编号方程的奇怪对齐行为

同一行上两个编号方程的奇怪对齐行为

考虑到我之前在这个链接上的问题一个或多个方程(不同行上的两个两个方程),左侧有一个枚举,右侧有一个枚举,我发现两个编号方程在同一行上存在奇怪的对齐行为。换句话说,(0.0-3) 和 (0.0-4) 方程之间有一个悬垂部分。

如何纠正这个问题?

这是 MWE 和相关输出:

\documentclass{book}
\usepackage[top=2.5cm,bottom=2.2cm,
            left=3.2cm,right=1.5cm,headsep=10pt,
            a4paper]{geometry}  
\usepackage{mathtools,amssymb}
\usepackage[svgnames, dvipsnames, table, x11names]{xcolor}
\usepackage{pifont}
\usepackage{tabularx} 
\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[5][2-3]

\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[6][8-9]

\begin{tabularx}{\textwidth}{@{}XXX@{}}
\begin{equation}
\overline{E}= -\overline \nabla \varphi-\frac{\partial \overline{A}}{\partial t}
\label{eqn:3}
\end{equation} &
\begin{equation}
\overline{B}=\overline \nabla \times\overline{A}
\label{eqn:4}
\end{equation}
\end{tabularx}
\end{document}

输出:

在此处输入图片描述

答案1

我并不指望它们能对齐,因为它们的大小不同,但是如果你使用m而不是p列,你可以更接近一点。我tabular在这里使用的并tabularx没有真正帮助,因为你事先知道XX会有两列相等,所以你也可以直接指定。

在此处输入图片描述

\documentclass{book}
\usepackage[top=2.5cm,bottom=2.2cm,
            left=3.2cm,right=1.5cm,headsep=10pt,
            a4paper]{geometry}  
\usepackage{mathtools,amssymb}
\usepackage[svgnames, dvipsnames, table, x11names]{xcolor}
\usepackage{pifont}
\usepackage{tabularx} 
\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[5][2-3]

\noindent
\begin{tabular}{@{}*{2}{m{.5\textwidth}@{}}}
\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{tabular}

\lipsum[6][8-9]

\noindent
\begin{tabular}{@{}*{2}{m{.5\textwidth}@{}}}
\begin{equation}
\overline{E}= -\overline \nabla \varphi-\frac{\partial \overline{A}}{\partial t}
\label{eqn:3}
\end{equation} &
\begin{equation}
\overline{B}=\overline \nabla \times\overline{A}
\label{eqn:4}
\end{equation}
\end{tabular}
\end{document}

答案2

非常感谢@David Carlisle 和@Marijn,通过你们的评论,我有了另一种可能性:

在此处输入图片描述

\documentclass{book}
\usepackage[top=2.5cm,bottom=2.2cm,
            left=3.2cm,right=1.5cm,headsep=10pt,
            a4paper]{geometry}  
\usepackage{mathtools,amssymb}
\usepackage[svgnames, dvipsnames, table, x11names]{xcolor}
\usepackage{pifont}
\usepackage{tabularx} 
\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[5][2-3]

\begin{tabularx}{\textwidth}{@{}XX@{}}
\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[6][8-9]

\begin{tabularx}{\textwidth}{@{}XX@{}}
\begin{equation}
\overline{E}= -\overline \nabla \varphi-\frac{\partial \overline{A}}{\partial t}
\label{eqn:3}
\end{equation} &
\begin{equation}
\overline{B}=\overline \nabla \times\overline{A}\vphantom{-\frac{\partial \overline{A}}{\partial t}}
\label{eqn:4}
\end{equation}
\end{tabularx}
\end{document}

相关内容