2

First I remove the parentheses around the year in the bibliography and add a period after the entry name with:

\usepackage{xpatch}
    \xpatchbibmacro{date+extrayear}{\printtext[parens]}{\setunit*{\addperiod\space}\printtext}{}{}

(from this answer).

Then I add a period after the dash for dashed entries with:

\renewcommand*\bibnamedash{\rule[0.48ex]{3em}{0.14ex}\addperiod\space}

This looks fine when the dashed entry is an author (see McCartney in the MWE below), but it looks wrong for dashed editors. Instead of

------. Ed. 1966. More songs I like.

It should be

------, ed. 1966. More songs I like.

In effect, the dash should only replace the repeated name, and change nothing else. How can I do this?

\documentclass{article}
\usepackage[style=authoryear-comp]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{lennon1965,
    EDITOR = "John Lennon",
    TITLE = "Old songs I like",
    YEAR = "1965"}
@book{lennon1966,
    EDITOR = "John Lennon",
    TITLE = "More old songs I like",
    YEAR = "1966"}
@book{mccartney1965,
    AUTHOR = "Paul McCartney",
    TITLE = "This is what I did yesterday",
    YEAR = "1965"}
@book{mccartney1966,
    AUTHOR = "Paul McCartney",
    TITLE = "My troubles don't seem so far away",
    YEAR = "1966"}

\end{filecontents}
\addbibresource{\jobname.bib}

\usepackage{xpatch}
    \xpatchbibmacro{date+extrayear}{\printtext[parens]}{\setunit*{\addperiod\space}\printtext}{}{} % remove parenthesis around year in bibliography
\renewcommand*\bibnamedash{\rule[0.48ex]{3em}{0.14ex}\addperiod\space} % use a 3em dash with period after it for dashed author names

\begin{document}
\nocite{*}
\printbibliography
\end{document}

enter image description here

2

Make use of biblatex's punctuation tracker.

\renewcommand*\bibnamedash{%
  \printtext{%
    \rule[0.48ex]{3em}{0.14ex}}%
  \setunit{\addcomma\space}}

That way we print the name dash and afterwards use the punctuation tracker to sort things out for us.

With

\documentclass{article}
\usepackage[style=authoryear-comp]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{lennon1965,
    EDITOR = "John Lennon",
    TITLE = "Old songs I like",
    YEAR = "1965"}
@book{lennon1966,
    EDITOR = "John Lennon",
    TITLE = "More old songs I like",
    YEAR = "1966"}
@book{mccartney1965,
    AUTHOR = "Paul McCartney",
    TITLE = "This is what I did yesterday",
    YEAR = "1965"}
@book{mccartney1966,
    AUTHOR = "Paul McCartney",
    TITLE = "My troubles don't seem so far away",
    YEAR = "1966"}

\end{filecontents}
\addbibresource{\jobname.bib}

\usepackage{xpatch}
  \xpatchbibmacro{date+extrayear}{\printtext[parens]}{\setunit*{\addperiod\space}\printtext}{}{}
\renewcommand*\bibnamedash{\printtext{\rule[0.48ex]{3em}{0.14ex}}\setunit{\addcomma\space}}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

we get

correctly-dashed bibliography

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.