Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apa style citation #62

Open
JuanLinaresLanzman opened this issue Nov 19, 2016 · 4 comments
Open

Apa style citation #62

JuanLinaresLanzman opened this issue Nov 19, 2016 · 4 comments

Comments

@JuanLinaresLanzman
Copy link

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

Thanks in advance

@aminmkhan
Copy link

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

@fredcallaway
Copy link

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

@philip-ndikum
Copy link

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

@fredcallaway
Copy link

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}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants