2

I'm using Tufte document classes, in which citations appear as sidenotes consisting of the full bibliography entry, using (I believe) \bibentry. Many of my bibliography entries contain URLs (and I want them there) but I don't want those URLs to appear in the citations.

Is there a way to omit URLs from such citations but keep them in the bibliography?

Example of citation with unwanted URL


\documentclass[]{tufte-handout}

\begin{document}

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

\bibliographystyle{unsrtnat}
\bibliography{References}

\end{document}

@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},
}
5

This is possible by modifying the bst-file.

Copy the file unsrtnat.bst in your working folder. I recommand to rename the file maybe something like MYunsrtnat.bst. At line 285 of MYunsrtnat.bst you find the definition of the url output.

FUNCTION {format.url}
{ url empty$
    { "" }
    { new.block "URL \url{" url * "}" * }
  if$
}

Change this definition as follow:

FUNCTION {format.url}
{ url empty$
    { "" }
    { new.block "\urlname{URL} \url{" url * "}" * }
  if$
}

After this changing you can use the following example. There commands \urlname and \url gobble their argument. Before the bibliography is printed to commands are set to

\renewcommand*{\urlname}[1]{#1}
\renewcommand*{\url}[1]{\texttt{#1}}

Here the example:

\documentclass[]{tufte-handout}
\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}
\providecommand*{\urlname}[1]{}
\renewcommand*{\url}[1]{}
\begin{document}
This,\cite{Sarukkai:2005} includes the URL for the citation, which I don't want; thought I do want it in the bibliography.

\renewcommand*{\urlname}[1]{#1}
\renewcommand*{\url}[1]{\texttt{#1}}
\bibliographystyle{unsrtnat}
\bibliography{References}

\end{document}

enter image description here

  • Excellent. In the interim I've moved to biblatex. Is there a similar approach I can use there? – orome Mar 4 '12 at 16:52
  • 1
    @raxacoricofallapatorius: Yes. The you have the possiblity DeclareFieldFormat{url}{} – Marco Daniel Mar 4 '12 at 17:00
  • That gets rid of URLs everywhere (as the option url=false would). Is there a way to just exclude them from citations and not the bibliography? – orome Mar 4 '12 at 18:03
  • The same trick. You can also use AtEveryCite. But I think it's a new question ;-) – Marco Daniel Mar 4 '12 at 18:06
  • Agreed. – orome Mar 4 '12 at 18:15

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.