0

I have used instructions on biblatex: make title hyperlink to DOIs, URL or ISBN to hyperlink titles of my references to their respective url or doi entries. However, it does not work for @PhdThesis or @thesis, perhaps because url is not even an optional field for this document type in BibTeX. However, it is an optional field for @thesis in biblatex, see p. 12 in http://www.texdoc.net/texmf-dist/doc/latex/biblatex/biblatex.pdf. Is there any easy way to make it work?

2
  • 1
    Welcome to TeX.SE! As usual here please add an compilable short tex code showing how you build your bibliography! please do not forget to add two bib entries to your question ... – Mensch Jan 23 '19 at 8:15
  • 1
    What biblatex style do you use? Whether a given field is used depends on the style. It should be an easy fix, but we need to know the style. – Paul Stanley Jan 23 '19 at 8:44
2

The linked answer to biblatex: make title hyperlink to DOIs, URL or ISBN does indeed not set up links for all entry types. Due to the type-specific formats in biblatex, the

\DeclareFieldFormat{title}{\usebibmacro{string+doiurlisbn}{\mkbibemph{#1}}}
\DeclareFieldFormat[article,incollection]{title}%
    {\usebibmacro{string+doiurlisbn}{\mkbibquote{#1}}}

used there does not change the definitions of inbook and thesis (amongst others). With

\DeclareFieldFormat{title}{%
  \usebibmacro{string+doiurlisbn}{\mkbibemph{#1}}}
\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{\usebibmacro{string+doiurlisbn}{\mkbibquote{#1\isdot}}}
\DeclareFieldFormat
  [suppbook,suppcollection,suppperiodical]
  {title}{\usebibmacro{string+doiurlisbn}{#1}}

we make sure to link all titles. This is a complete copy of the standard definitions of the title field format with \usebibmacro{string+doiurlisbn} sprinkled in. See Remove Quotation Marks from Style for more info on the type-specific formatting and how to modify them properly.

In full

\documentclass{article}

\usepackage[doi=false,url=false,isbn=false]{biblatex}

\usepackage[colorlinks]{hyperref}

\newbibmacro{string+doiurlisbn}[1]{%
  \iffieldundef{doi}{%
    \iffieldundef{url}{%
      \iffieldundef{isbn}{%
        \iffieldundef{issn}{%
          #1%
        }{%
          \href{http://books.google.com/books?vid=ISSN\thefield{issn}}{#1}%
        }%
      }{%
        \href{http://books.google.com/books?vid=ISBN\thefield{isbn}}{#1}%
      }%
    }{%
      \href{\thefield{url}}{#1}%
    }%
  }{%
    \href{http://dx.doi.org/\thefield{doi}}{#1}%
  }%
}


\DeclareFieldFormat{title}{%
  \usebibmacro{string+doiurlisbn}{\mkbibemph{#1}}}
\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{\usebibmacro{string+doiurlisbn}{\mkbibquote{#1\isdot}}}
\DeclareFieldFormat
  [suppbook,suppcollection,suppperiodical]
  {title}{\usebibmacro{string+doiurlisbn}{#1}}

\begin{filecontents}{\jobname.bib}
@phdthesis{elk,
  author      = {Anne Elk},
  year        = {1972},
  title       = {A Theory on Brontosauruses},
  url         = {https://example.edu/~elk/bronto.pdf},
  institution = {Monty University},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\nocite{*}

\begin{document}
\printbibliography
\end{document}

"Anne Elk. “A Theory on Brontosauruses”. PhD thesis. Monty University, 1972." The complete title “A Theory on Brontosauruses” is linked to the URL

1
  • Thank you, this did it! I thought I had tried adding thesis to \DeclareFieldFormat[article,incollection] but did not see an effect. Using your code above works. – Stan Schymanski Jan 24 '19 at 13:44

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.