8

I do not like the way the commands \cite or \parencite produce page numbers. If I give a command \cite[43]{XXX2015}, it produces:

XXX2015, p.43.

What I would like is:

XXX2015:43.

I understand that the command \citet is supposed to give me this, and I also understand from searching around that I should load the natbib package to get that. However, there is some compatibility issue related to what I already have in my preamble. I guess it must be the biblatex package or backend package (if that is indeed a package). If I just load the natbib package I get the error message:

command \bighang already defined.

Can I continue to use the backend package with this setting and just add something? Here is a MWWW:

\documentclass[12]{article}

\usepackage[english]{babel}
\usepackage[backend=biber, style=authoryear-comp, sortcites=false, maxcitenames=2, mincitenames=1, maxbibnames=4, uniquelist=false]{biblatex}

\addbibresource{ref.bib}

\begin{document}

Blablabla. \cite[43]{Wolfe2015} 

\end{document}
moewe
  • 175,683
EspenJK
  • 519
  • 1
    biblatex has a natbib option to emulate these natbib commands. See p. 6 of the documentation of biblatex. – Bernard Jul 05 '18 at 14:15
  • I have read page 6, none the wiser. In any case, I am using Biber with Biblatex as an extension, if I am not mistaken. So it don't manage to emulate natbib with this particular setting.. – EspenJK Jul 05 '18 at 14:33
  • In the one of the sections linked to,it's explained, if I remember well , that \citet and citep commands are defined to emulate the corresponding commands of natbib. I can't say more, not using natbib personally. – Bernard Jul 05 '18 at 14:40

1 Answers1

9

natbib and biblatex are indeed incompatible. biblatex is incompatible with most bibliography management packages, since it implements citations and bibliography in a way that is fundamentally different from the traditional BibTeX way of doing things. Normally that is not too bad, since biblatex can do many things out of the box so that the extra packages are not needed.

Fortunately natbib is irrelevant to your issue. biblatex can do what you want without additional packages (and without the natbib compatibility mode, that I would avoid if it is not necessary, see also Is there a disadvantage to using natbib=true with biblatex?).

You only need to redefine the postnote formats to stop printing the page prefix. Then we change the punctuation between citation and postnote to a colon.

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear-comp, sortcites=false, maxcitenames=2, mincitenames=1, maxbibnames=4, uniquelist=false]{biblatex}


\addbibresource{biblatex-examples.bib}

\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{volcitepages}{\mknormrange{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}}

\renewcommand*{\postnotedelim}{\addcolon}

\begin{document}
\autocite[380]{sigfridsson}
\printbibliography
\end{document}

gives

enter image description here

Incidentally, \citet would normally give citations of the form

Sigfridsson and Ryde (1998)

the biblatex equivalent to \citet is \textcite (just like the equivalent to \citep is \parencite). The natbib compatibility mode allows you to write \citet to get \textcite with biblatex, but it also changes the behaviour of the starred versions and changes some punctuation (Is there a disadvantage to using natbib=true with biblatex?).

moewe
  • 175,683
  • Typically you wouldn't have a space after the colon. – Alan Munn Jul 05 '18 at 14:45
  • @AlanMunn Not even a thin/small space? I think long labels like the one in my example could benefit from a bit more space. But the question does not want a space and come to think of it when I see a colon used in that position I normally don't see a space either, so I have removed it. – moewe Jul 05 '18 at 14:48
  • Yeah, English is not French. :) – Alan Munn Jul 05 '18 at 14:49
  • @AlanMunn But wouldn't the French also put a space before the colon? – moewe Jul 05 '18 at 14:50
  • 1
    Oh probably. Vive la ponctuation libre! – Alan Munn Jul 05 '18 at 14:52
  • Thanks @moewe, but adding those lines to the preamble did not work, apparently, since I now get an error message related to the first use of \cite in the document: " ! Undefined control sequence. \blx@theformat #->\mkrnormrange... – EspenJK Jul 05 '18 at 15:01
  • 1
    @EspenJK In that case you are using an older version of biblatex. Add \providecommand*{\mknormrange}[1]{#1} to your preamble or update to biblatex 3.11. – moewe Jul 05 '18 at 15:03
  • @moewe, I added your command and now it works. I guess it might be preferable in the long run to update biblatex instead, but I have two until the deadline of my thesis, so I will do that afterways. Thanks for the help! Btw, not sure whether I should accept your answer above or not. Perhaps you want to add your last command to the answer as well first...? – EspenJK Jul 05 '18 at 15:10
  • 2
    @EspenJK It is a wise decision not to rush into updating packages shortly before a deadline. I would rather not add the work-around for older biblatex to the answer, though, because usually I like to encourage people to use the current code. – moewe Jul 05 '18 at 15:19
  • @moewe, I now found out that, after adding your line, \parencite and \citep give the same result, which is to give "author, year" (the same applies to \cite now). I should like to remove the comma between them and only have "author year"... Do you know an easy solution? – EspenJK Jul 08 '18 at 11:45
  • 1
    @EspenJK What line specifically? As you can see from the screenshot the MWE does not have a comma there. The standard separator between author and year is a space, if you use the natbib compatibility mode natbib=true that changes to a comma and space (see also https://tex.stackexchange.com/q/149313/35864). If you don't need \citep and are OK with \parencite just remove the natbib=true. If you must have natbib=true you will want \DeclareDelimFormat{nameyeardelim}{\addspace} or in older versions \renewcommand*{\nameyeardelim}{\addspace}. – moewe Jul 08 '18 at 11:50
  • @moewe, I removed the natbib=true and that worked like a charm. Thanks a lot! – EspenJK Jul 08 '18 at 12:22
  • Thanks a lot ! \textcite helped me get Author(Year) form in my overleaf biblatex file. But \parencite gives (Author Year) format, how do I get (Author, Year) form ? – Aesha Bhansali Apr 26 '21 at 07:23
  • \DeclareDelimFormat{nameyeardelim}{\addcomma\space}. See for example https://tex.stackexchange.com/q/541559/35864. – moewe Apr 26 '21 at 07:39