[Tex/LaTex] biblatex citation format

biblatexciting

I have started using LaTeX with biblatex to format my dissertation. I need my citation to look something like: (johnson, 2010:29), which is (author, year:page).

Then there are some citations that I have to make look like (Xenophon, Hellenica 7.6.2), which is (author, italicized book, section).

Is it possible to modify \autocite to work like this? If so… where do I start? Which file do I have to modify?

Best Answer

Your author-year citation command can be obtained using the authoryear style and some minor edits to nameyeardelim and the postnote format. A variant of this using the title in place of the year can easily be defined using the \AtNextCite hook.

\documentclass{report}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}
\usepackage[colorlinks]{hyperref}

\renewcommand*{\nameyeardelim}{\nametitledelim}
\renewcommand*{\postnotedelim}{\addcolon}
\DeclareFieldFormat{postnote}{#1}

\newrobustcmd*{\citehook}{%
  \AtNextCite{%
    \renewcommand*{\postnotedelim}{\addspace}%
    \renewbibmacro*{cite:labelyear+extrayear}{%
      \iffieldundef{label}
        {\printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}
        {}}}}

\newrobustcmd*{\autocitetitle}{\citehook\autocite}
\newrobustcmd*{\autocitetitles}{\citehook\autocites}

\addbibresource{biblatex-examples.bib}
\begin{document}
\null\vfill
Filler text \autocite[See][10--15]{aristotle:poetics}.
Filler text \autocitetitle[See][7.6.2]{aristotle:poetics}.
Filler text \autocite{aristotle:poetics,aristotle:rhetoric,kant:kpv,cms}.
Filler text \autocites[10--15]{aristotle:poetics}[25]{aristotle:rhetoric}.
Filler text \autocitetitle{aristotle:poetics,aristotle:rhetoric,kant:kpv,cms}.
Filler text \autocitetitles[7.6.2]{aristotle:poetics}{aristotle:rhetoric}.
\printbibliography
\end{document}

enter image description here

An advantage of this approach is that it works for any of the author-year styles. Here's the citation output of the same document using the package options style=authoryear-icomp and autocite=footnote.

enter image description here

To further customize the citation label for a specific entry, you can make use of the shorthand and label fields in your bib file. In the sample document, the entry by Kant goes by the shorthand "KpV". This overrides both labelname and labelyear+extrayear. The Chicago Manual of Style has the label "CMS". It overrides only labelname.

All of the citation style changes can be incorporated into \autocite, but you'll have to provide some details on which entries need to be cited with titles. These can be distinguished through criteria specified on existing bibliographic data or through a category defined in your document preamble or bib file.