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'd like to move equation labels into the margin for an article I'm working on, and the answers in Theorem Name/Numbering in Margin accomplish exactly what I'm looking for. Here is a small example:

\documentclass{article}

\usepackage{amsmath,amssymb,amsthm}

\makeatletter
\let\mytagform@=\tagform@
\def\tagform@#1{%
    \makebox[1sp][r]{\maketag@@@{(\ignorespaces#1 \unskip \@@italiccorr)}\hspace*{-1in}}%
    }
\renewcommand{\eqref}[1]{\textup{\mytagform@{\ref{#1}}}}
\makeatother

\begin{document}

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.

\begin{equation}
    f(x) = x^2 \label{deepinsight}
\end{equation}

See \ref{deepinsight} for an example.

\end{document}

When I first tried this, however, I used a box a box of zero width: \makebox[0pt][r]{ .... This almost works, but the resulting equation labels aren't vertically aligned with the equation anymore, as you see here:

Misaligned equation label

After fiddling with this some more I realized that the original solution is using \llap which is probably a better way to get this effect, but I am still curious why a box with zero width is aligned differently than a box with some very small width. Thanks for any explanations or pointers!

share|improve this question
add comment

1 Answer

up vote 12 down vote accepted

A zero width equation number is used as a flag to get special handling. Just after describing the detailed rules for equation number placement the TeXBook says:

One consequence of these rules is that you can force an equation number to appear on a line by itself by making its width zero,

share|improve this answer
add comment

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.