[Tex/LaTex] How to omit url, doi, and urldate fields while using the IEEEtran bibliography style

bibtexieeetran

The \bibliographystyle{IEEEtran} in my IEEE Overleaf template produces:

[1] D. C. Knill and A. Pouget, “The Bayesian brain: the role of
uncertainty in neural coding and computation ”Trends in
Neurosciences,vol. 27, no. 12, pp. 712–719, Dec. 2004.
[Online]. Available: http://linkinghub.elsevier.com/retrieve/pii/S0166223604003352

but I want:

[1] D. C. Knill and A. Pouget, “The Bayesian brain: the role of
uncertainty in neural coding and computation,” Trends in
Neurosciences, vol. 27, no. 12, pp. 712–719, Dec. 2004.

How can I get rid of the '[Online]' and 'Available:' strings, as well as of the contents of the url field itself?

I have synced my Zotero library with Overleaf to produce a .bib file.
Entries look as follows:

@article{knill_bayesian_2004,
        title = {The {Bayesian} brain: the role of uncertainty in 
        neural coding and computation},
        volume = {27},
        issn = {01662236},
        shorttitle = {The {Bayesian} brain},
        url =          
       {http://linkinghub.elsevier.com/retrieve/pii/S0166223604003352},
        doi = {10.1016/j.tins.2004.10.007},
        language = {en},
        number = {12},
        urldate = {2018-11-14TZ},
        journal = {Trends in Neurosciences},
        author = {Knill, David C. and Pouget, Alexandre},
        month = dec,
        year = {2004},
        pages = {712--719}
}

I use bibtex to generate the bibliography.

\bibliography{bibtex/bib/references_from_zotero.bib}
\bibliographystyle{IEEEtran}

Does anyone know a better way than to manually remove the url, doi, and urldate from either Zotero or the resulting .bbl file?

I have tried to untick the 'Include URLS of paper articles in references' box Zotero for Mac –> Preferences –> Cite and then resync with Overleaf. This didn't have an effect.

Best Answer

the IEEEtran.bst has an in-built control system.

Add this to your bib:

@IEEEtranBSTCTL{IEEEexample:BSTcontrol,
CTLuse_url = "no",
}

and then compile your document like this (the definition is not needed if you are using a IEEE class):

\documentclass[10pt]{book}
\makeatletter
\def\bstctlcite{\@ifnextchar[{\@bstctlcite}{\@bstctlcite[@auxout]}}
\def\@bstctlcite[#1]#2{%
 \@bsphack
 \@for\@citeb:=#2\do{%
 \edef\@citeb{\expandafter\@firstofone\@citeb}%
 \if@filesw\immediate\write\csname #1\endcsname{\string\citation{\@citeb}}\fi}%
 \@esphack}
\makeatother

\begin{document}
\bstctlcite{IEEEexample:BSTcontrol}
\cite{knill_bayesian_2004}
\bibliographystyle{IEEEtran}
\bibliography{test}

\end{document}

enter image description here

For more info check \IEEEtran_bst_HOWTO.pdf.

Related Question