2

I use showlabel to keep track of equation labelling AND section labelling. For various reasons I need the labels to be within the margin of the text, not outside of it. Depending on which showlabel parameters I use I can keep either the equation labelling or the section labelling to be within the margin, but not both. Here is a minimal working example:

\documentclass[12pt,letterpaper]{amsart}
\usepackage[inline]{showlabels}
\begin{document}
\section{First Section}
\label{sec:first}
\begin{equation}
  x^2 + y^2 = z^2
  \label{pythagorean}
\end{equation}
\end{document}

With this setting the section label is within the text margin, but not the equation label. If I change the showlabel command to

\usepackage[right]{showlabels}

then the equation label is within the margin, but not the section label. I have tried e.g.

\usepackage[right,inline]{showlabels}

but latex only seems to accept for the first option. What do I need to do to achieve both settings? THANKS!!

0

1 Answer 1

1

It's an old issue that showlabels does not really like left-aligned equation numbers; its documentation states

[...] this package [...] won’t work with the leqno option either (at some point it should be modified to at least recognise and warn of the conflict in either case, though it’s not obvious to me how to do that).

and leqno is the default for amsart.

I have a hack but I must admit that I haven't really tested it thoroughly, so no guarantees.

\documentclass[12pt]{amsart}

\usepackage[inline]{showlabels}
\makeatletter
\def\SL@eqntext#1{\rlap{\quad\SL@margintext{#1}}}
% alternative:
% \def\SL@eqntext#1{\rlap{\quad{\showlabelsetlabel{\SL@prlabelname{#1}}}}}
\makeatother

\begin{document}
\section{First Section}
\label{sec:first}
To show the margins just some text text text text text text text text
text text text text text text text text
\begin{equation}
  x^2 + y^2 = z^2
  \label{pythagorean}
\end{equation}
\end{document}

enter image description here

If you use the commented line you'll avoid the braces around the label (and the annoying warning about undefined font).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .