[Tex/LaTex] way to prevent URLs from appearing in \bibentry citations

bibliographiesbibtexnatbibtufte

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

Best Answer

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