# biblatex remove space after serie in reference [duplicate]

I´m creating a new bibliography style by customizing the standard.bbx file for my master thesis. So far I had no big troubles but now I want to adjust the macro series number since this should be in parentheses. Due to the lack of information I somtimes only have a seriesor the number.

So far it works out well, unless I only have the series. Then a space between the last word of the series and the closing parentheses appeares.

Here is my new macro

\newbibmacro*{series+number}{%
\iffieldundef{series}% Überprüfen ob series vorhanden
{}
\printfield{series}
\iffieldundef{number} % Überprüfen ob noch Bd kommt
{\printtext{\bibcloseparen}}
}%
\iffieldundef{number}%
{}
{   \iffieldundef{series}%
{}
\printfield{number}%
\printtext{\bibcloseparen\space}
}
\newunit}


And here is the MWE

\RequirePackage{filecontents}

\begin{filecontents*}{my_bibfile.bib}
@incollection{Akyar.2008,
author = {Akyar, Bedia},
title = {Dual Quaternions in Spatial Kinematics in an Algebraic Sense},
pages = {373--391},
bookpagination = {page},
publisher = {T{\"u}bitak},
isbn = {1010-7622},
editor = {{Scientific and Technological Research Council of Turkey}},
booktitle = {Turkish journal of mathematics},
year = {2008},
abstract = {},
shorthand = {AKYA08},
location = {Ankara},
edition = {32},
number = {4}
}

@book{Angeles.2007,
author = {Angeles, Jorge},
year = {2007},
title = {Fundamentals of Robotic Mechanical Systems},
url = {http://site.ebrary.com/lib/alltitles/docDetail.action?docID=10229254},
edition = {Third Edition},
publisher = {{Springer Science+Business Media LLC}},
isbn = {0-387-29412-0},
subtitle = {Theory, Methods, and Algorithms},
shorthand = {ANGE07},
language = {eng},
location = {Boston, MA, USA},
series = {Mechanical Engineering Series},
abstract = {},
doi = {10.1007/978-0-387-34580-2},
file = {http://gso.gbv.de/DB=2.1/PPNSET?PPN=546653987},
file = {http://zbmath.org/?q=an:1140.70001}
}
\end{filecontents*}

\documentclass[fleqn]{scrreprt}

\usepackage[scaled]{helvet}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[T1]{fontenc}

\usepackage[utf8]{inputenc}

\usepackage[style=alphabetic, % Use this style
isbn=false,
doi=false,
url=false,
maxbibnames = 4,
minbibnames = 3,
language = ngerman,
giveninits=true]{biblatex}

\bibliography{my_bibfile}

\begin{document}

\nocite{*}

\printbibliography

\end{document}


The first reference only has a number (Here (Bd. 4)). The second has a series. But bevor the closing parentheses there is a unnecessary spacing.

• Lars, I think a look at the question I just linked to might be useful to you. – gusbrs Feb 11 '18 at 16:10
• Ah thanks! I didn´t think about them so far. I also might think about the bibstrings when I have time. I just started with the bibliography this weekend. Since you mentioned to use renewbibmacro I have a question about it in general. I also change some of the order and punctuation and want to create a new style. So I thouht of copy the standard file and adjust what I need so. I also read about to put it in the preamble. But for me this seems that I will kind of 'overload' it with the changes. – Lars Feb 11 '18 at 19:13
• Well, that would be a new question altogether. But we do have here on the site a very good answer regarding Guidelines for customizing biblatex styles. That should provide you with a sound starting point. – gusbrs Feb 11 '18 at 19:21
• Ah ok. This I already read. I also started with reading the documentation of biblatex or at least the parts concering me. And when I couldn´t come up with a solution by myself this forum was a great so far. – Lars Feb 11 '18 at 19:27

You forgot an all too important % after \printfield{series}. Adding it to your macro, eliminates the unwanted space:

\renewbibmacro*{series+number}{%
\iffieldundef{series}% Überprüfen ob series vorhanden
{}
\printfield{series}% <- here
\iffieldundef{number} % Überprüfen ob noch Bd kommt
{\printtext{\bibcloseparen}}
}%
\iffieldundef{number}%
{}
{   \iffieldundef{series}%
{}
\printfield{number}%
\printtext{\bibcloseparen\space}
}
\newunit}


The above version emphasizes the point in which your unwanted space is being generated. But, as a matter of fact, your code has other instances of potential unwanted spaces. The version below is where I'd put trailing % to avoid unwanted spaces in your macro:

\renewbibmacro*{series+number}{%
\iffieldundef{series} % Überprüfen ob series vorhanden
{}
\printfield{series}%
\iffieldundef{number} % Überprüfen ob noch Bd kommt
{\printtext{\bibcloseparen}}
}%
\iffieldundef{number}
{}
{\iffieldundef{series}
{}%
\printfield{number}%
\printtext{\bibcloseparen\space}%
}%
\newunit}


I must add that it might be frowned upon that the strings "Reihe" and "Bd" are hard coded to your macro as this. Biblatex offers localized bibstrings, which are also expansible, for that. Also, to redefine an existing macro, you should rather go with \renewbibmacro.