Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
You have tag your question biblatex, but mention BibTeX in the title and question. The answer will likely depend on which system you are using. –  StrongBad Feb 29 '12 at 15:17
    
Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post. –  domwass Feb 29 '12 at 15:22
    
Thanks for pointing that out, Daniel. –  Jim Feb 29 '12 at 15:42
    
For classical citations, maybe the advice in this answer will be of interest..? –  jon Feb 29 '12 at 19:50
    
Thank you, Jon. I missed that one. I will give it a whirl. –  Jim Feb 29 '12 at 20:12
add comment

1 Answer 1

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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