{"action":"created","issue":{"url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2405","repository_url":"https://api.github.com/repos/sphinx-doc/sphinx","labels_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2405/labels{/name}","comments_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2405/comments","events_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2405/events","html_url":"https://github.com/sphinx-doc/sphinx/issues/2405","id":144577095,"number":2405,"title":"numref link in PDF jumps to the wrong location","user":{"login":"andreacassioli","id":6704112,"avatar_url":"https://avatars.githubusercontent.com/u/6704112?v=3","gravatar_id":"","url":"https://api.github.com/users/andreacassioli","html_url":"https://github.com/andreacassioli","followers_url":"https://api.github.com/users/andreacassioli/followers","following_url":"https://api.github.com/users/andreacassioli/following{/other_user}","gists_url":"https://api.github.com/users/andreacassioli/gists{/gist_id}","starred_url":"https://api.github.com/users/andreacassioli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreacassioli/subscriptions","organizations_url":"https://api.github.com/users/andreacassioli/orgs","repos_url":"https://api.github.com/users/andreacassioli/repos","events_url":"https://api.github.com/users/andreacassioli/events{/privacy}","received_events_url":"https://api.github.com/users/andreacassioli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-03-30T12:43:54Z","updated_at":"2016-04-03T20:17:42Z","closed_at":null,"body":"Hi, \r\nI use numref to generate links to code listing. For instance I have\r\n\r\n```\r\n :numref:`toolbox.code_sdo1` demonstrates how to solve this problem.\r\n\r\n\r\n   .. literalinclude:: stripex/sdo1.m\r\n      :name: toolbox.code_sdo1\r\n      :caption: Code implementing problem :eq:`tutorial_sdo1`.\r\n      \r\n```\r\n\r\n\r\nThe listing is quite long and occupies 2 and half pdf pages. The link I get seems correct, but if I click I jump to the end of the listing instead the beginning, where even the caption is. This is not right! \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/comments/205047314","html_url":"https://github.com/sphinx-doc/sphinx/issues/2405#issuecomment-205047314","issue_url":"https://api.github.com/repos/sphinx-doc/sphinx/issues/2405","id":205047314,"user":{"login":"jfbu","id":2589111,"avatar_url":"https://avatars.githubusercontent.com/u/2589111?v=3","gravatar_id":"","url":"https://api.github.com/users/jfbu","html_url":"https://github.com/jfbu","followers_url":"https://api.github.com/users/jfbu/followers","following_url":"https://api.github.com/users/jfbu/following{/other_user}","gists_url":"https://api.github.com/users/jfbu/gists{/gist_id}","starred_url":"https://api.github.com/users/jfbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfbu/subscriptions","organizations_url":"https://api.github.com/users/jfbu/orgs","repos_url":"https://api.github.com/users/jfbu/repos","events_url":"https://api.github.com/users/jfbu/events{/privacy}","received_events_url":"https://api.github.com/users/jfbu/received_events","type":"User","site_admin":false},"created_at":"2016-04-03T20:17:42Z","updated_at":"2016-04-03T20:17:42Z","body":"Also, when testing a ``numref:`foo``` in the situation with no caption, I do get a Sphinx warning on `make latex`. \r\n\r\n```\r\nprocessing testnumref.tex... index \r\nresolving references...\r\n/xxxxxxxxxx/2405numref/index.rst:1: WARNING: undefined label: foo\r\nwriting... done\r\ncopying TeX support files...\r\ndone\r\nbuild succeeded, 1 warning.\r\n```\r\n\r\nTested on stable branch. My fix in https://github.com/jfbu/sphinx/tree/jumptorightplace-onstable has no impact on this, it is about making sure, when `:caption:` is made use of, that `numref` will generate not only correct link but also correct numbering of literal block for the link text in PDF."}}