In a document I want to do a reference to a specific section of an online documentation. Here is the link:






As you can see there is two #. If don't escape both of them I've got this error:
! Illegal parameter number in definition of \Hy@tempa.

But if I escape both, the part of the link after second one is not taken into account.

How can I make the link works properly?

  • Dpn't show only a snippet. Make a complete example that can be used for tests. – Ulrike Fischer Apr 23 at 9:09
  • @UlrikeFischer done – Phantom Apr 23 at 9:15
  • Hi @Phantom, your working example is successfully compiling without errors for me. (even after i have deleted the escapes. by the way, you may delete them in your MWE so people have the code producing your problem and not containing your hotfix) – lumiemp Apr 23 at 9:22
  • 2
    Oh well. Why do people do this and use such reserved chars? Well hyperref drops the second part somewhere. Add an issue to the github tracker of hyperref. – Ulrike Fischer Apr 23 at 9:49
  • If you link to ...html#graph-nodes instead of ...html#host#graph-nodes you will land on the exact same spot in the documentation. This is also true for every other section or subsection of that page. – lumiemp Apr 23 at 10:15

Try this (hopefully there is nowhere a link with two consecutive hashes)

Addition: while with the patch the "correct" link is in the pdf, the comments suggest that not every pdf viewer is able to handle this. So better look for an alternative link which doesn't use two hashes.

  \catcode`\$=6 %
  \catcode`\#=12 %


| improve this answer | |
  • Doesn't work for me. – egreg Apr 23 at 10:03
  • Works fine for me, thanks – Phantom Apr 23 at 10:03
  • @egreg what do you mean by doesn't work? If I uncompress the pdf (l3pdf + \pdf_uncompress I get the link with both hashes in the pdf URI(https://raytracing-docs.nvidia.com/optix_6_0/guide_6_0/index.html#host#graph-nodes). And in adobe reader the link works. – Ulrike Fischer Apr 23 at 10:06
  • I tried with Skim and Acrobat Reader, both point to incorrect links. Acrobat Reader shows the correct link, but upon clicking it takes me to another page. With Skim I get the %23 notation, but again, this is interpreted incorrectly. – egreg Apr 23 at 10:07
  • @egreg does the link work if you use it directly in your browser? – Ulrike Fischer Apr 23 at 10:58

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.