1

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).

latexQ
  • 221
  • Welcome to tex.stackexchange!. Could you please provide us a minimal example (MWE), that we could compile and work on? – Clément Nov 30 '15 at 15:16
  • If I copy and paste your code in a tex file 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:06
  • Do you use the misc field only for webpages? Is switching to biblatex an option? – Clément Nov 30 '15 at 16:30
  • @Clément, I use Mendeleys 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
  • anyone ideas? I still encounter the problem and cannot figure out how to solve it. – latexQ Apr 08 '16 at 10:14
  • Off-topic: the title should not be in doubled curly brackets. You are adding a lot of spurious-looking spaces to things. You don't have \makeatother. LaTeX will do this anyway, I think, but it seems inelegant. – cfr Apr 12 '16 at 00:27
  • Whould it be ok to generate two bibliographies (one for "regular references", and a second one for @www and @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
  • yes, this would be ok according to the reference guidelines. Do you have a hint of how to separate the bibliographies? Thanks a lot in advance! – latexQ Apr 12 '16 at 16:36
  • I'm sorry my bounty was of no use. As a work-around, I propose to either manually edit Mendeley's file, or to switch to Biblatex (which is not complicated at all, and comes with many benefits). – Clément Apr 17 '16 at 19:53

0 Answers0