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

Hyperlinks to footnotes bring to first page #3361

Closed
davtorgh opened this issue Jan 18, 2017 · 8 comments
Closed

Hyperlinks to footnotes bring to first page #3361

davtorgh opened this issue Jan 18, 2017 · 8 comments

Comments

@davtorgh
Copy link

davtorgh commented Jan 18, 2017

I'm using Pandoc 1.19.1 with MiKTeX-pdfTeX 2.9.6000 and default latex template. Hyperlinks to footnotes bring to first page of the document instead of to the real footnote. Is this a known issue @jgm?
I use pdfTeX directly to typeset other document and hyperlinks to footnotes work well.

Thanks.

@ickc
Copy link
Contributor

ickc commented Jan 22, 2017

I think you should give us a complete recipe for the problem. e.g. source code, pandoc command used, tex output (and point out what's wrong and what's expected).

Also, try to come up with a minimum working example. And if possible, produce the .tex without the -s option.

@jgm
Copy link
Owner

jgm commented Jan 22, 2017

Yes, we can't proceed without an example. I have not noticed this issue in the past.

@davtorgh
Copy link
Author

Ok, here's what i discovered with pandoc markdown manual downloaded from http://pandoc.org/demo/MANUAL.txt

First run with xelatex

pandoc --latex-engine=xelatex manual.txt -o manual-xelatex.pdf

If you click on a hyperlinked note (see manual-xelatex.pdf in the attached zip file), nothing seems to happen.


Second run with pdftex, after removing some final text that contains annoying charachters for pdftex

pandoc manual.txt -o manual-pdftex.pdf

If you click on a hyperlinked note (see manual-pdftex.pdf in the attached zip file), you find yourself on the first page of the document in a 'full page view'.


Then I got the latex version of the document

pandoc -s manual.txt -o manual-pdftex.tex

and removed all the text to get a MWE for the footnotes (see pdftex-no.tex and pdftex-no.pdf in the attached zip file). I suppose the problem comes from the following latex code in the preamble

\usepackage{fancyvrb}
\VerbatimFootnotes % allows verbatim text in footnotes

that goes in conflicts with hyperref. After removing these lines of code from the preamble (see pdftex-ok.tex and pdftex-ok.pdf in the attached zip file) the hyperlinked footnotes work fine. @jgm and @ickc, what do you think about?

Thanks

files.zip

@jgm
Copy link
Owner

jgm commented Jan 23, 2017 via email

@ickc
Copy link
Contributor

ickc commented Jan 23, 2017

By simply changing the order between the loading of the 2 packages, we still have warnings but the hyperlink is there:

pdftex-test.pdf

pdftex-test.tex

Because

The hyperref documentation says: "Make sure it comes last of your loaded packages". The reason is that it redefines many LaTeX commands. It's a rule of thumb that helps to avoid errors. From Which packages should be loaded after hyperref instead of before? - TeX - LaTeX Stack Exchange

ickc added a commit to ickc/pandoc-templates-legacy that referenced this issue Jan 23, 2017
ickc added a commit to ickc/pandoc-templates-legacy that referenced this issue Jan 23, 2017
@davtorgh
Copy link
Author

By simply moving the following code

\usepackage{fancyvrb}
\VerbatimFootnotes

before hyperref my MWE gets compiled, but latex gives error when compiling, for example, the whole manual file. I think the correct sequence is:

\usepackage{fancyvrb}
\usepackage[unicode=true]{hyperref}
\hypersetup{
            pdftitle={Pandoc User's Guide},
            pdfauthor={John MacFarlane},
            pdfborder={0 0 0},
            breaklinks=true}
\urlstyle{same}
\VerbatimFootnotes

This works for pdftex and xelatex. I tested with the manual file, maybe some other test could be useful. @jgm, @ickc, if you confirm this is the solution, can you update default template in pandoc packages for the various platforms?

Thanks.

@ickc
Copy link
Contributor

ickc commented Jan 24, 2017

I'll test it tomorrow. Meanwhile, jgm/pandoc-templates#238 should be on hold.

@jgm jgm closed this as completed in 207b3f7 Jan 24, 2017
@jgm
Copy link
Owner

jgm commented Jan 24, 2017

Seems to work in my tests. I've updated the templates, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants