[Tex/LaTex] Tweaking Biblatex-chicago citation format

biblatexhyperrefpolyglossiaxetex

I'm hoping this hasn't been asked elsewhere already; if so, I apologize.

My issue is that I am trying to format my dissertation using Chicago style (biblatex-chicago). I am using XeLaTeX + polyglossia for ancient Greek text, if that helps (yet it's not particularly important for the issue at hand). Chicago style has worked fine overall, yet I need to follow the style of a particular journal for my citations.

Here's a sample from my BibLaTeX .bib file:

@BOOK{WIngram80,
  title = {Sophocles: {A}n {I}nterpretation},
  publisher = {Cambridge University Press},
  year = {1980},
  author = {Winnington-Ingram, R. P.},
  address = {Cambridge}
}

Here is how I'm calling BibLaTeX in my .tex file: \usepackage[authordate,backend=biber]{biblatex-chicago}

Biblatex-chicago formats citations as such:

Input: See \textcite[120]{WIngram80}

Output: See Winnington-Ingram (1980, 120)

I need to format it like this: See Winnington-Ingram (1980) 120.

Otherwise, the journal I'm using works with Chicago style, except for in-text citations. Citations without page numbers work fine, i.e., "Winnington-Ingram (1980)" — but I'd like to fix this issue, hopefully with \textcite at the very least.

Also, I need to retain the date in parentheses even within parenthetical citations (i.e., \parencite), so an output of \parencite[120]{WIngram80} should be: "(Winnington-Ingram (1980) 120)"

Let me know if you need any other information.
Thanks very much in advance!

** EDIT: Thank you Moewe, your suggestions worked beautifully! I have a couple of other questions on formatting, mostly with regard to hyperref, but they are germane to this discussion as well.

When I use \textcite with a page number or other reference argument, I'd like to have both the last name and the date hyperlinked; the page is unimportant. While this works just fine for \footcite, if I am using \textcite in a footnote with other information, like so:

\footnote{See \textcite[78]{Vernant}. The French translation is my own.}

The output is: See Vernant (1977) 78. The French translation is my own. (I'm using bold to indicate where the link occurs here)

I'd prefer it to be: See Vernant (1977) 78. The French translation is my own.

I'm not sure if this is possible, but it works perfectly like this with \footcite, if the footnote needs nothing other than the citation.

Input: \footcite[See][218]{Barfield}

Output: See Barfield (1988) 218.

I have detailed footnotes here and there with text citations and other commentary, and above all I would like to keep things consistent, especially with hyperlinks. The editorial office is known for being fairly strict about these things, so I want to make sure to keep it all uniform.

Thanks again for your help moewe!

** edit: I realized that I forgot to mention some other patches I collected to help with hyperref support:

\DeclareFieldFormat{citehyperref}{%
\DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
\bibhyperref{#1}}

\DeclareFieldFormat{textcitehyperref}{%
  \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
  \bibhyperref{%
  #1%
\ifbool{cbx:parens}
  {\bibcloseparen\global\boolfalse{cbx:parens}}
  {}}}

\savebibmacro{cite}
\savebibmacro{textcite}

\renewbibmacro*{cite}{%
  \printtext[citehyperref]{%
  \restorebibmacro{cite}%
  \usebibmacro{cite}}}

\renewbibmacro*{textcite}{%
  \ifboolexpr{
    ( not test {\iffieldundef{prenote}} and
       test {\ifnumequal{\value{citecount}}{1}} )
    or
    ( not test {\iffieldundef{postnote}} and
       test {\ifnumequal{\value{citecount}}{\value{citetotal}}} )
}
{\DeclareFieldAlias{textcitehyperref}{noformat}}
{}%
  \printtext[textcitehyperref]{%
  \restorebibmacro{textcite}%
  \usebibmacro{textcite}}}

I came across that snippet, and I'm not sure how it affects a possible solution, if at all. Sorry for not mentioning that before.

Best Answer

biblatex-chicago actually goes through quite great length to achieve the output you get.

The following modifications undoes the behaviour of adding the postnote to the parentheses

\renewcommand*{\postnotedelim}{\addspace}
\makeatletter
\renewbibmacro*{textcite:postnote}{%
  \ifbool{cbx:parens}%
    {\bibcloseparen\global\boolfalse{cbx:parens}}%
    {}%
  \iffieldundef{postnote}%
    {}%
    {\savefield{namehash}{\cbx@lastyear}%
     \setunit{\postnotedelim}%
     \printfield{postnote}}%
  \ifthenelse{\value{multicitecount}=\value{multicitetotal}}%
    {}%
    {\textcitedelim}}% Not \multicitedelim ???
\makeatother

The old version from chicago-authordate.cbx had the \bibcloseparen part at the end of the macro, resulting in the closing parentheses after the postnote.

To always have the year in parentheses (even in \parencite), we have to redefine the cite bibmacro. Since the standard parens field format in biblatex will use square brackets [] within nested parentheses, we also have to define a simpler version of that format to always use parentheses - regardless of the nesting-level.

\DeclareFieldFormat{parenshc}{(#1)}
\makeatletter
\newbibmacro*{cite}{%
  \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
  {\usebibmacro{cite:ibid}}%
  {\iffieldequalstr{entrysubtype}{classical}% Similar to notes+bib
    {\iffieldundef{shorthand}%
      {\ifthenelse{\ifnameundef{labelname}\OR
          \ifentrytype{inreference}\OR
          \ifentrytype{reference}\OR
          \ifentrytype{mvreference}}% Simplified for CMS
        {\usebibmacro{cite:label}%
          \setunit{\addspace}%
          \usebibmacro{cite:reinit}}
        {\iffieldequals{namehash}{\cbx@lasthash}%
          {\iffieldundef{postnote}%
            {\setunit{\compcitedelim}}%
            {}%
            \usebibmacro{cite:label}}
          {\iffieldequals{namehash}{\cbx@lastyear}%
            {}%
            {\usebibmacro{cmsbracketname}% For names in []
              \ifentrytype{customc}%
              {\newcunit}%
              {\setunit{\addspace}}}%
            \usebibmacro{cite:label}%
            \iffieldundef{postnote}%
            {\savefield{namehash}{\cbx@lasthash}}%
            {\savefield{namehash}{\cbx@lastyear}}}}}%
      {\usebibmacro{cite:shorthand+title}}}
    {\iffieldundef{shorthand}%
      {\ifthenelse{\ifnameundef{labelname}\OR
          \ifentrytype{inreference}\OR
          \ifentrytype{reference}\OR
          \ifentrytype{mvreference}}% Simplified for CMS
        {\usebibmacro{cite:label}%
          \setunit{\addspace}%
          \printtext[parenshc]{\usebibmacro{cmscitesortdate}}%
          \usebibmacro{cite:reinit}}
        {\iffieldequals{namehash}{\cbx@lasthash}%
          {\iffieldundef{postnote}%
            {\setunit{\compcitedelim}}%
            {}%
            \printtext[parenshc]{\usebibmacro{cmscitesortdate}}}
          {\iffieldequals{namehash}{\cbx@lastyear}% Is this right?
            {}%
            {\usebibmacro{cmsbracketname}%
              \setunit{\nameyeardelim}}%
            \printtext[parenshc]{\usebibmacro{cmscitesortdate}}%
            \iffieldundef{postnote}%
            {\savefield{namehash}{\cbx@lasthash}}%
            {\savefield{namehash}{\cbx@lastyear}}}}}%
      {\usebibmacro{cite:shorthand}}}}%
  \setunit{\multicitedelim}}% ???
\makeatother

This modification will cause the standard \cite to have the year in parentheses as well, I'm not sure whether that's what you wanted, but it would get quite messy if we took care of that as well.

MWE

\documentclass[american]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[authordate,backend=biber]{biblatex-chicago}

\addbibresource{biblatex-examples.bib}

\DeclareFieldFormat{parenshc}{(#1)}
\renewcommand*{\postnotedelim}{\addspace}
\makeatletter
\newbibmacro*{cite}{%
  \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
  {\usebibmacro{cite:ibid}}%
  {\iffieldequalstr{entrysubtype}{classical}% Similar to notes+bib
    {\iffieldundef{shorthand}%
      {\ifthenelse{\ifnameundef{labelname}\OR
          \ifentrytype{inreference}\OR
          \ifentrytype{reference}\OR
          \ifentrytype{mvreference}}% Simplified for CMS
        {\usebibmacro{cite:label}%
          \setunit{\addspace}%
          \usebibmacro{cite:reinit}}
        {\iffieldequals{namehash}{\cbx@lasthash}%
          {\iffieldundef{postnote}%
            {\setunit{\compcitedelim}}%
            {}%
            \usebibmacro{cite:label}}
          {\iffieldequals{namehash}{\cbx@lastyear}%
            {}%
            {\usebibmacro{cmsbracketname}% For names in []
              \ifentrytype{customc}%
              {\newcunit}%
              {\setunit{\addspace}}}%
            \usebibmacro{cite:label}%
            \iffieldundef{postnote}%
            {\savefield{namehash}{\cbx@lasthash}}%
            {\savefield{namehash}{\cbx@lastyear}}}}}%
      {\usebibmacro{cite:shorthand+title}}}
    {\iffieldundef{shorthand}%
      {\ifthenelse{\ifnameundef{labelname}\OR
          \ifentrytype{inreference}\OR
          \ifentrytype{reference}\OR
          \ifentrytype{mvreference}}% Simplified for CMS
        {\usebibmacro{cite:label}%
          \setunit{\addspace}%
          \printtext[parenshc]{\usebibmacro{cmscitesortdate}}%
          \usebibmacro{cite:reinit}}
        {\iffieldequals{namehash}{\cbx@lasthash}%
          {\iffieldundef{postnote}%
            {\setunit{\compcitedelim}}%
            {}%
            \printtext[parenshc]{\usebibmacro{cmscitesortdate}}}
          {\iffieldequals{namehash}{\cbx@lastyear}% Is this right?
            {}%
            {\usebibmacro{cmsbracketname}%
              \setunit{\nameyeardelim}}%
            \printtext[parenshc]{\usebibmacro{cmscitesortdate}}%
            \iffieldundef{postnote}%
            {\savefield{namehash}{\cbx@lasthash}}%
            {\savefield{namehash}{\cbx@lastyear}}}}}%
      {\usebibmacro{cite:shorthand}}}}%
  \setunit{\multicitedelim}}% ???

\renewbibmacro*{textcite:postnote}{%
  \ifbool{cbx:parens}%
    {\bibcloseparen\global\boolfalse{cbx:parens}}%
    {}%
  \iffieldundef{postnote}%
    {}%
    {\savefield{namehash}{\cbx@lastyear}%
     \setunit{\postnotedelim}%
     \printfield{postnote}}%
  \ifthenelse{\value{multicitecount}=\value{multicitetotal}}%
    {}%
    {\textcitedelim}}% Not \multicitedelim ???
\makeatother
\begin{document}
  As was discovered \textcite[210]{cicero} and \textcite[210]{wilde} \parencite[210]{cicero} and \cite[210]{wilde}.

  \textcite{wilde,cicero} vs \parencite{wilde,cicero}.

  \textcite{baez/article,wilde,cicero} vs \parencite{baez/article,wilde,cicero}.

  \printbibliography
\end{document}

enter image description here


To incorporate your hyperlink fixes try the following MWE. Note that you will not have to add any other hyperlink code to this snippet. I have incorporated the code you posted in your update into this version.

\documentclass[american]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[authordate,backend=biber]{biblatex-chicago}
\usepackage{hyperref}

\addbibresource{biblatex-examples.bib}

\DeclareFieldFormat{parenshc}{(#1)}
\renewcommand*{\postnotedelim}{\addspace}
\makeatletter
\newbibmacro*{cite}{\printtext[citehyperref]{%
  \ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
  {\usebibmacro{cite:ibid}}%
  {\iffieldequalstr{entrysubtype}{classical}% Similar to notes+bib
    {\iffieldundef{shorthand}%
      {\ifthenelse{\ifnameundef{labelname}\OR
          \ifentrytype{inreference}\OR
          \ifentrytype{reference}\OR
          \ifentrytype{mvreference}}% Simplified for CMS
        {\usebibmacro{cite:label}%
          \setunit{\addspace}%
          \usebibmacro{cite:reinit}}
        {\iffieldequals{namehash}{\cbx@lasthash}%
          {\iffieldundef{postnote}%
            {\setunit{\compcitedelim}}%
            {}%
            \usebibmacro{cite:label}}
          {\iffieldequals{namehash}{\cbx@lastyear}%
            {}%
            {\usebibmacro{cmsbracketname}% For names in []
              \ifentrytype{customc}%
              {\newcunit}%
              {\setunit{\addspace}}}%
            \usebibmacro{cite:label}%
            \iffieldundef{postnote}%
            {\savefield{namehash}{\cbx@lasthash}}%
            {\savefield{namehash}{\cbx@lastyear}}}}}%
      {\usebibmacro{cite:shorthand+title}}}
    {\iffieldundef{shorthand}%
      {\ifthenelse{\ifnameundef{labelname}\OR
          \ifentrytype{inreference}\OR
          \ifentrytype{reference}\OR
          \ifentrytype{mvreference}}% Simplified for CMS
        {\usebibmacro{cite:label}%
          \setunit{\addspace}%
          \printtext[parenshc]{\usebibmacro{cmscitesortdate}}%
          \usebibmacro{cite:reinit}}
        {\iffieldequals{namehash}{\cbx@lasthash}%
          {\iffieldundef{postnote}%
            {\setunit{\compcitedelim}}%
            {}%
            \printtext[parenshc]{\usebibmacro{cmscitesortdate}}}
          {\iffieldequals{namehash}{\cbx@lastyear}% Is this right?
            {}%
            {\usebibmacro{cmsbracketname}%
              \setunit{\nameyeardelim}}%
            \printtext[parenshc]{\usebibmacro{cmscitesortdate}}%
            \iffieldundef{postnote}%
            {\savefield{namehash}{\cbx@lasthash}}%
            {\savefield{namehash}{\cbx@lastyear}}}}}%
      {\usebibmacro{cite:shorthand}}}}%
  \setunit{\multicitedelim}}}% ???

\renewbibmacro*{textcite:postnote}{%
  \ifbool{cbx:parens}%
    {\bibcloseparen\global\boolfalse{cbx:parens}}%
    {}%
  \iffieldundef{postnote}%
    {}%
    {\savefield{namehash}{\cbx@lastyear}%
     \setunit{\postnotedelim}%
     \printfield{postnote}}%
  \ifthenelse{\value{multicitecount}=\value{multicitetotal}}%
    {}%
    {\textcitedelim}}% Not \multicitedelim ???


\DeclareFieldFormat{citehyperref}{%
\DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
\bibhyperref{#1}}

\DeclareFieldFormat{textcitehyperref}{%
  \DeclareFieldAlias{bibhyperref}{noformat}% Avoid nested links
  \bibhyperref{%
  #1%
\ifbool{cbx:parens}
  {\bibcloseparen\global\boolfalse{cbx:parens}}
  {}}}

\renewbibmacro*{textcite}{%
  \iftoggle{cms@los}%
  {\printtext[textcitehyperref]{\usebibmacro{textcite:authshort}}}%
  {\printtext[textcitehyperref]{\usebibmacro{textcite:citeshort}}}}
\makeatother

\begin{document}
  As\footcite[See][]{knuth:ct:a,knuth:ct:b} was discovered \textcite[210]{cicero} and \textcite[210]{wilde} \parencite[210]{cicero} and \cite[210]{wilde}.

  \textcite{wilde,cicero} vs \parencite{wilde,cicero}.\footcite{wilde}

  \textcite{baez/article,wilde,cicero} vs \parencite{baez/article,wilde,cicero}.

  \printbibliography
\end{document}