Skip to content

LaTeX: todo directive inserts \label without a proper anchor point (from \phantomsection or a counter stepping) #8807

@jfbu

Description

@jfbu

Describe the bug
Here is an example from make latex on our own docs, one sees in produced sphinx.tex:

\sphinxAtStartPar
\raisebox{-0.5\height}{\sphinxincludegraphics{{more}.png}} See {\hyperref[\detokenize{usage/configuration::doc}]{\sphinxcrossref{\DUrole{doc}{Configuration}}}} for documentation of all available
config values.

\begin{sphinxadmonition}{note}{\label{\detokenize{usage/quickstart:id5}}Todo:}
\sphinxAtStartPar
Move this entire doc to a different section
\end{sphinxadmonition}

However this environment, by default, does not insert an anchor point.

Now, normally this goes completely silent. If the document were to use usage/quickstart:id5 destination name this would link to the section title which also has label usage/quickstart:basic-configuration.

However I hit against this by working on implemeting the feature #6276.

As a work-around I will associate a counter to the sphinxadmonition environment so that it can be increased at each such occurrence and thus generate a suitable anchor point via hyperref services.

This will be a fix to this.

To Reproduce
Steps to reproduce the behavior:

Use todo directive and check latex file from make latex.
Environment info

  • OS: [e.g. Unix/Linux/Mac/Win/other with version]
  • Python version: [e.g. 3.7.1]
  • Sphinx version: 3.4
  • Sphinx extensions: [e.g. sphinx.ext.autodoc, recommonmark]
  • Extra tools: [e.g. Browser, tex or something else]

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions