5

I'd like to customize verbose biblatex citations to exclude URLs (and DOIs) while keeping them in the bibliography. Is there a simple way to accomplish this?

While I'm at it, I'd like to get rid of the "In: " that the verbose styles use (in both the bibliography and citations), and put the URLs and DOIs on separate lines in the bibliography.

  • 1
    Just want to mention that your add-on questions have already been addressed. lockstep gives a really nice intro to customizing styles here. – Audrey Mar 4 '12 at 23:33
9

I answer in order to all your questions

  1. Fields in biblatex can be deleted by the command \clearfield/\clearlist (you can consult the biblatex documentation to find out whether a field is a field or a list, refer to §2.2.2 Data Fields, pp. 15-24). To influence only cite commands you can use the command \AtEveryCitekey.

    \AtEveryCitekey{%
      \clearfield{url}%
      \clearfield{urlyear}
      \clearfield{doi}%
     }
    

    Instead you can also use AtEveryBibitem for the bibliography.

  2. The word "in" can be removed by redefining the macro in: as follows:

     \renewbibmacro*{in:}{} 
    
  3. Extra line breaks can be done by expanding the relevant field formats.

     \DeclareFieldFormat{url}{\newline\mkbibacro{URL}\addcolon\space\url{#1}}
     \DeclareFieldFormat{doi}{\newline%
       \mkbibacro{DOI}\addcolon\space
       \ifhyperref
         {\href{http://dx.doi.org/#1}{\nolinkurl{#1}}}
         {\nolinkurl{#1}}}
    

Every definition can be found in the file biblatex.def.

Here the complete code:

\documentclass[]{article}
\usepackage{filecontents}
\begin{filecontents}{References.bib}
@article{Sarukkai:2005,
author = {Sarukkai, S},
title = {Revisiting the 'unreasonable effectiveness' of mathematics},
journal = {Current science},
year = {2005},
url = {http://www.ias.ac.in/currsci/feb102005/415.pdf},
}
\end{filecontents}
\usepackage[style=verbose]{biblatex}
\addbibresource{References.bib}
\AtEveryCitekey{%
  \clearfield{url}%
  \clearfield{urlyear}
  \clearfield{doi}%
}
\DeclareFieldFormat{url}{\newline\mkbibacro{URL}\addcolon\space\url{#1}}
\DeclareFieldFormat{doi}{\newline%
  \mkbibacro{DOI}\addcolon\space
  \ifhyperref
    {\href{http://dx.doi.org/#1}{\nolinkurl{#1}}}
    {\nolinkurl{#1}}}

\renewbibmacro*{in:}{} 

\begin{document}
This, \fullcite{Sarukkai:2005} includes the URL for the citation, which I don't want; thought I do want it in the bibliography.


\printbibliography
\end{document}

enter image description here

  • Brilliant. This works perfectly, with one glitch. I'm using this code inside of a \newcommand{mycommand} definition with arguments, so the #1 is being substituted with the first argument to mycommand, is there a way to avoid that? – orome Mar 4 '12 at 18:43
  • 3
    @raxacoricofallapatorius: Use ##1 for this argument – Marco Daniel Mar 4 '12 at 18:55
  • 1
    Nowadays it is better to use \clearfield instead of making the field format empty. Making the field format empty will let biblatex think it printed the field, when it didn't potentially messing up the punctuation tracker. If I recall correctly, the \clearfield commands need to go into \AtEveryCitekey and not \AtEveryCite, but that should be no hindrance. – moewe Sep 1 '15 at 6:55
  • @moewe: You can edit my post. – Marco Daniel Sep 5 '15 at 10:02
  • Thank you very much. I have switched to using \clearfield. If you compare the new output to the old one you will notice that the new one does not feature a full stop at the end. – moewe Sep 5 '15 at 12:45

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.