Skip to content

Commit

Permalink
fix for #790
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankMittelbach committed Mar 10, 2022
1 parent 673ca1c commit 746696b
Show file tree
Hide file tree
Showing 26 changed files with 166 additions and 2 deletions.
6 changes: 6 additions & 0 deletions base/changes.txt
Expand Up @@ -6,6 +6,12 @@ completeness or accuracy and it contains some references to files that
are not part of the distribution.
================================================================================

2022-03-10 Frank Mittelbach <Frank.Mittelbach@latex-project.org>

* ltbibl.dtx (section{Bibliography Generation}):
Ensure that an empty argument given to \cite generates
a warning (gh/790)

2022-02-28 Phelype Oleinik <phelype.oleinik@latex-project.org>

* ltvers.dtx (subsection{Declaring an all-new module}):
Expand Down
15 changes: 15 additions & 0 deletions base/doc/ltnews35.tex
Expand Up @@ -552,6 +552,21 @@ \subsection{Fix \cs{ShowCommand} when used with \pkg{ltcmd}}



\subsection{Make \cs{cite}\texttt{\textbraceleft\textbraceright} produce a warning}

When the \cs{cite} command can't resolve a citation label it issue a
warning \enquote{Citation `\meta{label}' on page \meta{page}
undefined}. However, due to some implementation details a completely
empty argument was always silently accepted. Given that there are probably
people who write \verb=\cite{}= with the intention to fill in the
correct label later it is rather unfortunate if that is not generating
a warning that something in the document is still amiss.
This has finally been corrected and a warning is now generated also in this case.
%
\githubissue{790}




\section{Changes to packages in the \pkg{amsmath} category}

Expand Down
37 changes: 35 additions & 2 deletions base/ltbibl.dtx
Expand Up @@ -32,7 +32,7 @@
%<*driver>
% \fi
\ProvidesFile{ltbibl.dtx}
[2020/12/10 v1.1s LaTeX Kernel (Bibliography)]
[2022/03/10 v1.1t LaTeX Kernel (Bibliography)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltbibl.dtx}
Expand Down Expand Up @@ -199,8 +199,41 @@
% \begin{macro}{\cite}
% \changes{v1.1j}{1995/10/16}{(DPC) Make robust}
% \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2022/06/01}%
%<latexrelease> {\cite}{check for blank}%
\DeclareRobustCommand\cite{%
\@ifnextchar [{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}}
\@ifnextchar [{\@tempswatrue\@citex@checkblank}{\@tempswafalse\@citex@checkblank[]}}
% \end{macrocode}
% Due to the \css{@for} as used in \cs{@citex} behaves and empty
% argument to \cs{cite} did not produce any Warning for a missing
% citation. So we inject a command before calling \cs{@citex} that
% does the checking for us. It is not done in \cs{@citex} directly,
% because that command is altered by a number of packages/classes
% and this way it is more likely that the check survives.
% \changes{v1.1t}{2022/03/10}{Ensure that an empty argument generates
% a warning (gh/790)}
% \begin{macrocode}
\def\@citex@checkblank[#1]#2{%
\IfBlankTF {#2}%
{\@citex[#1]{\space}}%
{\@citex[#1]{#2}}%
}
%</2ekernel|latexrelease>
% \end{macrocode}
%
% \begin{macrocode}
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease> {\cite}{check for blank}%
%<latexrelease>
%<latexrelease>\DeclareRobustCommand\cite{%
%<latexrelease> \@ifnextchar [{\@tempswatrue\@citex}{\@tempswafalse\@citex[]}}
%<latexrelease>\let\@citex@checkblank\@undefined
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
% \end{macrocode}
% \end{macro}
%
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/github-0479-often.luatex.tlg
Expand Up @@ -539,6 +539,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/github-0479-often.tlg
Expand Up @@ -528,6 +528,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/github-0479-often.xetex.tlg
Expand Up @@ -529,6 +529,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
20 changes: 20 additions & 0 deletions base/testfiles/github-0790.lvt
@@ -0,0 +1,20 @@
\documentclass{article}

\input{test2e}

\START

\SHOWFILE{\jobname.aux}

\OMIT
\begin{document}
\TIMO

\cite{Goodfellow2014a}
\cite{} % this was not detected
\cite{ } % this is

\bibliography{main}
\bibliographystyle{plain}

\end{document}
18 changes: 18 additions & 0 deletions base/testfiles/github-0790.tlg
@@ -0,0 +1,18 @@
This is a generated file for the LaTeX2e validation system.
Don't change this file in any respect.
-------- github-0790.aux (start) ---------
(github-0790.aux) \relax^^M
\citation{Goodfellow2014a}^^M
\citation{}^^M
\citation{}^^M
\bibdata{main}^^M
\bibstyle{plain}^^M
\gdef \@abspage@last{1}^^M
-------- github-0790.aux (end) -----------
LaTeX Warning: Citation `Goodfellow2014a' on page 1 undefined on input line ....
LaTeX Warning: Citation `' on page 1 undefined on input line ....
LaTeX Warning: Citation `' on page 1 undefined on input line ....
No file github-0790.bbl.
[1
] (github-0790.aux)
LaTeX Warning: There were undefined references.
6 changes: 6 additions & 0 deletions base/testfiles/tlb-latexrelease-rollback-003-often.luatex.tlg
Expand Up @@ -457,6 +457,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Skipping: [....-..-..] Make commands robust on input line ....
Expand Down Expand Up @@ -1097,6 +1100,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
6 changes: 6 additions & 0 deletions base/testfiles/tlb-latexrelease-rollback-003-often.tlg
Expand Up @@ -451,6 +451,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Skipping: [....-..-..] Make commands robust on input line ....
Expand Down Expand Up @@ -1081,6 +1084,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
6 changes: 6 additions & 0 deletions base/testfiles/tlb-latexrelease-rollback-003-often.xetex.tlg
Expand Up @@ -451,6 +451,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Skipping: [....-..-..] Make commands robust on input line ....
Expand Down Expand Up @@ -1090,6 +1093,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
Expand Up @@ -539,6 +539,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/tlb-latexrelease-rollback-2020-10-01.tlg
Expand Up @@ -528,6 +528,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/tlb-latexrelease-rollback-2020-10-01.xetex.tlg
Expand Up @@ -529,6 +529,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
Expand Up @@ -540,6 +540,9 @@ Applying: [....-..-..] footnotetext tagging on input line ....
Already applied: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] Add footref on input line ....
Already applied: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Already applied: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/tlb-latexrelease-rollback-2021-06-01.tlg
Expand Up @@ -528,6 +528,9 @@ Applying: [....-..-..] footnotetext tagging on input line ....
Already applied: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] Add footref on input line ....
Already applied: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Already applied: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/tlb-latexrelease-rollback-2021-06-01.xetex.tlg
Expand Up @@ -529,6 +529,9 @@ Applying: [....-..-..] footnotetext tagging on input line ....
Already applied: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] Add footref on input line ....
Already applied: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Already applied: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
Expand Up @@ -540,6 +540,9 @@ Already applied: [....-..-..] footnotetext tagging on input line ....
Already applied: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] Add footref on input line ....
Already applied: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Already applied: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/tlb-latexrelease-rollback-2021-11-15.tlg
Expand Up @@ -528,6 +528,9 @@ Already applied: [....-..-..] footnotetext tagging on input line ....
Already applied: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] Add footref on input line ....
Already applied: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Already applied: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/tlb-latexrelease-rollback-2021-11-15.xetex.tlg
Expand Up @@ -529,6 +529,9 @@ Already applied: [....-..-..] footnotetext tagging on input line ....
Already applied: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] Add footref on input line ....
Already applied: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Already applied: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/tlb-rollback-004-often.luatex.tlg
Expand Up @@ -535,6 +535,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/tlb-rollback-004-often.tlg
Expand Up @@ -523,6 +523,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/tlb-rollback-004-often.xetex.tlg
Expand Up @@ -524,6 +524,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/tlb-rollback-005.luatex.tlg
Expand Up @@ -543,6 +543,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/tlb-rollback-005.tlg
Expand Up @@ -532,6 +532,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down
3 changes: 3 additions & 0 deletions base/testfiles/tlb-rollback-005.xetex.tlg
Expand Up @@ -533,6 +533,9 @@ Skipping: [....-..-..] footnotetext tagging on input line ....
Applying: [....-..-..] footnotetext tagging on input line ....
Skipping: [....-..-..] Add footref on input line ....
Applying: [....-..-..] Add footref on input line ....
Skipping: [....-..-..] check for blank on input line ....
Applying: [....-..-..] check for blank on input line ....
LaTeX Info: Redefining \cite on input line ....
Skipping: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Allow nocite in preamble on input line ....
Applying: [....-..-..] Make commands robust on input line ....
Expand Down

0 comments on commit 746696b

Please sign in to comment.