BibTeX, biblatex and biberharvard | Modify '\possessivecite'

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
Suppestokk
Posts: 3
Joined: Fri Jan 27, 2012 5:20 pm

harvard | Modify '\possessivecite'

Post by Suppestokk »

Hi.

Does anybody know if it's possible to modify the harvard package so the possessive is ' (just an apostrophe) when the author's name ends with s/sh/sj/rs/z, and just s (no apostrophe) in any other case?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

harvard | Modify '\possessivecite'

Post by localghost »

You can try these lines in the preamble of your document. The code is taken from the harvard package code and slightly modified to define the new command \possessivecites along with its needed helper macros.

Code: Select all

\makeatletter
\newcommand{\possessivecites}{\@ifstar{\@ifstar{\HAR@acitespos}{\HAR@fcitespos}}%
{\HAR@dcitespos}%
}

\newcommand{\HAR@fcitespos}[2][\null]{\HAR@citetoaux{#2}\HAR@checkdef{#2}{%
{\HAR@fname{#2}' \harvardyearleft\HAR@year{#2}\ifthenelse{\equal{#1}{\null}}
    {}{, #1}\harvardyearright}\HAR@setd{#2}}%
}

\newcommand{\HAR@acitespos}[2][\null]{\HAR@citetoaux{#2}\HAR@checkdef{#2}{%
{\HAR@aname{#2}' \harvardyearleft\HAR@year{#2}\ifthenelse{\equal{#1}{\null}}
    {}{, #1}\harvardyearright}\HAR@setd{#2}}%
}

\newcommand{\HAR@dcitespos}[2][\null]{\HAR@citetoaux{#2}\HAR@checkdef{#2}{%
{\HAR@name{#2}' \harvardyearleft\HAR@year{#2}\ifthenelse{\equal{#1}{\null}}
    {}{, #1}\harvardyearright}\HAR@setd{#2}}%
}
\makeatother
Due to a missing minimal example this is untested.


Best regards and welcome to the board
Thorsten
Suppestokk
Posts: 3
Joined: Fri Jan 27, 2012 5:20 pm

harvard | Modify '\possessivecite'

Post by Suppestokk »

Thanks.

The problem now is that the possessive seems to be ' (just an apostroph) in any case, not just when the author's name ends with s/sh/sj/rs/z.

Is it possible to fix this, so the possessive is the letter s when the author's name ends in any other letters. E.g. for Knuth it should display Knuths, not Knuth'.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

harvard | Modify '\possessivecite'

Post by localghost »

For names that end with an s/sh/sj/rs/z use the new \possessivecites command. This was defined in addition to the other commands. For any other case you have still the original \possessivecite command (without the s at the end).
Suppestokk
Posts: 3
Joined: Fri Jan 27, 2012 5:20 pm

Re: harvard | Modify '\possessivecite'

Post by Suppestokk »

Okay, I see.

I was hoping it was possible to have just one command that automatically added the correct possessive, depending on the author's name.
Maybe this isn't even possible?
Post Reply