I am using apacite with natbib and have all my literature in Mendeley.
I just found how to supress the URL in the bibliography when DOI is present (Linebreak in url). However, I`d like to supress both URL and DOI for all entries, except for web pages - there the URL and the last revised fields should be shown. I am not sure how to change the code from the example above (Linkebreak in url) or how to do that at all - any ideas?
MWE:
\documentclass{article}
\usepackage[natbibapa]{apacite}
\usepackage{etoolbox}
\usepackage{environ}
\newtoggle{bibdoi}
\newtoggle{biburl}
\makeatletter
\undef{\APACrefURL}
\undef{\endAPACrefURL}
\undef{\APACrefDOI}
\undef{\endAPACrefDOI}
\long\def\collect@url#1{\global\def\bib@url{#1}}
\long\def\collect@doi#1{\global\def\bib@doi{#1}}
\newenvironment{APACrefURL}{\global\toggletrue{biburl}\Collect@Body \collect@url}{\unskip\unskip}
\newenvironment{APACrefDOI}{\global\toggletrue{bibdoi}\Collect@Body\collect@doi}{}
\AtBeginEnvironment{thebibliography}{
\pretocmd{\PrintBackRefs}{%
\iftoggle{bibdoi}
{\iftoggle{biburl}{\unskip\unskip}{}}
{\iftoggle{biburl}{\unskip\unskip }{}}
\togglefalse{bibdoi}\togglefalse{biburl}%
}{}{}
}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@misc{PwC2013,
author = {PwC},
mendeley-groups = {Sharing},
title = {{The sharing economy - sizing the revenue opportunity}},
url = {http://www.pwc.co.uk/issues/megatrends/collisions/sharingeconomy/the-sharing-economy-sizing-the-revenue-opportunity.html},
urldate = {2015-10-29},
year = {2013}
}
\end{filecontents*}
\begin{document}
\citet{PwC2013}
\bibliographystyle{apacite}
\bibliography{\jobname}
\end{document}
Wit this code I can get rid of all URLs and DOIs, however, I need them for the web page entries (here misc).
texfile and tries to compile it, I get multiple errors: what is the class, where begins the document? Also, learn to format your code by prefixing it with 4 spaces, so that it is displayed as code block. – Clément Nov 30 '15 at 16:06miscfield only for webpages? Is switching to biblatex an option? – Clément Nov 30 '15 at 16:30s web page field, however, in bibtex it seems to be "transformed" to misc. Biblatex seems to be more complicated, so Id be glad to stick to bibtex. – latexQ Nov 30 '15 at 16:58\makeatother. LaTeX will do this anyway, I think, but it seems inelegant. – cfr Apr 12 '16 at 00:27@wwwand@misc)? I've seen this in many publications, and this would make the problem much more easier to solve! – ebosi Apr 12 '16 at 15:28