抑制 \unspace 命令以强制 biblatex 添加空格(DIN 1505)

抑制 \unspace 命令以强制 biblatex 添加空格(DIN 1505)

DIN 1505 要求标点符号前有可拆分的单词间空格。参考书目条目应如下所示:

Lastname1, Firstname1 ; Lastname2, Firstname2: Title : Subtitle [...]

                                     ^                                                    ^

我尝试通过重新定义\multinamedelim\subtitlepunct命令来实现这一点。不幸的是,分别\addspace前面的不会显示在结果文件中。原因是命令删除了前面的空格。它由隐式执行。\addsemicolon\addcolon\unspace\addspace

梅威瑟:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[
style=alphabetic,
backend=biber,
]{biblatex}
\addbibresource{test.bib}

\begin{filecontents}{test.bib}
@BOOK{Author2001,
  author = {Alastname, Afirstname},
  title = {Title},
    subtitle = {Subtitle},
  year = {2001},
}
\end{filecontents}

% Setup bibliography
\DeclareNameAlias{default}{last-first}
\renewcommand*{\multinamedelim}{\addspace\addsemicolon\addspace}
\renewcommand*{\finalnamedelim}{\addspace\addsemicolon\addspace}
\renewcommand*{\multilistdelim}{\addspace\addsemicolon\addspace}
\renewcommand*{\finallistdelim}{\addspace\addsemicolon\addspace}
\renewcommand*{\labelnamepunct}{\addcolon\addspace}
\renewcommand*{\subtitlepunct}{\addspace\addcolon\addspace}
\renewcommand*{\finentrypunct}{}

\begin{document}
Filler text \cite{Author2001}

\printbibliography
\end{document}

平均能量损失

我找到了一个 DIN 1505 样式的例子(看这里)。作者\addspace用代替\mbox{ }。不幸的是 不正式支持biblatex。有人知道更好的解决方案吗?

答案1

您可以分别用普通的或替换\addsemicolon/等命令,这样就变成了。这样就不会检查标点符号前面的空格,但也不会像以前那样检查前面的标点符号。\addcolon;:\DeclareDelimFormat{multinamedelim}{\addspace\addsemicolon\addspace}\DeclareDelimFormat{multinamedelim}{\addspace;\addspace}biblatex\addsemicolon

我们还可以更深入地研究 的内部结构biblatex,并尝试定义我们自己的空间保留宏\addsp<punct>。这些宏是通过 定义的,它本质上是带有注释掉的\blx@addsppunct宏。\blx@addpunct\unspace

现在,当您不希望前面的空格消失时,可以使用\addspsemicolonand\addspcolon代替\addsemicolonand 。\addcolon

平均能量损失

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[
  style=alphabetic,
  backend=biber,
]{biblatex}

\makeatletter
% see biblatex.sty for these macros
\blx@regimcs{%
  \addspsemicolon \addspcolon \addspcomma}
\def\blx@addsppunct#1{% <---- new name for spaced punctuation
  %\unspace <----- commented out
  \ifnum\blx@spacefactor<\blx@sf@threshold@low
    \csuse{blx@qp@#1}\csuse{abx@#1}%
  \else
    \ifnum\blx@spacefactor>\blx@sf@threshold@high
      \csuse{blx@qp@#1}\csuse{abx@#1}%
    \else
      \ifcsdef{blx@pp@\the\csname blx@sf@#1\endcsname @\blx@spacefactor}
        {\csuse{blx@qp@#1}\csuse{abx@#1}}
        {\csuse{blx@qp@#1}}%
    \fi
  \fi
  \csuse{blx@pq@#1}}

\protected\def\blx@imc@addspsemicolon{\blx@addsppunct{semicolon}}
\protected\def\blx@imc@addspcolon{\blx@addsppunct{colon}}
\protected\def\blx@imc@addspcomma{\blx@addsppunct{comma}}
\makeatother

% Set up bibliography
\DeclareNameAlias{default}{family-given}

\DeclareDelimFormat{multinamedelim}{\addspace\addspsemicolon\space}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}

\DeclareDelimFormat{multilistdelim}{\addspace\addspsemicolon\space}
\DeclareDelimAlias{finallistdelim}{multilistdelim}

\DeclareDelimFormat[bib]{nametitledelim}{\addcolon\space}

\renewcommand*{\subtitlepunct}{\addspace\addspcolon\space}

\renewcommand*{\finentrypunct}{}

\addbibresource{biblatex-examples.bib}

\begin{document}
\cite{sigfridsson,worman}

\printbibliography
\end{document}

Sigfridsson, Emma ; Ryde, Ulf:“从电势和电势矩推导原子电荷的方法比较”。刊于:《计算化学杂志》19.4 (1998),第 377–395 页。doi:10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P//Worman, Nancy:《人物塑造:希腊文学风格》。奥斯汀:德克萨斯大学出版社,2002 年

编辑代码已针对biblatex3.8 及更新版本进行了现代化处理。请参阅旧版本的编辑历史。

相关内容