控制方程数字的精确位置

控制方程数字的精确位置

我使用包fleqn中的选项amsmath将方程式放置在与左侧边距相距一小段固定距离的位置,而不是居中。我认为如果方程式编号与右侧边距略微缩进,而不是像默认的那样与右侧边距齐平,效果会更好。因此:

我如何控制公式编号的定位?我仍然希望它们位于右侧,我只是希望它们和边距之间留出一点空间。

这是一个最小的工作示例来演示该问题:

\documentclass{article}

\usepackage[fleqn]{amsmath}

\setlength{\mathindent}{0.5\parindent} % just a little bit of indentation for the equations

\begin{document}

% long paragraph so that you can see where the margin is:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
mollit anim id est laborum. Here is an equation:
\begin{equation}
  \label{euler.eqn}
  \exp\left(\frac{i\tau}{2}\right) = -1 \quad.
\end{equation}
Notice that the equation is indented from the left, but the number \eqref{euler.eqn} 
is not indented from the right.

\end{document}

答案1

值得称赞的是,您的方程式非常短,不需要空格。

以下是对equationLaTeX 的 的破解,后面是对 的一些重新定义amslatex。我希望我已经抓住了那里的情况,例如,您不希望 后面有多余的空格\eqref。它使用相同的内部标记宏。

\makeatletter
% Patch for LaTeX:
\g@addto@macro\@eqnnum{\kern\mathindent}
% Patches for amslatex:
\let\org@maketag@@@\maketag@@@
\def\maketag@@@#1{%
  \org@maketag@@@{#1}\kern\mathindent
}
\let\org@eqref\eqref
\def\eqref#1{%
  \begingroup
    \mathindent=\z@
    \org@eqref{#1}%
  \endgroup
}
\makeatother

相关内容