2

I'm trying to achieve the style:

Author, Jane (2021). "Title". In Susan Editor (ed.), Volume title (Series Name #), pp. 22–50. University Press.

I'm so close, but a period appears between the Volume Title and the Series Name, and I can't figure out how to suppress it.

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{filecontents}
\begin{filecontents}{example.bib}
@inCollection{collection,
  author    = {Author, Jane},
  title     = {Title},
  pages = {22--50},
  year      = {2021},
  booktitle = {Volume title},
  editor = {Editor, Susan},
  series      = {Series Name},
  number = {\#},
  publisher = {University Press},
}
\end{filecontents}

\usepackage[
    backend=biber,
    style=authoryear-comp,
    ]{biblatex}
    
\usepackage{xpatch}

%% In Editor (ed.), Title

% change : to space for "in:"
\renewcommand*{\intitlepunct}{\space}

% Put editor string in parentheses
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}

% Order Editor (ed.)
\renewbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
    {}
    {%
     \printnames[byeditor]{editor}
     \setunit{\addspace}\usebibmacro{editor+othersstrg}
     \clearname{editor}%
     \newunit
     }%
     \setunit{\addcomma\space}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}}

% Place editor before booktitle
\renewbibmacro{in:}{
    \printtext{\bibstring{in}\intitlepunct}%
    \usebibmacro{byeditor+others}%
    \setunit{\addcomma\space}%
    \clearname{editor}
}


% Place page numbers after series name
\xpatchbibdriver{incollection}
  {\newunit\newblock
   \usebibmacro{chapter+pages}}
  {}
  {}{\typeout{failed to patch bibmacro incollection to remove page macro}}

\xpatchbibdriver{incollection}
  {\usebibmacro{series+number}}
  {\usebibmacro{series+number}
   \newunit\newblock
   \usebibmacro{chapter+pages}}
  {}{\typeout{failed to patch bibmacro incollection to re-add page macro}}
  

% Place series name in parentheses
\renewbibmacro*{series+number}{%
  \iffieldundef{series}
    {}
    {\printtext[parens]{%
     \printfield{series}%
     \setunit*{\space}%
     \printfield{number}}
     }}

\addbibresource{example.bib}

\begin{document}

\cite{collection}

\printbibliography

\end{document}

Author, Jane (2021). "Title". In Susan Editor (ed.), Volume title. (Series Name #), pp. 22–50. University Press.

1 Answer 1

3

You can reset the punctuation with \setunit. I removed inputenc and the filecontents package, they are no longer needed in a current latex.

\documentclass{article}

\begin{filecontents}[overwrite]{example.bib}
@inCollection{collection,
  author    = {Author, Jane},
  title     = {Title},
  pages = {22--50},
  year      = {2021},
  booktitle = {Volume title},
  editor = {Editor, Susan},
  series      = {Series Name},
  number = {\#},
  publisher = {University Press},
}
\end{filecontents}

\usepackage[
    backend=biber,
    style=authoryear-comp,
    ]{biblatex}

\usepackage{xpatch}

%% In Editor (ed.), Title

% change : to space for "in:"
\renewcommand*{\intitlepunct}{\space}

% Put editor string in parentheses
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}

% Order Editor (ed.)
\renewbibmacro*{byeditor+others}{%
  \ifnameundef{editor}
    {}
    {%
     \printnames[byeditor]{editor}
     \setunit{\addspace}\usebibmacro{editor+othersstrg}
     \clearname{editor}%
     \newunit
     }%
     \setunit{\addcomma\space}%
  \usebibmacro{byeditorx}%
  \usebibmacro{bytranslator+others}}

% Place editor before booktitle
\renewbibmacro{in:}{
    \printtext{\bibstring{in}\intitlepunct}%
    \usebibmacro{byeditor+others}%
    \setunit{\addcomma\space}%
    \clearname{editor}
}


% Place page numbers after series name
\xpatchbibdriver{incollection}
  {\newunit\newblock
   \usebibmacro{chapter+pages}}
  {}
  {}{\typeout{failed to patch bibmacro incollection to remove page macro}}

\xpatchbibdriver{incollection}
  {\usebibmacro{series+number}}
  {\setunit{\addspace}\usebibmacro{series+number}%<-----------
   \newunit\newblock
   \usebibmacro{chapter+pages}}
  {}{\typeout{failed to patch bibmacro incollection to re-add page macro}}



% Place series name in parentheses
\renewbibmacro*{series+number}{%
  \iffieldundef{series}
    {}
    {\printtext[parens]{%
     \printfield{series}%
     \setunit*{\space}%
     \printfield{number}}
     }}

\addbibresource{example.bib}

\begin{document}

\cite{collection}

\printbibliography

\end{document}
1
  • Thank you!! I ended up placing \setunit{\addspace} before the \printtext[parens] within \renewbibmacro*{series+number}, because I think that's where I would look if I ever wanted to change it.
    – mayhplumb
    Jul 28, 2021 at 20:48

You must log in to answer this question.

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