3

I am writing a paper in LaTeX with BibTeX references. Using the apa6 class and \usepackage{apacite} -- along with my BibDesk references -- I'm able to print references that follow current APA style. However, the APA has recently switched with crossref to using a new doi format -- using https:// doi.org/10.XXXXXX (link intentionally broken here because I can't post the image otherwise) instead of doi: 10.XXXX (which was preferred in the past).

Now, looking at the apacite documentation, it sounds like there's some commands that are written into it -- e.g., using \doi{} to "format the doi string" and using \begin{APACrefDOI} in the .bbl file.

The package also describes a term \doiprefix -- which should presumably solve this issue, right? But I don't seem to be able to safely use it anywhere. Some advice would be appreciated.

A commenter asked for a minimum working example, so that follows:

\documentclass[jou]{apa6}
\usepackage{apacite}
\usepackage{filecontents}

\begin{filecontents}{thebibliography.bib}
@article{examplecite,
    Author = {Author, Example E.},
    Date-Added = {2017-05-08 00:00:00 +0000},
    Date-Modified = {2017-05-08 00:00:00 +0000},
    Doi = {10.XXXX/YYYY},
    Journal = {\LaTeX{} Studies},
    Pages = {1--5},
    Title = {Example Citation with DOI},
    Volume = {1},
    Year = {2017}}
\end{filecontents}

\title{Example}

\begin{document}

\section{Introduction}

Section containing \LaTeX{} citation \cite{examplecite}. 

\bibliographystyle{apacite}
\bibliography{thebibliography}

\end{document}

This creates the following document:

sample document

Everything about that is fine except for the doi, which follows the old standard. Adding the doi.org link into the citation results in "doi: https://" etc.; calling \doiprefix{} anywhere causes an error.

2
  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – Dai Bowen
    May 8, 2017 at 21:58
  • @DaiBowen thanks for the suggestion; I've added an MWE.
    – JDB
    May 8, 2017 at 22:32

1 Answer 1

2

The \doiprefix macro sets the current prefix, this is responsible for printing the "doi: " (the default definition) part in the references, \renewcommand{\doiprefix}{} clears this, the DOI is normally printed as is, however we can customise this by defining the single argument macro \newcommand{\doi}[1]{https://doi.org/#1} which will then "process" the DOI, in this case prepending the https://doi.org component.

\documentclass[jou]{apa6}
\usepackage{apacite}
\usepackage{filecontents}
\begin{filecontents}{thebibliography.bib}
@article{examplecite,
    Author = {Author, Example E.},
    Date-Added = {2017-05-08 00:00:00 +0000},
    Date-Modified = {2017-05-08 00:00:00 +0000},
    Doi = {10.XXXX/YYYY},
    Journal = {\LaTeX{} Studies},
    Pages = {1--5},
    Title = {Example Citation with DOI},
    Volume = {1},
    Year = {2017}}
\end{filecontents}

\renewcommand{\doiprefix}{}
\newcommand{\doi}[1]{https://doi.org/#1}

\begin{document}
\section{Introduction}
Section containing \LaTeX{} citation \cite{examplecite}. 
\bibliographystyle{apacite}
\bibliography{thebibliography}
\end{document}

enter image description here

2
  • 2
    Thanks; the \renewcommand{} and \newcommand{} language is still fuzzy for me. As one addition: I wanted to also set those dois as links, so I enabled the hyperref package and changed the \newcommand{} line to: \newcommand{\doi}[1]{\url{doi.org/#1}} % tell LaTeX to treat DOIs as links
    – JDB
    May 9, 2017 at 17:10
  • @JDB \renewcommand is essentially, set the macro to be this but throw an error if the macro has not previously been defined while \newcommand is set the macro to be this, unless it has already been defined (in which case throw an error), you can try What do newcommand, renewcommand, and providecommand do, and how do they differ? for more explanation. Often if unsure which to use, just try one and if there's an error it'll tell you the command has already or has not already been defined. As for hyperref, yep that's the way to do it.
    – Dai Bowen
    May 9, 2017 at 17:21

You must log in to answer this question.

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