From 5d34428b6271c1d185c352517a1f6e88f5408444 Mon Sep 17 00:00:00 2001 From: jfbu Date: Sun, 7 Feb 2021 20:18:42 +0100 Subject: [PATCH] Closes: #8807 by letting sphinxadmonition step a counter --- CHANGES | 2 ++ sphinx/texinputs/sphinx.sty | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index 485f161c3ba..aeac956c7a4 100644 --- a/CHANGES +++ b/CHANGES @@ -117,6 +117,8 @@ Bugs fixed * #8780: LaTeX: long words in narrow columns may not be hyphenated * #8788: LaTeX: ``\titleformat`` last argument in sphinx.sty should be bracketed, not braced (and is anyhow not needed) +* #8807: LaTeX: todo directive inserts ``\label`` without a proper anchor point + (from ``\phantomsection`` or a counter stepping) Testing -------- diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 806a0b181da..f4196a9fb2b 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -1686,8 +1686,11 @@ \csname\@backslashchar color@#2\endcsname } % the main dispatch for all types of notices +% work around a problem with todo extension triggering usage of \label +% without a proper anchor set-up via ref-stepping a counter (or \phantomsection) \newcounter{sphinxadmonition} \newenvironment{sphinxadmonition}[2]{% #1=type, #2=heading + \refstepcounter{sphinxadmonition}% in case extension triggers \label usage % can't use #1 directly in definition of end part \def\spx@noticetype {#1}% % set parameters of heavybox/lightbox