3

This question can be seen as an extension to this one (How to add a comma between author and year) which does not, however, contain an answer to my question.

In the same context, I am trying to modify the citation style so that there is a comma separating the author and the year, as in:

(Author, 2016)

. I managed to achieve that by modifying biblatex.def file with following.

\renewcommand*{\nameyeardelim}{\addcomma\space}

My problem now is that I cannot seem to find \titleyeardelim or some "default" (if such exists) delimiter which is used in cases where the author is absent and the title is used instead. Consequentially I'm getting

(Title 2016)

in all my citations instead of the required:

(Title, 2016)

Thank you for any help in advance!

Mico
  • 506,678
Konaras
  • 133
  • 1
    Is \nonameyeardelim the chap you are looking for? (This is a new command in biblatex 3.3.) – moewe Mar 24 '16 at 16:34
  • Thanks @moewe , it really sounds like something I'm looking for, especially after I have checked, I am still running v0.99d! However the trick is that I have already made a number of modification to various config files (over a period of 6 month) to suit my needs for referencing and it would be too great of a risk to take to update Bibtex and hope that I will be able to do such modifications again (or at least in time for the deadline). Therefore I'm stuck with the current version and have to make the best of it. – Konaras Mar 24 '16 at 18:20
  • v0.99d is the BibTeX version, I believe, not the biblatex version. Which style are you using authoryear? – moewe Mar 24 '16 at 18:26
  • @moewe Yes it is indeed, Biblatex version: 3.0, my apologies. I am using style=authoryear. – Konaras Mar 25 '16 at 11:10

1 Answers1

2

Starting from version 3.3 of biblatex, there is the command \nonameyeardelim that you can redefine

\renewcommand*{\nonameyeardelim}{\addcomma\space}

If you run an older version of biblatex you will need to modify the cite macro itself, with the authoryear style that is

\providecommand*{\nonameyeardelim}{\nameyeardelim}
\renewcommand*{\nonameyeardelim}{\nameyeardelim}

\renewbibmacro*{cite}{%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
       {\usebibmacro{cite:label}%
        \setunit{\nonameyeardelim}}%% <-- this line needed to be changed
       {\printnames{labelname}%
        \setunit{\nameyeardelim}}%
     \usebibmacro{cite:labelyear+extrayear}}
    {\usebibmacro{cite:shorthand}}}
moewe
  • 175,683
  • Thank you @moewe, for the detailed answer. It did help me a lot and at the end I managed to get the citations just the way I need them. Although I got the desired results by modifying a different line than in the answer provided. For the sake others who might read this and are (like me) not very confident in this the file I have modified is the style file (authoryear.cbx). And the modification I made are as follows: \setunit{\addcomma\space}} original line setunit{\addspace}}, form the answer above. – Konaras Mar 25 '16 at 11:56
  • @Konaras Please note that you should not modify the global package files directly. Those modifications are undone if you update the packages. With biblatex it is very easy to roll your own style based on an existing one or to just stuff all the code in the preamble. See for example Biblatex.cfg vs .cls vs .sty. I don' quite understand how your solution differs from what I have done except that I have used \nonameyeardelim and let it default to \nameyeardelim which with your setup should be \addcoma\space. – moewe Mar 26 '16 at 06:57