1

I have the following document

\documentclass[12pt,a4paper]{report}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{polyglossia}
\usepackage[maxlevel=3]{csquotes}
\usepackage{graphicx}
\usepackage[style=authoryear, language=french]{biblatex}
\setmainfont[Ligatures=TeX]{FreeSerif}
\setmainlanguage{french}
\setotherlanguage{english}
\usepackage{placeins}

\usepackage{setspace}
\onehalfspacing

When, for instance, I use the code:

\parencite{Boin2000} and \parencite{Boin2000b} 

I get the following result:

Boin, 2000a and Boin, 2000b

But when I use the code:

\citeyear{Boin2000} and \citeyear{boin2000b}

I only get:

2000 and 2000

Boin2000 and Boin2000b are related to the following .bib document:

@Book{Boin2000,
Title                    = {The Politics of Environment},
Author                   = {Boin, Mathis},
Publisher                = {Cambridge University Press},
Year                     = {2000},}

and

 @Book{Boin2000b,
 Title                    = {What is Environment},
 Author                   = {Boin, Mathis},
 Publisher                = {Environment Policies Review},
 Year                     = {2000},}

What should I do to also get the letters "a" and "b" that differentiate the two different references with \citeyear?

  • if your concerns have been addressed, you might consider accepting the answer that moewe gave you... – aeroNotAuto Mar 13 '15 at 14:12
6

That \citeyear does not print the additional letter (the extrayear field) makes sense if you think about the application of the \citeyear command: It is used to write things like "In 2000 Foo finally succeeded in publishing the proof.", not to identify a citation; that is where other cite commands such as \cite, \textcite come in.

\citeyear has a starred variant \citeyear* that also prints the extrayear. From the code this might lead to complications if the labeldate was not actually taken from date but from origdate (for example), then extrayear pertains to origdate, not to date, but the letter is affixed to origdate.

These first two solutions do not have hyper-linking enabled by default though.

You can suppress the mentioning of the author in authoryear and authortitle styles with \cite*. When using a authoryear style this effectively amounts to only printing the year (the labelyear actually) and extryear if need be.

If for some reason \cite* does not work (or has not been implemented in custom styles) and you are concerned about the corner case for \citeyear* I mentioned above, we can define it ourselves by

\DeclareCiteCommand{\citelabelyear}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printtext[bibhyperlink]{\iffieldundef{labelyear}
   {\printfield{year}}
   {\printfield{labelyear}%
    \iffieldundef{extrayear}
      {}
      {\printfield{extrayear}}}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

MWE

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[style=authoryear,backend=biber]{biblatex}
\usepackage{hyperref}
\addbibresource{biblatex-examples.bib}

\DeclareCiteCommand{\citelabelyear}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printtext[bibhyperlink]{\iffieldundef{labelyear}
   {\printfield{year}}
   {\printfield{labelyear}%
    \iffieldundef{extrayear}
      {}
      {\printfield{extrayear}}}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\begin{document}
  \citeyear{knuth:ct:b} and \citeyear{knuth:ct:c}

  \citeyear*{knuth:ct:b} and \citeyear*{knuth:ct:c}

  \cite*{knuth:ct:b} and \cite*{knuth:ct:c}

  \citelabelyear{knuth:ct:b} and \citelabelyear{knuth:ct:c}
\end{document}

enter image description here

  • oh, awesome, i totally read that wrong! – aeroNotAuto Mar 12 '15 at 16:45
  • I use indeed hyperref, so \cite* does the job well. – Leo Mar 12 '15 at 17:05
0

This isn't really an answer, but I figured it'd be too long for a comment...

I really need a MWE like this to know if this is a duplicate question or not. Are you using biblatex and if so, what version? There is a chance that your question has already been answered here, which describes a bug that an update might fix.

If you're not using biblatex or that question does not apply to your situation, we at least need to see what your .bib contents for boin2000 and boin2000b look like. These are user defined labels, so I don't think they tell us very much, in and of themselves.

Edit:

I've been able to reproduce your problem with biblatex v2.9a using the following MWE

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents*}{test.bib}
@Book{Boin2000,
Title                    = {The Politics of Environment},
Author                   = {Boin, Mathis},
Publisher                = {Cambridge University Press},
Year                     = {2000},}
@Book{Boin2000b,
Title                    = {What is Environment},
Author                   = {Boin, Mathis},
Publisher                = {Environment Policies Review},
Year                     = {2000},}
@Book{Anderson2003,
author      = {Anderson, John D.},
title       = {Modern Compressible Flow},
publisher   = {McGraw-Hill},
year        = {2003},
}
\end{filecontents*}

\usepackage[backend=bibtex,style=authoryear]{biblatex}
\addbibresource{test}

\begin{document}
    My first citation should be \citeyear{Boin2000}, my second \citeyear{Boin2000b}, and my third \citeyear{Anderson2003}.
    \printbibliography
\end{document}

which results in

citationExample

and reproduces your problem. Asking around to see if this is still a bug in version 2.9a...

  • i originally tried to enter this as a comment, and with the code for the links, the character count was 666. creepy. – aeroNotAuto Mar 11 '15 at 19:00
  • Ok I have added the MWE as you asked. I tried to simplify at the maximum, so I hope nothing is missing. I also have checked the other topics, but it didn't seem to match. – Leo Mar 12 '15 at 14:40
  • This is actually not a bug, but expected behaviour. One needs to use other commands to also see the extrayear. – moewe Mar 12 '15 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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