5

As mentioned earlier (Customize endnotes), the documentation for the endnotes package doesn't tell you much about how to modify and customize the appearance of endnotes. So I'm calling out to the community for some help.

I'd like my endnotes to look as follows:

  1. The endnote marker should be at the left margin.
  2. The endnote text should be indented throughout (i.e. not just the first line of each endnote).
  3. One line of space (i.e. \baselineskip) between each note.
  4. No text justification (i.e. \raggedright).
  5. I'd like to be able to set the size of the endnote text (e.g. \normalsize).

I get from Gonzalo's answer that I can redefine \enoteformat to accomplish some or all (?) of these things, but playing with this hasn't gotten me anywhere close :(

MWE:

\documentclass{article}
\usepackage{endnotes,lipsum}
    %\renewcommand\enoteformat{} % perhaps doing something here would do the trick?
\begin{document}
\endnote{\lipsum[1]}\endnote{\lipsum[2]}
\theendnotes
\end{document}
Sverre
  • 20,729

1 Answers1

8

The standard definition of \enoteformat is

\def\enoteformat{\rightskip\z@ \leftskip\z@ \parindent=1.8em
  \leavevmode\llap{\makeenmark}}

Taking this as a model, here's what you may want:

\documentclass{article}
\usepackage{endnotes}
\usepackage{lipsum}

\renewcommand{\enotesize}{\normalsize}
\renewcommand\enoteformat{%
  \raggedright
  \leftskip=1.8em
  \makebox[0pt][r]{\theenmark. \rule{0pt}{\dimexpr\ht\strutbox+\baselineskip}}%
}

\begin{document}
\endnote{\lipsum[1]}\endnote{\lipsum[2]}

\theendnotes
\end{document}

enter image description here

The same, but perhaps better and surely easier, with the enotez package:

\documentclass{article}
\usepackage{enotez}
\usepackage{lipsum}

\DeclareInstance{enotez-list}{sverre}{paragraph}
 {
  heading=\section*{#1},
  notes-sep=\baselineskip,
  format=\normalsize\normalfont\raggedright\leftskip1.8em,
  number=\makebox[0pt][r]{#1.\ }\ignorespaces,
 }

\begin{document}
\endnote{\lipsum[1]}\endnote{\lipsum[2]}

\printendnotes[sverre]
\end{document}

If you want the indentation to be as wide as the parindent and the numbers at the left margin, then do

\documentclass{article}
\usepackage{showframe} % just for the example
\usepackage{enotez}
\usepackage{lipsum}

\newlength{\normalparindent}
\AtBeginDocument{\setlength{\normalparindent}{\parindent}}

\DeclareInstance{enotez-list}{sverre}{paragraph}
 {
  heading=\section*{#1},
  notes-sep=\baselineskip,
  format=\normalsize\normalfont\raggedright\leftskip\normalparindent,
  number=\makebox[0pt][r]{\makebox[\normalparindent][l]{#1.}}\ignorespaces,
 }

\begin{document}
Something\endnote{\lipsum[1]} to show the parindent\endnote{\lipsum[2]}

\printendnotes[sverre]
\end{document}

I added showframe just to make sure the specifications are respected

enter image description here

Notes
The parameter \leftskip is the distance from the global left margin to the actual left margin of the text. The \raggedright command sets it to zero, so we override this later, and sets \rightskip to a stretchable space; it also sets \parindent to zero, so I defined \normalparindent to remember its value. You may want to try also \RaggedRight from the ragged2e package that allows for (rare) hyphenation in order to reduce the raggedness. With the double makebox trick we set a zero width box with its contents sticking to its left, containing a box \normalparindent wide, with the contents shoved to the left.

egreg
  • 1,121,712
  • I followed the enotez suggestion. The endnote mark is not at the left margin, though. When it says \leftskip1.8em, what is this 1.8em from? Also, is there a way to set the distance from the margin to the endnote text? I would like this to be the same as \parindent. – Sverre Sep 22 '14 at 14:46
  • @Sverre The format is stored and executed at each paragraph, so I assume em refers to the current font. If you want the number at the left margin, then say number=\makebox[0pt][r]{\makebox[1.8em][l]{#1.}}, but the alignment when you step to two digit numbers will be funny. If you want \parindent, it's slightly more complicated; I'll add it. – egreg Sep 22 '14 at 14:48
  • What I meant was this: \leftskip sets the distance from something to something else. What are these somethings? From playing around with it, it seems as if it sets the distance from the margin to the endnote text? Meaning there is another command that sets the distance from the margin to the endnote mark? – Sverre Sep 22 '14 at 14:52
  • Actually, with number=\makebox[0pt][r]{\makebox[1.8em][l]{#1.}}, the endnote marker bleeds into the margin. – Sverre Sep 22 '14 at 14:58
  • @Sverre Yes, an \ignorespaces was missing, because the package implicitly adds a space between the number and the text. I guess that a key for setting this might qualify for a feature request to the package maintainer. – egreg Sep 22 '14 at 15:00
  • Great, this works. The finer details escape me, nevertheless :). – Sverre Sep 22 '14 at 15:06
  • @Sverre I added some notes. You're better not to have enumerate or itemize in your endnotes. If you do, something different has to be set up. – egreg Sep 22 '14 at 15:28
  • No one should have enumerated or itemized lists in their footnotes or endnotes :) – Sverre Sep 22 '14 at 15:39
  • Long ago but helpful for me in using endnote package. But I would like parbox instead of makebox for having multiple paragraphs in an endnote. I tried enotez package but it gives errors kernel command endnote already defined. – Rob Rutten May 08 '21 at 20:40
  • @RobRutten The \makebox is just to print the note number. Please, open a new question with the details. – egreg May 08 '21 at 20:42
  • @egreg You are fast! But night sleep reminded me that multi-paragraph per command \def needs \long before. I had a \myendnote redefinition forgetting that. Solved. Your \makebox does its job (as many other hints from you in this forum, I now thank Stackexchange in publications). – Rob Rutten May 09 '21 at 08:27
  • @egreg I find that with \long I may also have itemize lists in endnotes. – Rob Rutten May 09 '21 at 09:15