diff options
author | Karl Berry <karl@freefriends.org> | 2020-01-04 22:04:59 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-01-04 22:04:59 +0000 |
commit | 1f187c0abf4a96c77c0a52e933793d4ce6cc0098 (patch) | |
tree | b892fee1ec23bbf153919802dec44557cd3579f6 /Master/texmf-dist/tex/latex/endnotes | |
parent | 40fc7787788cdfcaccef2c17d47de2f8cc68643d (diff) |
endnotes (4jan20)
git-svn-id: svn://tug.org/texlive/trunk@53319 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/endnotes')
-rw-r--r-- | Master/texmf-dist/tex/latex/endnotes/endnotes.sty | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/latex/endnotes/endnotes.sty b/Master/texmf-dist/tex/latex/endnotes/endnotes.sty index d3ef6514baa..7d428d167d2 100644 --- a/Master/texmf-dist/tex/latex/endnotes/endnotes.sty +++ b/Master/texmf-dist/tex/latex/endnotes/endnotes.sty @@ -4,9 +4,10 @@ % * ENDNOTES * % **************************************** % -% Date of this version: 15 January 2003. +% Date of this version: 02 January 2020. % %% Copyright 2002 John Lavagnino +%% Copyright 2019-2020 LaTeX3 Project %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.2 @@ -114,6 +115,11 @@ % Frank's updates. % % +% Jürgen Spitzmüller 2019-08-17: just warn if \verb|\theendnotes| is +% used, but noendnotes have been inserted yet. +% +% Jürgen Spitzmüller 2020-01-02: ensure .ent file is cleared. +% % **************************************** % * ENDNOTE COMMANDS * % **************************************** @@ -254,6 +260,8 @@ % **************************************** % +\ProvidesPackage{endnotes}[2020-01-02 endnotes package] + \@definecounter{endnote} \def\theendnote{\@arabic\c@endnote} @@ -283,6 +291,7 @@ \newwrite\@enotes \newif\if@enotesopen \global\@enotesopenfalse +\newif\if@haveenotes \global\@haveenotesfalse \def\@openenotes{\immediate\openout\@enotes=\jobname.ent\relax \global\@enotesopentrue} @@ -296,6 +305,7 @@ % of the lines wind up being quite short. \long\def\@endnotetext#1{% + \global\@haveenotestrue \if@enotesopen \else \@openenotes \fi \immediate\write\@enotes{\@doanenote{\@theenmark}}% \begingroup @@ -309,6 +319,7 @@ % have, requiring the use of \protect for fragile commands. \long\def\addtoendnotes#1{% + \global\@haveenotestrue \if@enotesopen \else \@openenotes \fi \begingroup \newlinechar='40 @@ -316,6 +327,16 @@ \immediate\write\@enotes{#1}% \endgroup} +% Check at document end if endnotes have been inserted; +% if not, assure the *.ent file is cleared if it exists. +\AtEndDocument{% + \if@haveenotes\else + \IfFileExists{\jobname.ent}{ + \if@enotesopen\else\@openenotes\fi + \addtoendnotes{}}{} + \fi +} + % End of unique endnote code \def\endnotemark{% @@ -411,7 +432,9 @@ \def\@endanenote{\par\endgroup}% \enoteheading \enotesize - \input{\jobname.ent}% + \InputIfFileExists{\jobname.ent}{}{% + \PackageWarning{endnotes}{No endnotes found (file \jobname.ent does not exist)\MessageBreak} + }% \endgroup} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |