[Tex/LaTex] Making URLs non-clickable with hyperref

hyperref

I've been told that I have to make all URLs in the bibliography for this document non-clickable. However, I am using hyperref to do internal linking within the document (c.f. citations).

I looked at the package options for hyperref but couldn't find an option to make URLs non-clickable. Is there a secret hack?

Update 1: Here's an MWE that shows that modifying href seemed not to work.

\documentclass{article}
\usepackage[colorlinks]{hyperref}

\begin{document}

\renewcommand\href[3][\relax]{#3}

Here's a cite:~\cite{ChaudhuriMS:11pperm}.


\bibliographystyle{IEEEtran}
\bibliography{example}
\end{document}

example.bib:

@article{ChaudhuriMS:11pperm,
    Author = {Kamalika Chaudhuri and Claire Monteleoni and Anand Dilip Sarwate},
    Date-Added = {2014-07-15 22:54:03 +0000},
    Date-Modified = {2014-07-15 22:54:03 +0000},
    Journal = {Journal of Machine Learning Research},
    Local-Url = {pdfs/ChaudhuriMS11erm.pdf},
    Month = {March},
    Pages = {1069--1109},
    Title = {Differentially private empirical risk minimization},
    Url = {http://jmlr.csail.mit.edu/papers/v12/chaudhuri11a.html},
    Volume = {12},
    Year = {2011},
    Bdsk-Url-1 = {http://jmlr.csail.mit.edu/papers/v12/chaudhuri11a.html}}

I am getting an warning: Package hyperref Message: Driver (autodetected): hpdftex. Is that undoing the href redefinition? Note I'm using pdflatex on MacOS.

Update 2: Here's a new MWE — it seems that if I put a \newpage before the references, it makes all URLs clickable, and if not, then the fix works… I can hack this in my document but I find this behavior a bit… unexpected? Does \newpage clear some settings?

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{ChaudhuriMS:11pperm,
    Author = {Kamalika Chaudhuri and Claire Monteleoni and Anand Dilip Sarwate},
    Journal = {Journal of Machine Learning Research},
    Month = {March},
    Pages = {1069--1109},
    Title = {Differentially private empirical risk minimization},
    Url = {http://jmlr.csail.mit.edu/papers/v12/chaudhuri11a.html},
    Volume = {12},
    Year = {2011}}
\end{filecontents*}

\usepackage[colorlinks]{hyperref}

\begin{document}

Here is a cite: \cite{ChaudhuriMS:11pperm}.

\newpage % comment to make URL not clickable

\let\url\nolinkurl% Make \url be equivalent to \nolinkurl
\bibliographystyle{IEEEtran}
\bibliography{\jobname}
\end{document}

Update 3: Here's the .bbl file that is produced by TeXShop (perhaps I should return to the command line?). I still get that the link is non-clickable if and only if the \newpage is commented out. The .bbl file is identical whether I comment or don't comment the \newpage command.

% Generated by IEEEtran.bst, version: 1.13 (2008/09/30)
\begin{thebibliography}{1}
\providecommand{\url}[1]{#1}
\csname url@samestyle\endcsname
\providecommand{\newblock}{\relax}
\providecommand{\bibinfo}[2]{#2}
\providecommand{\BIBentrySTDinterwordspacing}{\spaceskip=0pt\relax}
\providecommand{\BIBentryALTinterwordstretchfactor}{4}
\providecommand{\BIBentryALTinterwordspacing}{\spaceskip=\fontdimen2\font plus
\BIBentryALTinterwordstretchfactor\fontdimen3\font minus
  \fontdimen4\font\relax}
\providecommand{\BIBforeignlanguage}[2]{{%
\expandafter\ifx\csname l@#1\endcsname\relax
\typeout{** WARNING: IEEEtran.bst: No hyphenation pattern has been}%
\typeout{** loaded for the language `#1'. Using the pattern for}%
\typeout{** the default language instead.}%
\else
\language=\csname l@#1\endcsname
\fi
#2}}
\providecommand{\BIBdecl}{\relax}
\BIBdecl

\bibitem{ChaudhuriMS:11pperm}
\BIBentryALTinterwordspacing
K.~Chaudhuri, C.~Monteleoni, and A.~D. Sarwate, ``Differentially private
  empirical risk minimization,'' \emph{Journal of Machine Learning Research},
  vol.~12, pp. 1069--1109, March 2011. [Online]. Available:
  \url{http://jmlr.csail.mit.edu/papers/v12/chaudhuri11a.html}
\BIBentrySTDinterwordspacing

\end{the bibliography}

Update 4: This phenomenon seems particular to Apple's Preview PDF reader (the solution given by Werner works great if you view the PDF in Adobe. I still have no idea why \newpage causes this difference, but at least I now have plausible deniability about the URLs. Thanks!

Best Answer

To de-activate the URL capability in the bibliography, set \url to be equivalent to \nolinkurl (also provided by hyperref; see section 4 Additional user macros of the hyperref HTML documentation):

enter image description here

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{ChaudhuriMS:11pperm,
    Author = {Kamalika Chaudhuri and Claire Monteleoni and Anand Dilip Sarwate},
    Date-Added = {2014-07-15 22:54:03 +0000},
    Date-Modified = {2014-07-15 22:54:03 +0000},
    Journal = {Journal of Machine Learning Research},
    Local-Url = {pdfs/ChaudhuriMS11erm.pdf},
    Month = {March},
    Pages = {1069--1109},
    Title = {Differentially private empirical risk minimization},
    Url = {http://jmlr.csail.mit.edu/papers/v12/chaudhuri11a.html},
    Volume = {12},
    Year = {2011},
    Bdsk-Url-1 = {http://jmlr.csail.mit.edu/papers/v12/chaudhuri11a.html}}
\end{filecontents*}

\usepackage[colorlinks]{hyperref}

\begin{document}

Here's a cite:~\cite{ChaudhuriMS:11pperm}.

\let\url\nolinkurl% Make \url be equivalent to \nolinkurl
\bibliographystyle{IEEEtran}
\bibliography{\jobname}
\end{document}
Related Question