I'm using apacite package, and I've been trying to suppress the url when the doi is available, following the solution provided by Linebreak in url:






    {\iftoggle{biburl}{\unskip\unskip doi:\bib@doi}{}}
    {\iftoggle{biburl}{Retrieved from\bib@url}{}}



In the references.bib have the following citation:

    title = {Melanoma {skin} {cancer}},
    url = {https://www.cancer.org/cancer/melanoma-skin-cancer},
    urldate = {2018-02-20},
    author = {{American Cancer Society}},
    year = {2018}

I'm facing the same problem pointed out at the end of the thread, which was not answered:

The solution does not seem to work well if the entry urldate (or lastchecked) is defined (and the DOI is not). The reference would show up as Retrieved from [2018-12-20]http://www.example.com

So after using the code provided, I would come to this:


Is there a way to suppress or reformat the urldate?


1 Answer 1


Yes, @pablos' and @Guido's solutions don't account for the optional urldate. To make it work, insert this (the original definition of the APACrefURL environment in apacite.sty):

    \BRetrievedFrom%  Retrieved from
    \BRetrieved{#1}%  Retrieved <date>, from

and replace this line:

{\iftoggle{biburl}{Retrieved from\bib@url}{}}

with this:


I also spotted a bug in the previous solutions, which resulted in not printing the DOI if no URL is available (weird, right?). For this, you simply need to replace this line:

{\iftoggle{biburl}{\unskip\unskip doi:\bib@doi}{}}

with this:

{\unskip\unskip doi:\bib@doi}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .