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.

For my master's thesis I changed my citation package from harvard with bibtex to biblatex-chicago with authordate and bibtex8, primarily because I need babel to translate my bibliography to Norwegian. But I miss the \possessivecite command from the harvard package, and I haven't found anything like it in the biblatex-chicago documentation.

Making a command like

\newcommand{\posscite}[1]{\citeauthor{#1}'s \autocite*{#1}} 

would solve it, but then I won't be able to cite a certain page with

\posscite[135]{key})

and I would really like to. As I'm writing in Norwegian, I also need the possessive to be ' when the author's name ends with s/sh/sj/rs/z (much like in English)and just s (no apostrophe) in any other case. How do I do that?

share|improve this question

2 Answers 2

The appropriate possessive suffix can be generated by examining the last few characters of the label. This is straightforward using the package xstring.

Possessive citation commands in English are much easier to construct. An example under the the standard author-year styles is covered in another question.

authoryear and its variants

In response to a feature request on possessive citations, Philipp Lehman demonstrated how one could generate a possessive labelname in English using a format alias. The code below extends this approach to other types of labels and Norwegian possessives. It should work for all variants of the standard author-year styles.

\documentclass{article}
\usepackage[norsk]{babel}
\usepackage[style=authoryear-comp]{biblatex}
\usepackage{xstring}
\usepackage{filecontents}

\newrobustcmd*{\mkbibpossess}[1]{%
  \IfEndWith{#1}{s}
    {'}
    {\IfEndWith{#1}{sh}
      {'}
      {\IfEndWith{#1}{sj}
        {'}
        {\IfEndWith{#1}{z}
          {'}
          {s}}}}}

\DeclareNameFormat{labelname:poss}{% Based on labelname from biblatex.def
  \ifcase\value{uniquename}%
    \usebibmacro{name:last}{#1}{#3}{#5}{#7}%
  \or
    \ifuseprefix
      {\usebibmacro{name:first-last}{#1}{#4}{#5}{#8}}
      {\usebibmacro{name:first-last}{#1}{#4}{#6}{#8}}%
  \or
    \usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
  \fi
  \usebibmacro{name:andothers}%
  \ifthenelse{\value{listcount}=\value{liststop}}
    {\ifmorenames
      {s}
      {\StrRemoveBraces{#1}[\cbxnobraces]%
        \IfEndWith{\cbxnobraces}{s}
          {'}
          {\IfEndWith{\cbxnobraces}{sh}
            {'}
            {\IfEndWith{\cbxnobraces}{sj}
              {'}
              {\IfEndWith{\cbxnobraces}{z}
                {'}
                {s}}}}}}
    {}}

\DeclareFieldFormat{shorthand:poss}{%
  \ifnameundef{labelname}{#1\mkbibpossess{#1}}{#1}}

\DeclareFieldFormat{citetitle:poss}{\mkbibemph{#1}\mkbibpossess{#1}}

\DeclareFieldFormat{label:poss}{#1\mkbibpossess{#1}}

\newrobustcmd*{\posscitealias}{%
  \AtNextCite{%
    \DeclareNameAlias{labelname}{labelname:poss}%
    \DeclareFieldAlias{shorthand}{shorthand:poss}%
    \DeclareFieldAlias{citetitle}{citetitle:poss}%
    \DeclareFieldAlias{label}{label:poss}}}

\newrobustcmd*{\posscite}{%
  \posscitealias%
  \textcite}

\newrobustcmd*{\Posscite}{\bibsentence\posscite}

\newrobustcmd*{\posscites}{%
  \posscitealias%
  \textcites}

\begin{filecontents}{\jobname.bib}
@Book{kish,
  author = {Kish, Leslie},
  title = {Survey Sampling},
  publisher = {John Wiley and Sons},
  address = {New York},
  year = {1965}}
@Online{hss,
  author = {{U.S. Dept. of Health and Human Services}},
  url = {http://www.hhs.gov},
  year = {2011}}
@Report{nasa,
  title = {Fiscal Year 2012 Budget Estimates},
  author = {{National Aeronautics and Space Administration}},
  shortauthor = {NASA},
  year = {2011}}
@Book{shorthand,
  shorthand = {Shorthand sj},
  year = {2010},
  publisher = {Anonymous Press},
  location = {New York}}
@Book{label,
  label = {Label z},
  year = {2011},
  publisher = {Anonymous Press},
  location = {New York}}
@Book{noauthors,
  title = {A Book without Authors},
  year = {2011},
  publisher = {Anonymous Press},
  location = {New York}}
@Book{noauthor,
  title = {A Book with No Author},
  year = {2011},
  publisher = {Anonymous Press},
  location = {New York}}
@Manual{dyna:browser,
  title = {Dynatext, Electronic Book Indexer/Browser},
  organization = {Electronic Book Technology Inc.},
  address = {Providence, RI},
  year = {1991}}
\end{filecontents}

\addbibresource{\jobname.bib}
\bibliography{biblatex-examples}

\renewcommand{\baselinestretch}{1.25}

\begin{document}
\subsection*{label ending in s/sh/sj/z}
Author ending in sh: \posscite[45--68]{kish} \\
Author ending in s: \posscite[45--68]{gillies} \\
Corporate author ending in s: \posscite{hss}
No author, title ending in s: \posscite[45--68]{noauthors} \\
No author or title; shorthand ending in sj: \posscite[45--68]{shorthand} \\
Author ending in z: \posscite[45--68]{gonzalez} \\
No author, title or shorthand; label ending in z: \posscites{label}{gillies}
\subsection*{label ending in other characters}
Manual by organization: \posscite{dyna:browser} \\
Shortauthor: \posscite[45--68]{nasa} \\
Shorthand: \posscite[45--68]{kant:ku} \\
No author: \posscite[45--68]{noauthor} \\
Compact labelname: \posscites{aristotle:physics}{aristotle:poetics}
\end{document}

enter image description here

chicago-authordate

The approach for this style is similar, but when the label is generated by the bibliography macro cite:label it can take on many different formats depending on the entry type and available fields. So the code below redefines the macro locally for use by the possessive citation command.

\documentclass{article}
\usepackage[norsk]{babel}
\usepackage[authordate]{biblatex-chicago}
\usepackage{xstring}
\usepackage{filecontents}

\newrobustcmd*{\mkbibpossess}[1]{%
  \IfEndWith{#1}{s}
    {'}
    {\IfEndWith{#1}{sh}
      {'}
      {\IfEndWith{#1}{sj}
        {'}
        {\IfEndWith{#1}{z}
          {'}
          {s}}}}}

\DeclareNameFormat{labelname:poss}{% Based on labelname from biblatex.def
  \ifcase\value{uniquename}%
    \usebibmacro{name:last}{#1}{#3}{#5}{#7}%
  \or
    \ifuseprefix
      {\usebibmacro{name:first-last}{#1}{#4}{#5}{#8}}
      {\usebibmacro{name:first-last}{#1}{#4}{#6}{#8}}%
  \or
    \usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
  \fi
  \usebibmacro{name:andothers}%
  \ifthenelse{\value{listcount}=\value{liststop}}
    {\ifmorenames
      {s}
      {\StrRemoveBraces{#1}[\cbxnobraces]%
        \IfEndWith{\cbxnobraces}{s}
          {'}
          {\IfEndWith{\cbxnobraces}{sh}
            {'}
            {\IfEndWith{\cbxnobraces}{sj}
              {'}
              {\IfEndWith{\cbxnobraces}{z}
                {'}
                {s}}}}}}
    {}}

\DeclareListFormat{organization:poss}{%
  \usebibmacro{list:delim}{#1}%
  #1\isdot
  \usebibmacro{list:andothers}%
  \ifthenelse{\value{listcount}=\value{liststop}}
    {\ifmoreitems
      {s}
      {\StrRemoveBraces{#1}[\cbxnobraces]%
        \IfEndWith{\cbxnobraces}{s}
          {'}
          {\IfEndWith{\cbxnobraces}{sh}
            {'}
            {\IfEndWith{\cbxnobraces}{sj}
              {'}
              {\IfEndWith{\cbxnobraces}{z}
                {'}
                {s}}}}}}
    {}}

\DeclareFieldFormat{shorthand:poss}{%
  #1\mkbibpossess{#1}}

\DeclareFieldFormat{possess}{\mkbibpossess{#1}}

\newbibmacro*{cite:label:poss}{% Based on cite:label from chicago-authordate.cbx
  \iffieldundef{label}%
    {\iffieldequalstr{entrysubtype}{magazine}%
       {\printtext[bibhyperref]{%
          \printfield[journaltitle]{journaltitle}%
          \printfield[possess]{journaltitle}}}%
       {\iffieldequalstr{entrytype}{manual}%
          {\printtext[bibhyperref]{\printlist{organization}}}%
          {\printtext[bibhyperref]{%
             \printfield[citetitle]{labeltitle}%
             \printfield[possess]{labeltitle}}}}}%
       {\printtext[bibhyperref]{%
          \printfield{label}%
          \printfield[possess]{label}}}}

\newrobustcmd*{\posscitealias}{%
  \AtNextCite{%
    \renewbibmacro*{cite:label}{\usebibmacro{cite:label:poss}}%
    \DeclareNameAlias{labelname}{labelname:poss}%
    \DeclareListAlias{organization}{organization:poss}%
    \DeclareFieldAlias{shorthand}{shorthand:poss}}}

\newrobustcmd*{\posscite}{%
  \posscitealias%
  \textcite}

\newrobustcmd*{\Posscite}{\bibsentence\posscite}

\newrobustcmd*{\posscites}{%
  \posscitealias%
  \textcites}

\begin{filecontents}{\jobname.bib}
@Book{kish,
  author = {Kish, Leslie},
  title = {Survey Sampling},
  publisher = {John Wiley and Sons},
  address = {New York},
  year = {1965}}
@Online{hss,
  author = {{U.S. Dept. of Health and Human Services}},
  url = {http://www.hhs.gov},
  year = {2011}}
@Report{nasa,
  title = {Fiscal Year 2012 Budget Estimates},
  author = {{National Aeronautics and Space Administration}},
  shortauthor = {NASA},
  year = {2011}}
@Book{shorthand,
  shorthand = {Shorthand sj},
  year = {2010},
  publisher = {Anonymous Press},
  location = {New York}}
@Book{label,
  label = {Label z},
  year = {2011},
  publisher = {Anonymous Press},
  location = {New York}}
@Book{noauthors,
  title = {A Book without Authors},
  year = {2011},
  publisher = {Anonymous Press},
  location = {New York}}
@Book{noauthor,
  title = {A Book with No Author},
  year = {2011},
  publisher = {Anonymous Press},
  location = {New York}}
@Manual{dyna:browser,
  title = {Dynatext, Electronic Book Indexer/Browser},
  organization = {Electronic Book Technology Inc.},
  address = {Providence, RI},
  year = {1991}}
\end{filecontents}

\addbibresource{\jobname.bib}
\bibliography{biblatex-examples}

\renewcommand{\baselinestretch}{1.25}

\begin{document}
\subsection*{label ending in s/sh/sj/z}
Author ending in sh: \posscite[45--68]{kish} \\
Author ending in s: \posscite[45--68]{gillies} \\
Corporate author ending in s: \posscite{hss}
No author, title ending in s: \posscite[45--68]{noauthors} \\
No author or title; shorthand ending in sj: \posscite[45--68]{shorthand} \\
Author ending in z: \posscite[45--68]{gonzalez} \\
No author, title or shorthand; label ending in z: \posscites{label}{gillies}
\subsection*{label ending in other characters}
Manual by organization: \posscite{dyna:browser} \\
Shortauthor: \posscite[45--68]{nasa} \\
Shorthand: \posscite[45--68]{kant:ku} \\
No author: \posscite[45--68]{noauthor} \\
Compact labelname: \posscites{aristotle:physics}{aristotle:poetics}
\end{document}

enter image description here

share|improve this answer
1  
With biblatex-chicago I get an extra comma (Samarin's (, 1994b)...), but biblatex-authoryear translates the bibliography just as well as -chicago, and switching over actually solved some other minor problems as well. Thanks a lot! –  Pernille Jul 4 '11 at 13:53
    
@Pernille No problem. Thanks for testing it out with chicago. That code is short, but sloppy. So I'm not surprised it doesn't work with other styles. Some other questions I've answered since have me thinking it actually might be possible to do the pattern matching you need. If/when I find enough spare time, I'll try to improve this answer. No guarantees, though! –  Audrey Jul 4 '11 at 15:57

Unfortunately, I know too little about biblatex to answer on the technical level, but I understand the question quite well, since I also use biblatex-chicago in French.

I would say that passing a command to solve that issue is probably going beyond the structural markup logic of LaTeX: you should hardcode these distinctions in your text, not the least because it will serve you right if you have to convert your document to another format.

In other terms, at the abstract level, I am not sure whether LaTeX should provide a way to make your citation command so dependent on your content; it looks like a breach in the core logic of the language to me.

share|improve this answer

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.