2

I am using the authoryear-icomp style and I am trying to suppress the page prefix S. at \autocites and replace them with a colon.

Yet, I am getting

Dummy (Heinrich 2013: S. 197)

with this MWE:

\documentclass[a4paper, 12pt]{article}
\usepackage[style=authoryear-icomp, isbn=false]{biblatex}
\addbibresource{\jobname.bib}
\DeclareDelimFormat{postnotedelim}{\addcolon\space} 
\DeclareFieldFormat{postnote}{\mknormrange{#1}} 
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}} 
\usepackage[utf8]{inputenc}
\usepackage[babel, german=guillemets]{csquotes}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{titling}

\begin{filecontents}{\jobname.bib}

@book{Heinrich.2013,
 author = {Heinrich, Michael},
 year = {2013},
 title = {Kritik der politischen {\"O}konomie: Eine Einf{\"u}hrung},
 address = {Stuttgart},
 edition = {11. Aufl.},
  publisher = {Schmetterling-Verl.},
 isbn = {3-89657-593-7},
 series = {Reihe Theorie.org}
}
\end{filecontents}
\begin{document}

Dummy\autocite[S.~39]{Heinrich.2013} 
\printbibliography
\end{document}

Outcome

7
  • The code should do what you want, though I would recommend \DeclareDelimFormat{postnotedelim}{\addcolon\space} \DeclareFieldFormat{postnote}{\mknormrange{#1}} \DeclareFieldFormat{multipostnote}{\mknormrange{#1}}. Note that the pages field format is not relevant for citations like this, it is only relevant for the bibliography and \fullcite.
    – moewe
    Commented Oct 18, 2019 at 16:50
  • What looks a bit fishy to me is that your post seems to imply that you have this code in biblatex.def. biblatex.def is a system-installed file that should never be modified. Code like this can just be dropped into your preamble. Did you really edit the system file biblatex.def or did you create a new biblatex.def? Can you show us the reset of your document (ideally as a fully working and self-contained example that we can run in a new, empty folder: tex.meta.stackexchange.com/q/228/35864, tex.meta.stackexchange.com/q/4407/35864)
    – moewe
    Commented Oct 18, 2019 at 16:52
  • gist.github.com/moewew/08d1c70f99fba3a62fd4e16594eee7fa works just fine for me.
    – moewe
    Commented Oct 18, 2019 at 16:55
  • Many thanks for your tips so far, @moewe! I have come to the conclusion that the problem is somewhere else. I use Citavi with the Publication Wizard to create intext quotes. I suspect that the S. is caused by this: <pre>Dummy2\autocite[S.~39]{Heinrich.2013} <code> I am left clicking on the entry in Citavi, and the \autocite[]{} appears with this entries. It seems like there is no solution to avoid S.. As a "solution" would you advise to write a kind of replace command/routine to delete S. within the key when compiling?
    – jule1337
    Commented Oct 18, 2019 at 22:25
  • 1
    I can see that might be easier, but surely you could do it differently if you wished. I just enter my reference keys by hand. If I wanted to use what you're using, I'd probably just write a script to clean up the source at the end before final compilation.
    – cfr
    Commented Oct 19, 2019 at 2:18

2 Answers 2

1

This question nicely illustrates why it is recommended to give the postnote/page reference in the optional argument to \cite-like commands without the page prefix: biblatex can automatically insert the correct prefix if needed, but if the prefix is already given it is much harder to remove it if it is not desired.

biblatex has no function to strip the S.~ from the postnote and this should definitely be fixed on the exporter side: Citavi shouldn't insert S.~ if it generates citations for biblatex.

Here is a workaround using LaTeX3 and its regex functions to strip the S.~ automatically. This is only a last resort, the input should be fixed instead.

\documentclass[a4paper, 12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[babel, german=guillemets]{csquotes}
\usepackage[ngerman]{babel}
\usepackage{csquotes}

\usepackage[style=authoryear-icomp, isbn=false]{biblatex}

\usepackage{xparse}

\ExplSyntaxOn
\cs_new_protected_nopar:Npn \mknormrangeWithoutS:n #1
{
  \tl_set:Nn \l_postnote_tl { #1 }
  \regex_replace_once:nnN {\AS\.\~} {} \l_postnote_tl
  \exp_args:No \mknormrange \l_postnote_tl
}

\NewDocumentCommand{\mknormrangeWithoutS}{m}{
  \mknormrangeWithoutS:n { #1 }
}
\ExplSyntaxOff

\DeclareDelimFormat{postnotedelim}{\addcolon\space}
\DeclareFieldFormat{postnote}{\mknormrangeWithoutS{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrangeWithoutS{#1}}

\addbibresource{biblatex-examples.bib}

\begin{document}
Dummy \autocite[S.~39]{sigfridsson}
\printbibliography
\end{document}

Dummy (Sigfridsson und Ryde 1998: 39)

1
  • thanks a lot - it works perfectly! I will still trying to get Citavi inserting the data without the Prefix S.. If I could solve this, I'd post it here. Cheers!
    – jule1337
    Commented Oct 19, 2019 at 13:54
0

Just in case someone has the same issue: The citavi support has informed me that the prefix S.~ is hardcoded and it is unable to deactivate. Therefor, @moewe's script is the needed and perfectly working work around.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .