The package doi renders \doi{10.1000/182} as doi:10.1000/182, where 10.1000/182 is a boxed or colored hyperlink.

Can the hyperlink also include the doi: part? Omitting that is as peculiar as omitting the http:// from a conventional hyperlink. This also violates the DOI standard, which says that standard IETF guidelines for URI representations apply.

\bibitem{bogus} Smith, J. ``Title,'' in J. Bogosity 42(7). \doi{10.1000/182}

I'm using pdflatex on Ubuntu 14 (pdfTeX 3.1415926-2.5-1.40.14), and doi.sty 2007/07/24 from Ubuntu package texlive-latex-extra. That file, doi.sty, is short enough to expect an answer that modifies that file.

  • Hi! This would use a minimal working example. Also, you probably link the wrong page, there's no mention on which part should be hyperlinked, as far as I see.
    – yo'
    Nov 4, 2015 at 18:49
  • Welcome to TeX.SE. Please state which bibliography style you employ. Please also post a specific example of a bibliographic entry that features a doi field.
    – Mico
    Nov 4, 2015 at 18:49
  • I've added a MWE, bib style, and bib entry, and linked to better standards. Nov 4, 2015 at 22:42

2 Answers 2


While you can use \doitext to modify what is displayed before the doi, it will never be within the hyperlink. To simulate doi.sty (without using it), you can do the following:





%% this is the actual command which processes the argument, with the catcodes 
%% set in the previous command
%% it closes the group, and spits out the url.
  \edef\textless{\@percentchar3C}% instead of {\string<} for Apple
  \edef\textgreater{\@percentchar3E}% instead of {\sting>} for Apple
  \edef\x{\endgroup\the\toks1 {\doitext\the\toks0}}%


The only thing I changed is that I grouped \doitext with \the\toks0. The macro \the\toks1, which comes before, contains the \href command, which then applies to the whole group.

You might want to contact one of the maintainers to ask them to make this an option in future versions of doi.sty.

  • To contact the maintainers, packages.ubuntu.com/trusty/texlive-latex-extra demands an Ubuntu One account. I'll get around to that later. Nov 4, 2015 at 23:14
  • FYI, making that one-line change in doi.sty itself works too, but only on computers using that tweaked file (not, for instance, on arxiv.org). Nov 4, 2015 at 23:34
  • 1
    @CamilleGoudeseune -- Contacting the maintainers that way is not likely to help: they strictly rely on TeX Live for their packages. Of course, the repackaging for Debian can lag behind the most current TeX Live release. So, currently, my version of doi.sty matches yours, but if the package updates, the Debian repositories will not use a more recent version until they update their whole repackaging of TeX Live. For reference, compare my version of pdfTeX: pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015).
    – jon
    Nov 5, 2015 at 0:30

You can use the \doitext command to modify what is displayed. You may need to use something like: \renewcommand*{\doitext}[1]{doi: #1} See http://anorien.csc.warwick.ac.uk/mirrors/CTAN/macros/latex/contrib/doipubmed/doc/doipubmed.pdf for more details.

  • 1
    You should mention in your answer that doipubmed.sty is another package. The OP is using doi.sty, which, incidentally, also has a command \doitext that has no argument.
    – jarauh
    Nov 4, 2015 at 19:19
  • 1
    This renewcommand causes no errors, but neither does it change the output. Should I replace doi.sty with package doipubmed.sty? (Sorry, I still don't have the MWE ready.) Nov 4, 2015 at 19:19
  • When I change the MWE from {doi} to {doipubmed}, the hyperlink vanishes. Mwah mwah. Ubuntu's current doipubmed.sty is 2007/08/20 1.01 (NLCT). Nov 4, 2015 at 22:52
  • Maybe doipubmed does not automatically include hyperref? It's hyperref that's responsible for links, and doi pulls in hyperref. So try usepackage{hyperref,doipubmed}.
    – jarauh
    Nov 6, 2015 at 0:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .