Closed xuhdev closed 8 years ago
Thank you for letting me know. I fixed now :-)
Hi guys, it seems the issue still pop up in 1.4. Here is the code
The whole example is in :numref:`doc.opt_server.tutorial_sync_code`.
.. literalinclude:: stripex/test_sync.py
:caption: How to submit a job and solve the problem synchronously.
:name: doc.opt_server.tutorial_sync_code
:language: py
and here is the output
I can not confirm the problem on current stable. With this index.rst
, and numfig = True
in the conf.py
and suitable file in stripex/test_sync.py
:
TEST
====
First Section
-------------
The whole example is in :numref:`doc.opt_server.tutorial_sync_codeA`.
.. literalinclude:: stripex/test_sync.py
:caption: How to submit a job and solve the problem synchronously.
:name: doc.opt_server.tutorial_sync_codeA
:language: py
Second Section
--------------
The whole example is in :numref:`doc.opt_server.tutorial_sync_codeB`.
.. literalinclude:: stripex/test_sync.py
:caption: How to submit a job and solve the problem synchronously.
:name: doc.opt_server.tutorial_sync_codeB
:language: py
The whole example is in :numref:`doc.opt_server.tutorial_sync_codeC`.
.. literalinclude:: stripex/test_sync.py
:caption: How to submit a job and solve the problem synchronously.
:name: doc.opt_server.tutorial_sync_codeC
:language: py
The make latexpdf
produces expected output with correct functional Listing 1.1
, Listing 2.1
and Listing 2.2
links inside the PDF.
I aslo tried in my test file after having cyclically permuted the three :numref:
foo`` and it all works OK in all cases I tested.
Can you try to produce a minimal example with wrong link being produced?
I will take a closer look and try to make a minimal example.
You may have duplicate names doc.opt_server.tutorial_sync_code
but I guess you have excluded that already.
Having a look at the relevant part of the LaTeX file would help:
Listing \ref{foo:doc.opt_server.tutorial_sync_code}
doc.opt_server.tutorial_sync_code
appears which with current stable should look like \def\SphinxLiteralBlockLabel{foo:doc.opt_server.tutorial_sync_code}
.The latter description applies with very recent Sphinx, as the PR #2415 was merged yesterday. Perhaps you are not on latest stable branch ?
Perhaps you use names which differ only in casing? I just observed that ids are transformed to lower case at some point. Thus codeA
and codea
will give same label and this could cause what you observe.
Hi @jfbu , thank you!
I am sure I have no duplicates and I always use lower case names.
In the generated Tex I have
The whole example is in \hyperref[tutorial-sync:doc-opt-server-tutorial-sync-code]{Listing \ref{tutorial-sync:doc-opt-server-tutorial-sync-code}}.
while the literal block contains
\phantomsection\label{tutorial-sync:doc-opt-server-tutorial-sync-code}
I am using the latests version from Pip. actually I run pip every time I build the docs.
This looks good. More recent version will not have the \phantomsection\label{...}
: it is handled differently at the LaTeX side, and more robustly.
Random thoughts:
aux
file and run manually pdflatex
on tex
file enough times.You mentioned somewhere else using extensions like https://github.com/jterrace/sphinxtr/blob/master/extensions/numsec.py
Is it the case in this problem document ?
Thank again. About your random thoughts:
and yes, I use numsec in this project.It is fundamental as titles are way too long and clutter the text. But in my understanding should not affect the tex output.
I think the next step is to wait 1.4.1
Maybe this is same problem as #2414 and it is fixed at 1.4.1.
If you still get the problem after 1.4.1, please open new issue. because I did not notice discussions on closed issue.
I confirm now it works now, great job!
very glad to hear that !
See this generated pdf file. It should refer Fig 1.1 but it refers Fig 1.
You can view a small example here.
Bisecting shows the culprit commit is 279ac7c23fe2f35025514d64c96f839bd518c786
@tk0miya