1

I use \showlabels to keep track of labels of theorems, sections and displaced equations. It works for the first two, but for displaced equations it fails from second page and on. Here is a minimal working example:

\documentclass[12pt,letterpaper]{amsart}
\usepackage{showlabels}

\begin{document}

\begin{equation}
  (a+b)^2 = a^2 + 2ab + b^2  \label{sum}    
\end{equation}

\newpage

\begin{equation}
  (a-b)^2 = a^2 - 2ab + b^2   \label{diff}    
\end{equation}

\end{document}

In this minimal example, \showlabels works for the first equation but not the second. If I remove \newpage then it works in both cases.

In the actual document, in between the equations I have many paragraphs (and equations). To produce a minimal example I removed them and replaced them with \newpage (it took me a long time to identify the issue!).

I tried \showeyes and it works (in this example and in the original document), but I prefer \showlabels.

Many thanks!

4
  • 1
    I added \documentclass{article} and compiled and see both labels. Commented Apr 13, 2020 at 15:08
  • Thanks. I did include the \documentclass line but it got mixed up with the "```" so it didn't appear. I just fixed that. Thanks for pointing this out. @Ulrike's comment is interesting: If I use \documentclass{article} then indeed it works, but if I use \documentclass{amsart} (as is in the original example) then it does not! I do need to use amsart; what are my recourse?
    – underflow
    Commented Apr 13, 2020 at 15:23
  • 1
    Seems it works on odd pages but not even pages. Commented Apr 13, 2020 at 15:25
  • you could put it down as +1 to showkeys in the 30 year old battle between those packages:-) Commented Apr 13, 2020 at 15:37

1 Answer 1

1

showlabels prints the label outside the page. You can try to reset the command (I choose the 60pt by trial and error):

\documentclass[12pt,letterpaper]{amsart}
\usepackage{showlabels}
\makeatletter\def\SL@eqnlefttext #1{\hbox to 0pt{\kern 60pt %or something else
\llap{\SL@margintext{#1}\quad}\hss}}
\makeatother
\begin{document}

\begin{equation}
  (a+b)^2 = a^2 + 2ab + b^2  \label{sum}
\end{equation}

\newpage

\begin{equation}
  (a-b)^2 = a^2 - 2ab + b^2   \label{diff}
\end{equation}

\end{document}
4
  • It works. THANKS! Follow-up question: To where should I report this bug --- \showlabels or \amsart?
    – underflow
    Commented Apr 13, 2020 at 17:24
  • It sounds like this is the usual even/odd-page problem: LaTeX decides which margin to put the note in, left or right, before the page break, so this can be wrong near the tops of pages. As noted in the documentation (p3), fixing this would potentially be fragile, and seems overkill for a draft-only package; using the [inline] option (which Ulrike may have just reinvented!) is a possible workaround. Down, David Carlisle! Down! Commented Apr 14, 2020 at 12:07
  • @NormanGray no, this is a not about asynchronous page breaking. There is an explicit \newpage here and the code knows exactly on which page it is. The problem is that your code assumes that the position of the tag is on the right and moves it then too much to the left (by -\columnwidth) Commented Apr 14, 2020 at 12:10
  • Ah, you're right – thanks. Then this is indeed a showlabels problem. There's currently quite a lot of special-casing for ams* packages: it looks like I've missed a case. It's on the list (though that list will be moving somewhere else before long, since I'm moving away from bitbucket). Commented Apr 14, 2020 at 12:34

You must log in to answer this question.

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