A link to another file can be created using the code

\href{run:/path/to/my/file.ext}{text displayed}

Now I'm use the amsthm package. What I'd like is for the phrase 'Theorem X' to be a link to another file (where the proof is written). Is this achievable?

  • Have you looked into using the xr ("eXternal References) package? – Mico May 19 '13 at 13:01

Yes, it is. Just define a suitable theorem style:


  {}%      Space above, empty = `usual value'
  {}%      Space below
  {\itshape}% Body font
  {}%         Indent amount (empty = no indent, \parindent = para indent)
  {\bfseries}% Thm head font
  {.}%        Punctuation after thm head
  { }%     Space after thm head: " " = normal interword space;
     %     \newline = linebreak
  {\href{run:\thislink}{\thmname{#1} \thmnumber{#2}}\thmnote{ (#3)}}% Thm head spec

\newtheorem{thm}{Theorem}[section] % normal theorems

\newtheorem{innlinkthm}[thm]{Theorem} % theorems with link


This is a normal theorem.

This has a link.

This has the same link.


enter image description here

  • Thank you. I'm actually having difficulty getting the standard \href command to work in general, and this applies to your code. When I click the link, nothing happens. Is this is standard issue? I'm running Linux, Ubuntu. – goblin GONE May 19 '13 at 14:11
  • So just to clarify, I am running your code exactly, and I have put somefile.pdf in the same directory. – goblin GONE May 19 '13 at 14:16
  • @user18921 You may try file: instead of run: – egreg May 19 '13 at 14:26
  • Hmm still not working. Anyway, I don't want to burden you with mere troubleshooting. If I can't solve it on my own, I'll just ask another question. – goblin GONE May 19 '13 at 14:27
  • @user18921 This may depend on the PDF viewer and on OS settings. On Mac OS X it works out of the box. – egreg May 19 '13 at 14:29

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.