0

I want to use a \href to link to a specific page in a local PDF file. This works fine, as long as I don't put that \href in a \footnote. Linking to just the PDF file without linking to a specific page also works fine, even in the footnote.


However, once I try to combine the two, or even add a # to the end of the PDF-link, I get the following error message:

! Illegal parameter number in definition of \Hy@tempa.<to be read again>p ...18/Theo/Skript.pdf#page=123}{Herleitung}}

The full line that yields the error looks like this

\footnote{\href{run:C:/Users/Lars/Desktop/Uni/SoSe 18/Theo/Skript.pdf#page=123}{Herleitung}}.

and is within text environment. As far as I understand, \footnote somehow breaks once you use a # somewhere within its arguments, although I'm not sure why.

I would greatly appreciate if anyone has a solution to linking to a specific page in a PDF file within a footnote.


For reference, my desired output looks like this:

This is some text1.

This is more text.

This is the bottom of the page.

===========

1 Herleitung(this word is the link to the pdf file)

1

\href has to change category codes. But this does not work inside the argument of other commands (here: \footnote).

Fix: Instead of #, macro \# can be used:

\footnote{\href{http:www.example.org/foobar.pdf#page=123}{Herleitung}}

A simple GoToR link should be used for local PDF files. The page is specified by the optional argument, e.g.:

\href[page=2]{foobar.pdf}{Herleitung}
  • This runs, but breaks the link. I also tried using {\#} instead of \#, but the problem persists. – L. Kue Jul 15 '18 at 21:04
  • The new suggestion of adding the optional argument now (naturally) restores the link, but the [page=123] has no effect, meaning simply the first page of the pdf is linked. – L. Kue Jul 15 '18 at 21:38
  • @L.Kue Try a different PDF viewer. – Heiko Oberdiek Jul 16 '18 at 0:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.