1

When I try to do possessive citing, it will for some reason create 2 spaces between the characters before the citing instead of one. Do you know how I could fix that? (Not writing one space in the text itself might be a bit bothersome, as I would have to remember that for poss. citing)

 \documentclass[
  12pt,
  a4paper,
  headings=standardclasses,
  listof=totoc,
  numbers=noenddot
]{scrartcl}

\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.00cm, footskip=1cm]{geometry} \usepackage[onehalfspacing]{setspace} \usepackage[main=ngerman, english]{babel} \usepackage[babel, german=quotes]{csquotes} \usepackage[ngerman]{isodate} \usepackage[ngerman]{datetime} %---------------------------------------------------------------------------- % BIB %---------------------------------------------------------------------------- \usepackage[ backend=biber, style=ext-authoryear, sorting=nyvt, datamodel=customstyles, maxnames=25, innamebeforetitle=true, usetranslator=true, alldates=terse, labeldate=year, dashed=false, doi=false, isbn=false ]{biblatex} \addbibresource{\jobname.bib} \usepackage[hidelinks, pdfencoding=auto]{hyperref}

\DeclareDelimFormat[bib]{nametitledelim}{\addcolon\space}

% possessive citing \DeclareNameFormat{labelname:poss}{ % based on labelname from biblatex.def \nameparts{#1} % not needed if using Biblatex 3.4 \ifcase\value{uniquename}% \usebibmacro{name:family}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}% \or \ifuseprefix {\usebibmacro{name:first-last}{\namepartfamily}{\namepartgiveni}{\namepartprefix}{\namepartsuffixi}} {\usebibmacro{name:first-last}{\namepartfamily}{\namepartgiveni}{\namepartprefixi}{\namepartsuffixi}}% \or \usebibmacro{name:first-last}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}% \fi \usebibmacro{name:andothers}% \ifnumequal{\value{listcount}}{\value{liststop}}{s}{}} \DeclareFieldFormat{shorthand:poss}{% \ifnameundef{labelname}{#1s}{#1}} \DeclareFieldFormat{citetitle:poss}{\mkbibemph{#1}s} \DeclareFieldFormat{label:poss}{#1s} \newrobustcmd{\posscitealias}{% \AtNextCite{% \DeclareNameAlias{labelname}{labelname:poss}% \DeclareFieldAlias{shorthand}{shorthand:poss}% \DeclareFieldAlias{citetitle}{citetitle:poss}% \DeclareFieldAlias{label}{label:poss}}} \newrobustcmd{\posscite}{% \posscitealias% \textcite} \newrobustcmd{\Posscite}{\bibsentence\posscite} \newrobustcmd{\posscites}{% \posscitealias% \textcites} %-------------------------------------------------------------------- % MAIN %-------------------------------------------------------------------- \begin{filecontents}{\jobname.bib} @report{Chafe.1974, author = {Chafe, Wallace L.}, title = {An Approach to Verbalization and Translation by Machine. Final Report}, month = {10}, year = {1974}, institution = {{California University, Berkely}}, address = {New York} } \end{filecontents}

\begin{document} In \posscite{Chafe.1974} Werk XYZ. \clearpage \printbibheading[heading=bibintoc,title={Literaturverzeichnis}] \printbibliography \end{document}

example image

2 Answers2

2

Alan Munn's answer is spot on with respect to the source of the spurious spaces in your document, but I'd like to offer a slightly different answer in which we use the new name wrapper format to shorten the code a bit.

We can avoid the whole \DeclareNameFormat{labelname:poss} code block and effectively replace it with \DeclareNameWrapperFormat{labelname:poss}{#1s} and use that later. Note that in the example below I have used a slightly different construction to make the code even more compact.

\documentclass{scrartcl}
\usepackage[main=ngerman, english]{babel}
\usepackage[babel, german=quotes]{csquotes}
\usepackage[
  backend=biber,
  style=ext-authoryear,
]{biblatex}
\usepackage[hidelinks, pdfencoding=auto]{hyperref}

\DeclareDelimFormat[bib]{nametitledelim}{\addcolon\space}

\newrobustcmd{\posscitealias}{% \AtNextCite{% \DeclareNameWrapperFormat{labelname}{##1s}% \DeclareFieldFormat{label}{##1s}}} \newrobustcmd{\posscite}{% \posscitealias% \textcite} \newrobustcmd{\Posscite}{\bibsentence\posscite} \newrobustcmd{\posscites}{% \posscitealias% \textcites}

\begin{filecontents}{\jobname.bib} @report{Chafe.1974, author = {Chafe, Wallace L.}, title = {An Approach to Verbalization and Translation by Machine. Final Report}, month = {10}, year = {1974}, institution = {California University, Berkely}, address = {New York}, } \end{filecontents} \addbibresource{\jobname.bib} \addbibresource{biblatex-examples.bib}

\begin{document} In \posscite{Chafe.1974} Werk \citetitle{Chafe.1974}.

In \posscite{sigfridsson} Werk \citetitle{sigfridsson}.

In \posscite{ctan} Werk XYZ \citetitle{ctan}.

\printbibliography[heading=bibintoc,title={Literaturverzeichnis}] \end{document}

In Chafes (1974) Werk An Approach to Verbalization and Translation by Machine. Final Report.

moewe
  • 175,683
  • After some searching I'm guessing the code in the question is based on an answer to https://tex.stackexchange.com/q/22273/35864, so I'll post this alternative over there as well. – moewe Apr 02 '21 at 09:16
1

As with many questions involving extra spaces, you need to be very careful to not have spaces at the ends of lines in your macro definitions if those macros are producing printable text. The end of line is treated as a space. So you need to remove the spaces before the comment marker % in the first two lines of your \DeclareNameFormat command:

\DeclareNameFormat{labelname:poss}{% based on labelname from biblatex.def
  \nameparts{#1}% not needed if using Biblatex 3.4

You should also probably add a % after this line:

\ifuseprefix
      {\usebibmacro{name:first-last}{\namepartfamily}{\namepartgiveni}{\namepartprefix}{\namepartsuffixi}}% <--- added

Complete code:

 \documentclass[
  12pt,
  a4paper,
  headings=standardclasses,
  listof=totoc,
  numbers=noenddot
]{scrartcl}

\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.00cm, footskip=1cm]{geometry} \usepackage[onehalfspacing]{setspace} \usepackage[main=ngerman, english]{babel} \usepackage[babel, german=quotes]{csquotes} \usepackage[ngerman]{isodate} \usepackage[ngerman]{datetime} %---------------------------------------------------------------------------- % BIB %---------------------------------------------------------------------------- \usepackage[ backend=biber, style=ext-authoryear, sorting=nyvt, datamodel=customstyles, maxnames=25, innamebeforetitle=true, usetranslator=true, alldates=terse, labeldate=year, dashed=false, doi=false, isbn=false ]{biblatex} \addbibresource{\jobname.bib} \usepackage[hidelinks, pdfencoding=auto]{hyperref}

\DeclareDelimFormat[bib]{nametitledelim}{\addcolon\space}

% possessive citing \DeclareNameFormat{labelname:poss}{% based on labelname from biblatex.def \nameparts{#1}% not needed if using Biblatex 3.4 \ifcase\value{uniquename}% \usebibmacro{name:family}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}% \or \ifuseprefix {\usebibmacro{name:first-last}{\namepartfamily}{\namepartgiveni}{\namepartprefix}{\namepartsuffixi}}% {\usebibmacro{name:first-last}{\namepartfamily}{\namepartgiveni}{\namepartprefixi}{\namepartsuffixi}}% \or \usebibmacro{name:first-last}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}% \fi \usebibmacro{name:andothers}% \ifnumequal{\value{listcount}}{\value{liststop}}{s}{}} \DeclareFieldFormat{shorthand:poss}{% \ifnameundef{labelname}{#1s}{#1}} \DeclareFieldFormat{citetitle:poss}{\mkbibemph{#1}s} \DeclareFieldFormat{label:poss}{#1s} \newrobustcmd{\posscitealias}{% \AtNextCite{% \DeclareNameAlias{labelname}{labelname:poss}% \DeclareFieldAlias{shorthand}{shorthand:poss}% \DeclareFieldAlias{citetitle}{citetitle:poss}% \DeclareFieldAlias{label}{label:poss}}} \newrobustcmd{\posscite}{% \posscitealias% \textcite} \newrobustcmd{\Posscite}{\bibsentence\posscite} \newrobustcmd{\posscites}{% \posscitealias% \textcites} %-------------------------------------------------------------------- % MAIN %-------------------------------------------------------------------- \begin{filecontents}{\jobname.bib} @report{Chafe.1974, author = {Chafe, Wallace L.}, title = {An Approach to Verbalization and Translation by Machine. Final Report}, month = {10}, year = {1974}, institution = {{California University, Berkely}}, address = {New York} } \end{filecontents}

\begin{document} In \posscite{Chafe.1974} Werk XYZ. \clearpage \printbibheading[heading=bibintoc,title={Literaturverzeichnis}] \printbibliography \end{document}

output of code

Alan Munn
  • 218,180