I have following code in my tex file.

\\href{DEListComparison/inputFilesForGENE_E/}{link caption} \\

The link in the output pdf file turn out to be *DEListComparison/inputFilesForGENE_E/.pdf*. I got unnecessary .pdf in the link. Is this a bug or I did something stupid? How can it be resolved ?

  • Is DEListComparison/inputFilesForGENE_E/ a complete URL string? If so, try prefixing http:// to the string. If it's something else, please advise. (It would appear that hyperref thinks it's a shortcut to a file, with extension .pdf, located somewhere on your computer.)
    – Mico
    Jan 16, 2014 at 6:45
  • it is a relative url of a directory which is in same root directory as the output pdf file (generated by latex).
    – World
    Jan 16, 2014 at 6:52

1 Answer 1


There is an ambiguity in \href between a file link and an incomplete relative URL without protocol. Package hyperref chooses the former.

The following example provides macro \hrefurl that directly chooses the URL link type:



\hrefurl{DEListComparison/inputFilesForGENE_E/}{link caption}

Now the PDF file contains an URI action for the link:

/A <<
  /Type /Action
  /S /URI

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.