summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/base/ltbibl.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/base/ltbibl.dtx')
-rw-r--r--Master/texmf-dist/source/latex/base/ltbibl.dtx63
1 files changed, 51 insertions, 12 deletions
diff --git a/Master/texmf-dist/source/latex/base/ltbibl.dtx b/Master/texmf-dist/source/latex/base/ltbibl.dtx
index a3a25308fe8..cda0fa160ad 100644
--- a/Master/texmf-dist/source/latex/base/ltbibl.dtx
+++ b/Master/texmf-dist/source/latex/base/ltbibl.dtx
@@ -1,7 +1,7 @@
% \iffalse meta-comment
%
-% Copyright (C) 1993-2020
-% The LaTeX3 Project and any individual authors listed elsewhere
+% Copyright (C) 1993-2021
+% The LaTeX Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
@@ -32,7 +32,7 @@
%<*driver>
% \fi
\ProvidesFile{ltbibl.dtx}
- [2018/11/09 v1.1r LaTeX Kernel (Bibliography)]
+ [2020/12/10 v1.1s LaTeX Kernel (Bibliography)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltbibl.dtx}
@@ -104,7 +104,7 @@
% but puts nothing in the text.
%
% |\nocite{*}| is special: it tells \BibTeX{} to put the whole of a
-% collection of references into the bibiography.
+% collection of references into the bibliography.
%
% \StopEventually{}
%
@@ -253,7 +253,7 @@
% year citations it becomes more than questionable.
%
% So Chris added yet another hook here, as suggested by, at least,
-% Donald Arsenau. Note that this one is inside the first argument
+% Donald Arseneau. Note that this one is inside the first argument
% of the |\@cite| hook.
% This decouples the top-level typesetting of the citation from
% the details of the other business conducted here. All this really
@@ -327,6 +327,10 @@
% \changes{v1.1g}{1995/05/08}{Use \cs{@firstofone}}
% \changes{v1.1k}{1995/10/20}{Removed refundefined flag}
% \begin{macrocode}
+%</2ekernel>
+%<*2ekernel|latexrelease>
+%<latexrelease>\IncludeInRelease{2021/06/01}%
+%<latexrelease> {\nocite}{Allow nocite in preamble}%
\def\nocite#1{\@bsphack
% \end{macrocode}
% With the implementation designed already in \LaTeX\,2.09 the
@@ -335,10 +339,15 @@
% that point. As a result the ``reference'' will appear on the
% terminal and nothing else will happen.
%
-% This would be easy to fix, but then a document using the fix will
+% [This would be easy to fix, but then a document using the fix will
% silently fail on an older release of \LaTeX{}, missing all
% citations done with |\nocite|. Thus we do only generate an error
-% message and leave the fix for a \LaTeXe{} successor.
+% message and leave the fix for a \LaTeXe{} successor.]
+%
+% Given that we are now a quarter century into using \LaTeXe{}
+% there is no good reason any more do limit ourself to 2.09
+% conciderations. So we now simply delay the \cs{nocide} if it is
+% issued in the preamble.
%
% \changes{v1.1o}{2003/05/18}{Check if we are after \cs{document}}
% \changes{v1.1p}{2004/01/04}{Changed error message}
@@ -354,18 +363,48 @@
\@latex@warning{Citation `\@citeb' undefined}}{}}%
\else
% \end{macrocode}
-% But before |\begin{document}| we raise an error message:
+% But before |\begin{document}| we raised an error message in the
+% past but as of 2021/05 not any longer.
% \begin{macrocode}
- \@latex@error{Cannot be used in preamble}\@eha
+% \@latex@error{Cannot be used in preamble}\@eha
% \end{macrocode}
-% Without the compatibility problems we could fix the problem as follows:
+% Instead we delay the declaration to the start of the document.
+% We have to use a late hook for this, so that it comes after the
+% \texttt{.aux} file is open for writing and after
+% \cs{@preamblecmds} was executed to change the above
+% test. Therefore \cs{AtBeginDocument} would still be too early.
+% \changes{v1.1s}{2020/12/10}{Delay any \cs{nocite} in the preamble
+% instead of raising an error}
% \begin{macrocode}
- % \AtBeginDocument{\nocite{#1}}
+ \AddToHook{begindocument/end}[kernel]{\nocite{#1}}%
\fi
\@esphack}
+%</2ekernel|latexrelease>
+%<latexrelease>\EndIncludeInRelease
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<latexrelease>\IncludeInRelease{0000/00/00}%
+%<latexrelease> {\nocite}{Allow nocite in preamble}%
+%<latexrelease>
+%<latexrelease>\def\nocite#1{\@bsphack
+%<latexrelease> \ifx\@onlypreamble\document
+%<latexrelease> \@for\@citeb:=#1\do{%
+%<latexrelease> \edef\@citeb{\expandafter\@firstofone\@citeb}%
+%<latexrelease> \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
+%<latexrelease> \@ifundefined{b@\@citeb}{\G@refundefinedtrue
+%<latexrelease> \@latex@warning{Citation `\@citeb' undefined}}{}}%
+%<latexrelease> \else
+%<latexrelease> \@latex@error{Cannot be used in preamble}\@eha
+%<latexrelease> \fi
+%<latexrelease> \@esphack}
+%<latexrelease>
+%<latexrelease>\EndIncludeInRelease
+%<*2ekernel>
% \end{macrocode}
+%
% Since |\nocite{*}| should not produce a warning about undefined
-% citation keys (seee PR 557), we need to set the control sequence
+% citation keys (see PR 557), we need to set the control sequence
% `|\b@*|' to something other than |\relax|. As a result |\cite{*}|
% will not warn either (but that never worked with \BibTeX{} in the
% first place).