3

The endnotes package interferes with headers text, but only if the document has an odd number of pages. Here is a minimal working example:


\documentclass{amsart}

\usepackage{endnotes}

\begin{document}

\title{My Title}

\author{My Name}

\maketitle

\thispagestyle{empty}

First page

\endnotetext{first note}

\newpage

Second page

\endnotetext{second note}

\newpage

Third page

\endnotetext{third note}

\theendnotes

\end{document}


On the last page where the end notes are printed, the header becomes "Notes" instead of "My Title". If however I remove the third page (or add a 4th one) then the header shows the author name (as it should be).

I believe that this is related to Endnotes and headers

I tried the two fixes there: \addtoendnotes{\protect\markboth{Note}{Note}} makes no difference and \def\notesname={\relax} crashes latex (unless I put it near the top of the file, in which case it makes no difference).

Many thanks for your help!

cgnieder
  • 66,645
underflow
  • 559

1 Answers1

2

\theendnotes adds a mark when it executes the \enoteheading command which does the job of printing the header with \notesname. Without any other hook, the simple thing to do would be to redefine \enoteheading as follows:

\renewcommand{\enoteheading}{\section*{\notesname}%
  \mbox{}\par\vskip-\baselineskip}

Incidentally, your command \def\notesname={\relax} is actually defining \notesname with a template requiring = to follow it. The = doesn't belong there. In general, it's better to stick with the LaTeX commands for defining/redefining commands than to drop down to the plain TeX \def.

Don Hosek
  • 14,078
  • Redefining \enoteheading as explained by @DanHosek solved the problem. – underflow Dec 21 '20 at 19:48
  • 1
    For amsart I'd recommend also removing \mbox{}\par\vskip-\baselineskip, which is useless as the class does indent the first paragraph after a title. Actually the package should do \@afterindenttrue instead of that concoction. – egreg Dec 21 '20 at 22:44
  • @egreg I'm flying blind at the moment since my laptop had to go back in for repairs so I don't have a working TeX system at the moment. I was going for minimal changes without paying attention to what stuff was doing. – Don Hosek Dec 21 '20 at 22:56
  • @egreg endnotes.sty registers in it's changelog that the suggestion to use \mbox{}\par\vskip-\baselineskip was by FMi. So I got curious, how would \@afterindenttrue be used here, just set it? Would it be as general or more general than the \mbox{}\par\vskip-\baselineskip? – gusbrs Apr 05 '22 at 13:23
  • @gusbrs In general, I would prefer \@afterindenttrue over the \mbox incantation (yuopu would just replace the whole last line (except the closing brace) with \@afterindenttrue. There are some edge cases where it might make a difference (e.g.., with a subsection immediately following a section), but that shouldn't apply here as near as I can tell from inspecting the source of endnotes.sty. Not sure why Frank chose that particular approach. – Don Hosek Apr 05 '22 at 16:40
  • @DonHosek Thank you! Indeed, I've put some thought to it in the meantime and I also agree that \@afterindenttrue is a better approach. I'm actually working with another end notes package, but the situation is analogous, but slightly different. In the actual case, the whole end notes are grouped, so I can set locally exactly what indentfirst does, before any sectioning commands (which should catch an eventual \chapter too). It looks gook so far, let's hope I don't find any of the edge cases you mention. :-) – gusbrs Apr 05 '22 at 17:26