5

I am writing my thesis with LaTeX. I'm citing the used references with apacite. All in all it worked all perfectly. However I'm facing one problem:

In the bibliography I always have space between the volume and the number of an article.

So it looks like this:

Mustermann, M. (2013). Title of the article. Journal of the article, 4 (2), 28-35.

It, however, should look like this:

Mustermann, M. (2013). Title of the article. Journal of the article, 4(2), 28-35.

Here is my TeX file:

    \documentclass[a4paper,11pt]{article}

    \usepackage{fullpage}
    \usepackage[ngerman]{babel}
    \usepackage{apacite}


    \begin{document}


    \section{First Chapter}

    Any Text which is cited \cite{test}.     


        \bibliographystyle{apacite}
    \bibliography{apa}

\end{document}

And the related file is this:

@article{test,
  title={{Title of the article}},
  author={Mustermann, Max},
  journal={Journal of the article},
  volume={4},
  number={2},
  pages={28--35},
  year={2013}
}

I know it's not much, but my professor criticized it and I want to change it. I read, that I need to alter the .bst-File of apacite, but I have no idea in which way.

Ludovic C.
  • 8,888
chris
  • 325
  • 3
  • 11

3 Answers3

5

Fortunately, you do not even have to modify any .bst files, the relevant macro can be found in apacite.sty.

Add the following code to your preamble.

\makeatletter
\AtBeginDocument{%
  \renewcommand{\APACjournalVolNumPages}[4]{%
    \Bem{#1}%             journal
    \ifx\@empty#2\@empty
    \else
      \unskip, \Bem{#2}%  volume
    \fi
    \ifx\@empty#3\@empty
    \else
      \unskip({#3})%      issue number
    \fi
    \ifx\@empty#4\@empty
    \else
      \unskip, {#4}%      pages
    \fi
  }
}
\makeatother

It is an exact copy of the \APACjournalVolNumPages from apacite.sty but for some reason the code does not work properly when executed by apacite.sty, it needs to be hooked in via \AtBeginDocument{...}.

The MWE

\documentclass[a4paper,11pt]{article}
\usepackage[ngerman]{babel}
\usepackage{apacite}

\begin{filecontents}{\jobname.bib}
@article{test,
  title={{Title of the article}},
  author={Mustermann, Max},
  journal={Journal of the article},
  volume={4},
  number={2},
  pages={28--35},
  year={2013}
}
\end{filecontents}

\makeatletter
\AtBeginDocument{%
  \renewcommand{\APACjournalVolNumPages}[4]{%
    \Bem{#1}%             journal
    \ifx\@empty#2\@empty
    \else
      \unskip, \Bem{#2}%  volume
    \fi
    \ifx\@empty#3\@empty
    \else
      \unskip({#3})%      issue number
    \fi
    \ifx\@empty#4\@empty
    \else
      \unskip, {#4}%      pages
    \fi
  }
}
\makeatother

\begin{document}
Any Text which is cited \cite{test}.

\bibliographystyle{apacite}
\bibliography{\jobname}
\end{document}

yields enter image description here

without a space.

moewe
  • 175,683
  • 1
    \AtBeginDocument{% \makeatletter needs to be \makeatletter\AtBeginDocument{% catcode changes do nothing in a macro argument. As written \ifx\@empty... compares \@ with e so all the tests are false. – David Carlisle Oct 15 '13 at 17:43
  • @DavidCarlisle Oh, thank you very much for pointing that out. Can you explain why hooking an exact copy of the macro from apacite.sty into \AtBeginDocument{ makes the macro works as expected? – moewe Oct 15 '13 at 17:57
  • 1
    You restore the original definition overwriting the one from apacite/german.apc – David Carlisle Oct 15 '13 at 20:02
  • @DavidCarlisle Ahh, thank you! Good to know. – moewe Oct 15 '13 at 20:06
  • I have the same problem, only I'm using a different document type and preamble (pasted below). I tried the MWE code above, and I got an error that reads: ! LaTeX Error: \APACjournalVolNumPages undefined. Here's my preamble- I assume that the problem is that I'm calling a different package and/or class. Can anyone point me toward a way to modify the MWE code provided above for my situation? \documentclass[12pt,letterpaper,keeplastbox,man,donotrepeattitle,floatsintext]{apa6} \usepackage[style=apa,natbib=true,backend=biber]{biblatex} – Chris Apr 20 '17 at 02:35
  • @Chris This solution will not work with biblatex. If you want an answer for your set-up with biblatex, please ask a new question with MWE/MWEB. – moewe Apr 20 '17 at 06:54
2

The reason for this behavior is a conflict between the DGP (Deutsche Gesellschaft fuer Psychologie/ German Association of Psychology) and APA. If you use the ngerman option in babel, the apacite-package is switching to the rules of the DGP. I had the same problem and fixed it this way (compare the issue number line for nongerman and german option):

%---- remove space between volume and issue of a journal ----
\makeatletter
\renewcommand{\APACjournalVolNumPages}[4]{%
  \Bem{#1}%             journal
  \ifx\@empty#2\@empty
  \else
    \unskip, \Bem{#2}%  volume
  \fi
  \ifx\@empty#3\@empty
  \else
%    \unskip\ ({#3})%    issue number, with the added leading space
    \unskip({#3})%    issue number, without the added leading space
  \fi
  \ifx\@empty#4\@empty
  \else
    \unskip, {#4}%      pages
  \fi
}%
\makeatother
%---- end space correction ----
Friedrich
  • 147
0

Du bist mein Held!!! Hat zwar ein bißchen gebraucht, bis ich die korrekte Stelle in den tex Files gefundne habe, wo ich das reinkopieren muss, aber jetzt klappts

PS: meiner Erfahrung nach muss man da auch gleich setzen.

\renewcommand{\BCBT}{,} \renewcommand{\BCBL}{,}

Damit der Beistrich vor dem vorletzten Autor im Litverzeich

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. – Community Apr 20 '22 at 07:08
  • Welcome to TeX,SE! BTW, this is English speaking size :-) – Zarko Apr 20 '22 at 07:36