Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using the fleqn option to the amsmath package to position my equations a small fixed distance from the left hand margin, rather than centred. I think it would look better if the equation numbers were slightly indented from the right-hand margin, rather than flush against it as they are by default. So:

How can I control the positioning of the equation numbers? I still want them on the right-hand side, I just want a little space between them and the margin.

Here is a minimal working example to demonstrate the issue:

\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}
share|improve this question
    
Please add a minimal working example (MWE) that illustrates your problem. –  Kurt Sep 28 '12 at 13:56
    
@Kurt ok, done. –  Nathaniel Sep 28 '12 at 15:15

1 Answer 1

up vote 12 down vote accepted

It is commendable that your equations are so short that you do not need the space.

The following is a hack for the equation of LaTeX, followed by some redefinitions for amslatex. I hope I have caught the cases there, e.g. you do not want to have extra space after \eqref. It uses the same internal tag macros.

\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
share|improve this answer
    
This looks pretty good (and it actually works fine with \eqref). I'll leave the question open for a bit in case anyone comes up with a simpler solution - if not I'll accept this answer. –  Nathaniel Sep 28 '12 at 15:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.