Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jfbu opened this issue Jan 31, 2021 · 1 comment

Comments

@jfbu
Copy link
Contributor

jfbu commented Jan 31, 2021

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]
@jfbu jfbu added this to the 3.5.0 milestone Jan 31, 2021
jfbu added a commit to jfbu/sphinx that referenced this issue Jan 31, 2021
Allow to link externally to some permanent PDF ids, like this

    http://example.com/doc.pdf#nameddest=my-target

where my-target is chosen label in source (i.e. the document name is not
added as prefix). This allows external linking in a way stable against
renaming of sections or moving documentation from one document to the
other in the same project.

(The "nameddest=" part is even optional in some viewer)

Closes: sphinx-doc#6276
Closes: sphinx-doc#8807
jfbu added a commit to jfbu/sphinx that referenced this issue Feb 1, 2021
Allow to link externally to some permanent PDF ids, like this

    http://example.com/doc.pdf#nameddest=my-target

where my-target is chosen label in source (i.e. the document name is not
added as prefix). This allows external linking in a way stable against
renaming of sections or moving documentation from one document to the
other in the same project.

(The "nameddest=" part is even optional in some viewer)

Closes: sphinx-doc#6276
Closes: sphinx-doc#8807
jfbu added a commit to jfbu/sphinx that referenced this issue Feb 1, 2021
Allow to link externally to some permanent PDF ids, like this

    http://example.com/doc.pdf#nameddest=my-target

where my-target is chosen label in source (i.e. the document name is not
added as prefix). This allows external linking in a way stable against
renaming of sections or moving documentation from one document to the
other in the same project.

(The "nameddest=" part is even optional in some viewer)

Closes: sphinx-doc#6276
Closes: sphinx-doc#8807
jfbu added a commit to jfbu/sphinx that referenced this issue Feb 1, 2021
Allow to link externally to some permanent PDF ids, like this

    http://example.com/doc.pdf#nameddest=my-target

where my-target is chosen label in source (i.e. the document name is not
added as prefix). This allows external linking in a way stable against
renaming of sections or moving documentation from one document to the
other in the same project.

(The "nameddest=" part is even optional in some viewer)

Closes: sphinx-doc#6276
Closes: sphinx-doc#8807
jfbu added a commit to jfbu/sphinx that referenced this issue Feb 1, 2021
Allow to link externally to some permanent PDF ids, like this

    http://example.com/doc.pdf#nameddest=my-target

where my-target is chosen label in source (i.e. the document name is not
added as prefix). This allows external linking in a way stable against
renaming of sections or moving documentation from one document to the
other in the same project.

(The "nameddest=" part is even optional in some viewer)

Closes: sphinx-doc#6276
Closes: sphinx-doc#8807
jfbu added a commit to jfbu/sphinx that referenced this issue Feb 7, 2021
jfbu added a commit to jfbu/sphinx that referenced this issue Feb 7, 2021
…unter"

This reverts commit 16e3a93.

Indeed this may have some after-effect. In current situation, todo
directive issues latex `\label` but no reference anchor is set, so
reference via LaTeX `\ref` will link probably to sectioning unit. With
the reverted commit, the link will be to the notice/admonition but with
some numbered label not appearing otherwise in document.

Anyway, this issue is related to only small extend to the task of
achieving permanent named destinations in PDF.
@jfbu jfbu modified the milestones: 3.5.0, 4.0.0 Feb 7, 2021
jfbu added a commit to jfbu/sphinx that referenced this issue Feb 7, 2021
jfbu added a commit to jfbu/sphinx that referenced this issue Feb 7, 2021
…unter"

This reverts commit 16e3a93.

Indeed this may have some after-effect. In current situation, todo
directive issues latex `\label` but no reference anchor is set, so
reference via LaTeX `\ref` will link probably to sectioning unit. With
the reverted commit, the link will be to the notice/admonition but with
some numbered label not appearing otherwise in document.

Anyway, this issue is related to only small extend to the task of
achieving permanent named destinations in PDF.
@tk0miya tk0miya modified the milestones: 4.0.0, 4.1.0 Apr 19, 2021
@tk0miya tk0miya modified the milestones: 4.1.0, 5.0.0 Jul 10, 2021
@tk0miya tk0miya modified the milestones: 5.0.0, 5.x May 2, 2022
@AA-Turner AA-Turner modified the milestones: 5.x, 6.x Oct 4, 2022
@AA-Turner AA-Turner modified the milestones: 6.x, 7.x Apr 29, 2023
@AA-Turner AA-Turner modified the milestones: 7.x, 8.x Jul 20, 2024
@jfbu jfbu removed this from the 8.x milestone Aug 17, 2024
@jfbu jfbu added this to the 7.4.0 milestone Aug 17, 2024
@jfbu
Copy link
Contributor Author

jfbu commented Aug 17, 2024

This was closed by #12508.

@jfbu jfbu closed this as completed Aug 17, 2024
jfbu added a commit to jfbu/sphinx that referenced this issue Aug 19, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2024
@AA-Turner AA-Turner modified the milestones: 7.4.0, 8.1.0 Oct 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants