1

I want to include all DOI's for my references in the same font/size as the rest of the text without them hyperlinked.

This is an example of one of the references (I have multiple) I am having issues with because of the <> in the DOI:

Automatically generated by Mendeley Desktop 1.19.3
Any changes to this file will be lost if it is regenerated by Mendeley.
BibTeX export options can be customized via Options -> BibTeX in Mendeley 
Desktop

@article{Ludwig1996,
author = {Ludwig, Herbert R. Jr. and Leitch, Jay A.},
doi = {10.1577/1548-8446(1996)021<0014:ITOABV>2.0.CO;2},
journal = {Fisheries},
number = {7},
pages = {14--18},
publisher = {Wiley-Blackwell},
title = {{Interbasin transfer of aquatic biota via anglers' Bait Buckets}},
volume = {21},
year = {1996}
}

Based on the suggestions in a similar post Natbib of DOI with bad characters the following code fixes the bad characters, but has hyperlink on DOI. Additionally, it makes the DOI text look different than the rest of the citation text and body text. Here is code based on the suggestion with my reference:

\documentclass[letterpaper,11pt,oneside, notitlepage]{article}% calls document type
\usepackage[utf8]{inputenc}%forces utf-8 encoding
\usepackage{doi}% suppose to force DOI as verbatim
\usepackage[backend=biber,maxbibnames=99, maxcitenames= 2, bibencoding=utf8, 
uniquename=init,giveninits, style=authoryear-comp,isbn=false, url=false, 
dashed=false]{biblatex}
\addbibresource{lib.bib}%specifies bib location
 \begin{document} %starts document
  \raggedright%prevents hyphenation, kick words that make line over full to 
  next line\end{document}
  \section{test}
  \cite{Ludwig1996}% citation with < and >
\printbibliography[]
\end{document}

This is my attempt to remove the hyperlink on the DOI and put DOI in same font/size as rest of the text:

\documentclass[letterpaper,11pt, oneside, notitlepage]{article}% calls document type
\usepackage[utf8]{inputenc}%forces utf-8 encoding
\usepackage{doi}% suppose to force DOI as verbatim
\usepackage[backend=biber,maxbibnames=99, maxcitenames= 2, bibencoding=utf8, 
uniquename=init,giveninits, style=authoryear-comp,isbn=false, url=false, 
dashed=false]{biblatex}
\addbibresource{lib.bib}%specifies bib location
\DeclareFieldFormat{doi}{%
 \mkbibacro{\larger[2]DOI}\addcolon\space{#1}}%makes "DOI" larger and make doi number normal text
 \begin{document} %starts document
  \raggedright%prevents hyphenation, kick words that make line over full to 
  next line\end{document}
  \section{test}
  \cite{Ludwig1996}% citation with < and >
\printbibliography[]
\end{document}

However, this results in the < being turn into an upsidedown ! and the > being turned into an upsidedown ?. I am using biber as my backend because my actual document has some other (non-DOI) formating that uses some flexability related to biber.

Any help is appreciated.

1

Well, you can add

\hypersetup{hidelinks}

to your code to tell hyperref (called in doi) to create no links.

The complete code (see the changed order of calling doi)

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{Ludwig1996,
author = {Ludwig, Herbert R. Jr. and Leitch, Jay A.},
doi = {10.1577/1548-8446(1996)021<0014:ITOABV>2.0.CO;2},
journal = {Fisheries},
number = {7},
pages = {14--18},
publisher = {Wiley-Blackwell},
title = {{Interbasin transfer of aquatic biota via anglers' Bait Buckets}},
volume = {21},
year = {1996}
}
\end{filecontents*}


\documentclass[letterpaper,11pt,oneside, notitlepage]{article}% calls document type

\usepackage[utf8]{inputenc}%forces utf-8 encoding

\usepackage[backend=biber,maxbibnames=99, maxcitenames= 2, bibencoding=utf8, 
uniquename=init,giveninits, style=authoryear-comp,isbn=false, url=false, 
dashed=false]{biblatex}
\addbibresource{\jobname.bib}%specifies bib location

\usepackage{doi}% suppose to force DOI as verbatim
\hypersetup{hidelinks} % <==============================================


 \begin{document} %starts document
  \raggedright%prevents hyphenation, kick words that make line over full to 
  next line
  \section{test}
  \cite{Ludwig1996}% citation with < and >
\printbibliography[]
\end{document}

gives you the result without link for doi:

enter image description here

UPDATE:

With added \urlstyle{same}

you the following MWE

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{Ludwig1996,
author = {Ludwig, Herbert R. Jr. and Leitch, Jay A.},
doi = {10.1577/1548-8446(1996)021<0014:ITOABV>2.0.CO;2},
journal = {Fisheries},
number = {7},
pages = {14--18},
publisher = {Wiley-Blackwell},
title = {{Interbasin transfer of aquatic biota via anglers' Bait Buckets}},
volume = {21},
year = {1996}
}
\end{filecontents*}


\documentclass[letterpaper,11pt,oneside, notitlepage]{article}% calls document type

\usepackage[utf8]{inputenc}%forces utf-8 encoding
\usepackage{hyperref}
\usepackage{url}
\usepackage[backend=biber,maxbibnames=99, maxcitenames= 2, bibencoding=utf8, 
uniquename=init,giveninits, style=authoryear-comp,isbn=false, url=false, 
dashed=false]{biblatex}
\addbibresource{\jobname.bib}%specifies bib location

\usepackage{hyperref}
\usepackage{url}
\usepackage{doi}% suppose to force DOI as verbatim
\hypersetup{hidelinks} % <==============================================
\urlstyle{same} % <=====================================================


 \begin{document} %starts document
  \raggedright%prevents hyphenation, kick words that make line over full to 
  next line
  \section{test}
  \cite{Ludwig1996}% citation with < and >
\printbibliography[]
\end{document}

and the result:

enter image description here

  • This is a start, but the font size and style are different than the rest of the text. Additionally, the link is still there (if you click on it), this just makes it more conspicuous. Optimally the DOI would plain text with correct symbols and correct font formatting. Any recommend fixes? – OliverFishCode Dec 20 '18 at 20:55
  • The hyperlink is fine if the font formatting was the same as the rest of text – OliverFishCode Dec 20 '18 at 21:10
  • 1
    @DevonOliver add \urlstyle{same} to the preambel. Some pdf viewer recognizes the url and show them as link if you want it or not, that I can not change, sorry ... – Mensch Dec 20 '18 at 21: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.