5

I'm writing my master thesis and citing in the APA style. Below is a picture how it looks right now:

citation

While it looks fine in general, I would like to alter the year and put it in brackets. Furthermore, erase the comma that comes after the author but leave the one that comes after the year so that it the final version looks like that:

Ruoff et al. (1953), p. 16

Because I copied the code to bring it to the near-final version I don't know how to alter it further to bring it to the wanted form.

The code that I have in the preamble looks as follows:

\documentclass[12pt]{report}
\usepackage{natbib}

\makeatletter
\newcommand*{\ibid}{Ibid.}
  \let\@predcite\@empty
  \let\@currcite\@empty
\def\citef{\kernel@ifnextchar[\citef@{\citef@[]}}
\def\citef@[#1]{\kernel@ifnextchar[{\citef@@[{#1}]}{\citef@@[][{#1}]}}
\def\citef@@[#1][#2]#3{%
  \def\@currcite{#3}%
  \unskip
    \ifx\@currcite\@predcite
      \footnote{#1 \ifx\tempa\@empty\unskip\fi%
      \ibid\ifx\tempb\@empty\else\NAT@cmt #2\fi}%
    \else%
      \footnote{\citealp[#1][#2]{#3}}%
    \fi
  \gdef\@predcite{#3}%
}
\makeatother

\bibliographystyle{apalike}

Furthermore, I cite like this in the text (this is for the example shown in the picture above):

\citef[p. 16]{ruoff53}

In advance, thank you so much for your advice. Your help is greatly appreciated!

EDIT:

After Bernard's tips I have now the following code:

Can you give me further hints? I altered the body of my text to the following, bit it seems to be a complete mess...

\documentclass[12pt]{report}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\usepackage[utf8]{inputenc}
\usepackage{natbib}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=apa,backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\addbibresource{biblio.bib}
\usepackage{rotating}

\makeatletter
\newcommand*{\ibid}{Ibid.}
  \let\@predcite\@empty
  \let\@currcite\@empty
\def\citef{\kernel@ifnextchar[\citef@{\citef@[]}}
\def\citef@[#1]{\kernel@ifnextchar[{\citef@@[{#1}]}{\citef@@[][{#1}]}}
\def\citef@@[#1][#2]#3{%
  \def\@currcite{#3}%
  \unskip
    \ifx\@currcite\@predcite
      \footnote{#1 \ifx\tempa\@empty\unskip\fi%
      \ibid\ifx\tempb\@empty\else\NAT@cmt #2\fi}%
    \else%
      \footnote{\citealp[#1][#2]{#3}}%
    \fi
  \gdef\@predcite{#3}%
}
\makeatother

\begin{document}


\chapter{Introduction}
\input{ma_chapters/introduction}
.
.
.
.

\bibliographystyle{apalike}
\bibliography{biblio}
  • It can easily be done with biblatex-apa. – Bernard Dec 19 '14 at 23:20
  • OK, and if I change to that, can I still cite in footnote the same way as before? I'm kind of sceptic changing everything up again when 90% is working right now (apart from the problems stated above). – MadJens Dec 20 '14 at 8:48
  • There is a \footcite command and a compatibility module, called with the natbib option. See §3.7.9 of biblatex's documentation for details. One of the advantages of biblatex is that it is easier to customise than a bibtex style. – Bernard Dec 20 '14 at 10:44
  • Can you give me further hints? I altered the body of my text (see Edit in first post), but it seems to be a bit of a mess... :) – MadJens Dec 20 '14 at 13:32
  • @Bernard - I believe the biblatex-apa package implements the citation callout and formatting requirements of the current APA manual, which (in BibTeX) is implemented via the apacite package and apacite bibliography style. The apalike bibliography style, which is what the OP appears to be using, is much older than the apacitepackage, and it doesn't correspond all that closely to current APA formatting guidelines. – Mico Dec 20 '14 at 14:39
3

Assuming you're OK with the apalike bibliography style, the natbib citation management package, and BibTeX in general, you could create a new macro that implements your desired citation callout format.

\newcommand\mycite[2][]{\citeauthor{#2}\ (\citeyear{#2})\ifx#1\undefined\else, #1\fi}

If the first, optional argument isn't specified, nothing is printed after \citeyear{#2}; in effect, if no optional argument is provided, \mycite behaves like \citet would.

enter image description here

\documentclass[12pt]{report}
\usepackage{filecontents}
\begin{filecontents}{biblio.bib}
@article{ruoff,
  author = "A. Ruoff and B. Woof and C. Zoot",
  title  = "Thoughts",
  journal= "Circularity Today",
  year   = 1953,
}
\end{filecontents}
\usepackage{natbib}
\bibliographystyle{apalike}
\newcommand\mycite[2][]{%
  \citeauthor{#2}\ (\citeyear{#2})\ifx#1\undefined\else, #1\fi}
\begin{document}
\mycite[p.~16]{ruoff}  % with optional argument

\mycite{ruoff}  % without optional argument -- no comma is printed

\citet{ruoff}   % compare with output of "\citet"
\bibliography{biblio}
\end{document}

Addendum: To place these citation callouts in a footnote, you could use a macro such as \myfootcite, defined as follows:

\newcommand\myfootcite[2][]{\footnote{\mycite[#1]{#2}.}}

If you don't want the period ("full stop") at the end of the footnote material, just omit the . after {#2}.


Second addendum, to accommodate the OP's request for a citation macro that prints out "Ibid." if the latest entry is the same as that from the preceding citation command:

Compared with the earlier solution, all that's required is to add a test if the current citation's key is the same as the one used in the previous citation. The following code provides two user macros: \tcite, for in-text citations, and \fcite, for in-footnote citations.

enter image description here

\documentclass[12pt]{report}
\usepackage[textheight=2in]{geometry} %% just for this example
\usepackage{filecontents}
\begin{filecontents}{biblio.bib}
@article{ruoff,
  author = "A. Ruoff and B. Woof and C. Zoot",
  title  = "Thoughts",
  journal= "Circularity Today",
  year   = 1953,
}
@article{abc,
  author = "Anna Andersen and Bertha Branson and Carla Carlsson",
  title  = "Further Thoughts",
  journal= "Circularity Today",   
  year   = 2053,
}
\end{filecontents}

\usepackage{natbib}
\bibliographystyle{apalike}
\def\prevcite{} % initialize \prevcite
%% macro for in-text citation
\newcommand\tcite[2][]{%  
  \def\newcite{#2} 
  \ifx\prevcite\newcite 
    Ibid.%
  \else%
    \gdef\prevcite{#2}% update \prevcite
    \citeauthor{#2}\ (\citeyear{#2})%
  \fi
  \ifx#1\undefined\else, #1\fi}
%% macro for in-footnote citation
\newcommand\fcite[2][]{\footnote{\tcite[#1]{#2}}}
\begin{document}


bla bla\fcite{ruoff}

more bla bla\fcite[p.~75]{ruoff}

still more bla bla\fcite[p.~101]{abc}

further bla bla\fcite{abc}

final bla bla\fcite[p.~999]{abc}
\bibliography{biblio}
\end{document}
  • It works! :) However, how do I cite like this in footnote? When I use \mycite it does the citation in the text, but I would rather have it in a footnote. – MadJens Dec 20 '14 at 15:12
  • @MadJens - How do you currently generate citation callouts that show up in footnotes? – Mico Dec 20 '14 at 15:12
  • \citef[p. 16]{ruoff53} which generates the citation in the footnote thanks to the code quoted in the OP (\makatletter...\makeatother) – MadJens Dec 20 '14 at 15:17
  • @MadJens - I've posted an addendum to suggest an additional macro called \myfootcite. – Mico Dec 20 '14 at 15:21
  • Immense, thank you!! A small last question: When I used the \citef command beofre, it used to automatically generate Ibid. citation in the footnote if the same reference was used successively. Is it possible to bring that back? It wouldn't be the end of the world if that wasn't possible anymore, but I'd prefer to have the option later on. – MadJens Dec 20 '14 at 15:35
4

A way of doing things with biblatex-apa. You can emulate natbib commands with the natbib option:

\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}

\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=apa, backend=biber, natbib]{biblatex}
\DeclareLanguageMapping{american}{american-apa}

\addbibresource{biblio.bib}

\usepackage{filecontents}
\begin{filecontents}{biblio.bib}
@article{ruoff,
  author = "A. Ruoff and B. Woof and C. Zoot",
  title = "Thoughts",
  journal= "Circularity Today",
  year = 1953,
}
\end{filecontents}

\renewcommand*{\nameyeardelim}{\addspace}

%
\usepackage{xpatch}

\makeatletter
\newbibmacro*{cite}{%
 \iffieldequals{namehash}{\cbx@lasthash}
% Multiple cites in one command
 {\setunit{\compcitedelim}%
 \usebibmacro{cite:plabelyear+extrayear}}%
% \bibcloseparen%
% Single cite
 {\ifthenelse{\ifnameundef{labelname}\OR\iffieldequalstr{entrytype}{patent}}
% No author/editor
 {\usebibmacro{cite:noname}%
 \setunit{\ifbool{cbx:np}%
 {\nameyeardelim}%
 {\global\booltrue{cbx:parens}\addspace\bibopenparen}}%
 \usebibmacro{cite:plabelyear+extrayear}%
 \bibcloseparen%
 \savefield{namehash}{\cbx@lasthash}}
% Normal cite
 {\ifnameundef{shortauthor}
 {\printnames[labelname][-\value{listtotal}]{labelname}}%
 {\cbx@apa@ifnamesaved
 {\printnames{shortauthor}}
 {\printnames[labelname][-\value{listtotal}]{author}\addspace\printnames[sabrackets]{shortauthor}}}%
 \setunit{\ifbool{cbx:np}%
 {\nameyeardelim}%
 {\global\booltrue{cbx:parens}\addspace\bibopenparen}}%
 \usebibmacro{cite:plabelyear+extrayear}%
 \bibcloseparen%
 \savefield{namehash}{\cbx@lasthash}}}%
 \setunit{\multicitedelim}}
\makeatother

\begin{document}

\chapter{Introduction}

\cite[p.~16]{ruoff} % with optional argument

\textcite{ruoff} % without optional argument -- no comma is printed

\citet{ruoff} % compare with output of "\citet"

\printbibliography

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.