我正在透過為我的碩士論文自訂 standard.bbx 檔案來創建新的參考書目樣式。到目前為止我沒有遇到大麻煩,但現在我想調整巨集系列號,因為它應該在括號中。由於缺乏信息,我有時只有系列或編號。
到目前為止,效果很好,除非我只有這個系列。然後該系列的最後一個單字和右括號之間出現一個空格。
這是我的新宏
\newbibmacro*{series+number}{%
\iffieldundef{series}% Überprüfen ob series vorhanden
{}
{ \setunit{\addspace\bibopenparen}
\printtext{Reihe \addcolon\space}%
\printfield{series}
\iffieldundef{number} % Überprüfen ob noch Bd kommt
{\printtext{\bibcloseparen}}
{\setunit{\addcomma\space}}
}%
\iffieldundef{number}%
{}
{ \iffieldundef{series}%
{\setunit{\addspace\bibopenparen}}
{}
\printtext{Bd \adddot}
\printfield{number}%
\printtext{\bibcloseparen\space}
}
\newunit}
這是 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://external.dandelon.com/download/attachments/dandelon/ids/DEAGI363052149B0CFDDDC125715B0045ACDA.pdf},
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}
第一個參考文獻只有一個編號(此處(Bd.4))。第二個有一個系列。但在右括號之前有一個不必要的空格。
答案1
你忘記了一個很重要的%
事後\printfield{series}
。將其添加到巨集中,消除不需要的空間:
\renewbibmacro*{series+number}{%
\iffieldundef{series}% Überprüfen ob series vorhanden
{}
{ \setunit{\addspace\bibopenparen}
\printtext{Reihe \addcolon\space}%
\printfield{series}% <- here
\iffieldundef{number} % Überprüfen ob noch Bd kommt
{\printtext{\bibcloseparen}}
{\setunit{\addcomma\space}}
}%
\iffieldundef{number}%
{}
{ \iffieldundef{series}%
{\setunit{\addspace\bibopenparen}}
{}
\printtext{Bd \adddot}
\printfield{number}%
\printtext{\bibcloseparen\space}
}
\newunit}
上面的版本強調了產生不需要的空間的點。但是,事實上,您的程式碼還有其他潛在不必要的空格實例。下面的版本是我放置尾隨的地方,%
以避免巨集中出現不必要的空格:
\renewbibmacro*{series+number}{%
\iffieldundef{series} % Überprüfen ob series vorhanden
{}
{\setunit{\addspace\bibopenparen}%
\printtext{Reihe\addcolon\space}%
\printfield{series}%
\iffieldundef{number} % Überprüfen ob noch Bd kommt
{\printtext{\bibcloseparen}}
{\setunit{\addcomma\space}}%
}%
\iffieldundef{number}
{}
{\iffieldundef{series}
{\setunit{\addspace\bibopenparen}}
{}%
\printtext{Bd\adddot}%
\printfield{number}%
\printtext{\bibcloseparen\space}%
}%
\newunit}
我必須補充一點,字串“Reihe”和“Bd”被硬編碼到您的巨集中,這可能會讓人皺眉。 Biblatex 為此提供了本地化的 bibstring,它也是可擴展的。另外,要重新定義現有宏,您應該選擇\renewbibmacro
.