Dissertate icon indicating copy to clipboard operation
Dissertate copied to clipboard

Apa style citation

Open JuanLinaresLanzman opened this issue 7 years ago • 4 comments

I'm looking for the command to use "apa style" citation instead of the citation based on numbers with hiperlinks.

Thanks in advance

JuanLinaresLanzman avatar Nov 19 '16 10:11 JuanLinaresLanzman

Ask on http://tex.stackexchange.com/. I switched to using BibLaTeX, for example.

aminmkhan avatar Nov 30 '16 14:11 aminmkhan

In Dissertate.cls, simply replace \RequirePackage[super,comma,numbers]{natbib} with \RequirePackage{natbib}. You may want to adjust the color of the citations (search for citecolor=). Finally, if you want a single link for each citation (rather than separate links on author and year) you can use this hack: https://tex.stackexchange.com/a/27235

Specifically, paste this at the bottom of Dissertate.cls

\usepackage{etoolbox}
\makeatletter

\pretocmd{\NAT@citex}{%
  \let\NAT@hyper@\NAT@hyper@citex
  \def\NAT@postnote{#2}%
  \setcounter{NAT@total@cites}{0}%
  \setcounter{NAT@count@cites}{0}%
  \forcsvlist{\stepcounter{NAT@total@cites}\@gobble}{#3}}{}{}
\newcounter{NAT@total@cites}
\newcounter{NAT@count@cites}
\def\NAT@postnote{}

% include postnote and \citet closing bracket in hyperlink
\def\NAT@hyper@citex#1{%
  \stepcounter{NAT@count@cites}%
  \hyper@natlinkstart{\@citeb\@extra@b@citeb}#1%
  \ifnumequal{\value{NAT@count@cites}}{\value{NAT@total@cites}}
    {\ifNAT@swa\else\if*\NAT@postnote*\else%
     \NAT@cmt\NAT@postnote\global\def\NAT@postnote{}\fi\fi}{}%
  \ifNAT@swa\else\if\relax\NAT@date\relax
  \else\NAT@@close\global\let\NAT@nm\@empty\fi\fi% avoid compact citations
  \hyper@natlinkend}
\renewcommand\hyper@natlinkbreak[2]{#1}

% avoid extraneous postnotes, closing brackets
\patchcmd{\NAT@citex}
  {\ifNAT@swa\else\if*#2*\else\NAT@cmt#2\fi
   \if\relax\NAT@date\relax\else\NAT@@close\fi\fi}{}{}{}
\patchcmd{\NAT@citex}
  {\if\relax\NAT@date\relax\NAT@def@citea\else\NAT@def@citea@close\fi}
  {\if\relax\NAT@date\relax\NAT@def@citea\else\NAT@def@citea@space\fi}{}{}

\makeatother

fredcallaway avatar May 13 '22 15:05 fredcallaway

Can anyone else help here? Switching citation styles, \citeauthor or cite title do not work for me.

philip-ndikum avatar May 14 '23 20:05 philip-ndikum

Not sure if this will help, but my dissertation has APA citations (I think): https://github.com/fredcallaway/dissertation

I did notice that I have \bibliographystyle{apalike2} in my dissertation.tex. And as I said above I removed options to natbib in DIssertate.cls so it's just \RequirePackage{natbib}

fredcallaway avatar May 15 '23 01:05 fredcallaway