1

Consider the following MWE.

\documentclass{article}

\usepackage{fontspec} \setmainfont{EB Garamond}

\usepackage[style = authoryear-comp]{biblatex} \usepackage{xpatch} \xpatchbibmacro{date+extradate}{\printtext[parens]}{\setunit{\addperiod\space}\printtext}{}{} % remove parenthesis around year in bibliography \DeclareFieldFormat{editortype}{\mkbibparens{#1}} % put editor in parenthesis when before publication year \DeclareDelimFormat{editortypedelim}{\addspace} %\renewcommand\bibnamedash{\char"2E3B\addperiod\space} % use a 3em dash with period after it for dashed author names

\begin{filecontents}[overwrite]{\jobname.bib} @book{anderson1980, AUTHOR = "Peter Anderson", TITLE = "My book", YEAR = "1980"} @book{anderson1981, AUTHOR = "Peter Anderson", TITLE = "My second book", YEAR = "1981"} @collection{anderson1982, EDITOR = "Peter Anderson", TITLE = "Interesting articles", YEAR = "1982"} @collection{smith1983, EDITOR = "Harry Smith", TITLE = "Good chapters", YEAR = "1983"} \end{filecontents} \addbibresource{\jobname.bib}

\begin{document}

\nocite{anderson1980}\nocite{anderson1981}\nocite{anderson1982}\nocite{smith1983}

\printbibliography \end{document}

The output looks fairly ok:

enter image description here

But I would like to adhere to Bringhurst's recommendation of using a three-em dash. Additionally, the dash should only replace the name, not the punctuation, so the dash should be followed by a period. Uncommenting the commented line in the MWE will then give this:

enter image description here

While the second entry here looks correct, the third does not. There should not be a period between the dash and the parenthesis (Ed.), since there was no period here to begin with, as seen in the fourth and last entry. Second, the word in the parenthesis should not have a capitalized first letter (which it receives here because of the preceding period, so it might disappear by its own once the period is removed).

In short, the third line should be --- (ed.). 1982., not ---. (Ed.). 1982. How can I achieve this without simultaneously removing the period from the second entry?

Sverre
  • 20,729

1 Answers1

2

By default the biblatex standard styles print \bibnamedash not in \printtext or any other command that respects the punctuation buffer. That makes things a bit messy here.

I suggest you modify the relevant macros to print \bibnamedash inside \printtext so that the punctuation buffer can actually be used. We also redefine these macros so that they will always print the editortypedelim/translatortypedelim punctuation. Then \printtext{\bibnamedash} behaves exactly analogous to \printnames{author} and friends in these macros. (If you want to compare the new macros to the original definitions, the relevant macros can be found in authoryear.bbx [ll. 202-268 in v3.17].)

Then it is just a matter of setting \bibnamedeash to \char"2E3B (without additional punctuation) and printing the desired nameyeardelim.

Note that I got rid of xpatch in favour of biblatex-ext's biblabeldate field format. See my answer to How to (properly) remove the parentheses around the year in authoryear style? (v3).

\documentclass{article}

\usepackage{fontspec} \setmainfont{EB Garamond}

\usepackage[style=ext-authoryear-comp]{biblatex}

\DeclareFieldFormat{biblabeldate}{#1}

\DeclareDelimFormat[bib]{nameyeardelim}{\addperiod\space}

\DeclareFieldFormat{editortype}{\mkbibparens{#1}} \DeclareDelimFormat{editortypedelim}{\addspace}

\renewcommand*\bibnamedash{\char"2E3B}

\makeatletter \renewbibmacro{author}{% \ifboolexpr{ test \ifuseauthor and not test {\ifnameundef{author}} } {\usebibmacro{bbx:dashcheck} {\printtext{\bibnamedash}} {\usebibmacro{bbx:savehash}% \printnames{author}}% \setunit{\printdelim{authortypedelim}}% \usebibmacro{authorstrg}% \setunit{\printdelim{nameyeardelim}}}% {\global\undef\bbx@lasthash \usebibmacro{labeltitle}% \setunit{\printdelim{nonameyeardelim}}}% \usebibmacro{date+extradate}}

\renewbibmacro{bbx:editor}[1]{% \ifboolexpr{ test \ifuseeditor and not test {\ifnameundef{editor}} } {\usebibmacro{bbx:dashcheck} {\printtext{\bibnamedash}} {\printnames{editor}% \usebibmacro{bbx:savehash}}% \setunit{\printdelim{editortypedelim}}% \usebibmacro{#1}% \clearname{editor}% \setunit{\printdelim{nameyeardelim}}}% {\global\undef\bbx@lasthash \usebibmacro{labeltitle}% \setunit{\printdelim{nonameyeardelim}}}% \usebibmacro{date+extradate}}

\renewbibmacro{bbx:translator}[1]{% \ifboolexpr{ test \ifusetranslator and not test {\ifnameundef{translator}} } {\usebibmacro{bbx:dashcheck} {\printtext{\bibnamedash}} {\printnames{translator}% \usebibmacro{bbx:savehash}}% \setunit{\printdelim{translatortypedelim}}% \usebibmacro{#1}% \clearname{translator}% \setunit{\printdelim{nameyeardelim}}}% {\global\undef\bbx@lasthash \usebibmacro{labeltitle}% \setunit{\printdelim{nonameyeardelim}}}% \usebibmacro{date+extradate}} \makeatother

\begin{filecontents}{\jobname.bib} @book{anderson1980, author = {Peter Anderson}, title = {My book}, year = {1980}, } @book{anderson1981, author = {Peter Anderson}, title = {My second book}, year = {1981}, } @collection{anderson1982, editor = {Peter Anderson}, title = {Interesting articles}, year = {1982}, } @collection{smith1983, editor = {Harry Smith}, title = {Good chapters}, year = {1983}, } \end{filecontents} \addbibresource{\jobname.bib}

\begin{document} Lorem \nocite{anderson1980,anderson1981,anderson1982,smith1983}

\printbibliography \end{document}

Anderson, Peter. 1980. My book.
⸻. 1981. My second book.
⸻ (ed.). 1982. Interesting articles.
Smith, Harry (ed.). 1983. Good chapters.

moewe
  • 175,683