在 @moewe 给出最后一个修复建议后给出卷标题时逗号太多我真的以为就是这样了,然而却出现了新的有趣的bibtex
效果jurabib
。
请比较新的 MWE:
\documentclass[]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{filecontents}
\usepackage[]{jurabib}
\renewcommand*{\bibatsep}{,}
\makeatletter
\renewcommand*{\incolledformat}[5]{%
\bibBTsep{} %
\ifjb@edby
#3%
\ifx\relax#1\relax
\ifx\relax#5\relax\else
\ifx\relax#4\relax
\bibatsep{}%
\else
\bibatsep{}\space%
\fi
\fi
\else
\ifx\relax#5\relax
\ifjb@humanbst@loaded\edbysep{}\fi
\unskip\unskip\unskip\unskip\unskip\unskip\space\Edbyname{} %
\else
\edbysep{}%
\Edbyname{} %
\fi
\begingroup
#1%
\endgroup
\fi
\ifx\relax#4\relax\else
\ifx\relax#1\relax\else
\ifx\relax#5\relax
.\space%
\else
\bibatsep{} %
\fi
\fi
\Volumename~#4%
\fi
\ifx\relax#1\relax
\ifx\relax#4\relax\else.\fi % volume empty
\else
\ifjb@humanbst@loaded\else
\ifjbchicago\else.\fi
\fi
\fi
\else
\ifx\relax#1\relax\else
\begingroup
#1 % editor
\endgroup
\ifx\relax#2\relax\else#2\fi
\bothaesep %
\fi
#3%
\ifx\relax#4\relax
% START https://tex.stackexchange.com/q/522721/35864
\ifx\relax#1\relax
\ifx\relax#5\relax
\unskip\bibatsep{}
\fi
\fi
% END https://tex.stackexchange.com/q/522721/35864
\else
\unskip %<------ new https://tex.stackexchange.com/q/450988/35864
\ifx\relax#5\relax\space\else,\space\fi% volume and booktitleaddon
\volumeformat{#4}%
\fi
\fi
}
\makeatother
\begin{filecontents}{\jobname.bib}
@INCOLLECTION{Althoff_Freiwilligkeit,
author = {Gerd Althoff},
title = {Freiwilligkeit und Konsensfassaden. Emotionale Ausdrucksformen in der Politik des Mittelalters},
booktitle = {Pathos, Effekt, Gef\"uhl},
pages = {S.\,145\,--\,161},
year = {2004},
address = {Berlin},
howcited = {1},
shorttitle = {Freiwilligkeit und Konsensfassaden}
}
@INCOLLECTION{Lehnswesen,
author = {Oliver Auge},
title = {Lehnrecht, Lehnswesen},
booktitle = {Hand\-w\"orterbuch zur Deutschen Rechtsgeschichte},
pages = {Sp.\,717\,--\,736},
year = {2016},
editor = {Albrecht Cordes and Hans-Peter Haferkamp and Heiner L\"uck and Dieter Werkm\"uller},
volume = {III},
address = {Berlin},
shorttitle = {Lehnrecht, Lehnswesen in: HRG~III, 2.\,Auflage},
volumetitle = {Konfliktbew\"altigung\,--\,Nowgorod}
}
@INCOLLECTION{Huepper_PF,
author = {Dagmar H\"upper and Elvira Topalovic and Stephan Elspa\ss{}},
title = {Zur Entstehung und Entwicklung von Paarformeln im Deutschen},
shorttitle = {Paarformeln},
booktitle = {Phraseologie in Raum und Zeit},
editor = {Elisabeth Piirainen and Ilpo Tapani Piirainen},
year = {2002},
pages = {S.\,77\,--\,99},
address = {Baltmannsweiler}
}
@INCOLLECTION{Roedel_Kg_Ruprecht,
howcited = {1},
author = {Ute R\"odel},
title = {K\"onig Ruprecht (1400\,--\,1410) als Richter und Schlichter},
shorttitle = {K\"onig Ruprecht},
booktitle = {Mit Freundschaft oder mit Recht?},
editor = {Albrecht Cordes},
year = {2015},
pages = {S.\,41\,--\,83},
address = {K\"oln}
}
\end{filecontents}
\begin{document}
Test\footcite{Althoff_Freiwilligkeit,Lehnswesen,Huepper_PF,Roedel_Kg_Ruprecht}.
\bibliography{\jobname}
\bibliographystyle{jurabib}
\end{document}
输出
您会发现,如果书名的最后一个字符是问号,逗号将再次被省略。简单的booktitle = {Mit Freundschaft oder mit Recht?\relax},
方法就可以解决问题,但我认为 bibtex 或 jurabib 应该能够处理书名中的标准字符,对吗?
答案1
这是预期的行为,并且jurabib
做了相当多的工作来确保在.
,!
和之后的逗号被抑制?
。
特别是jurabib.bst
包含
FUNCTION {check.punct.instead.of.add.period.incoll}
{ duplicate$
get.final.nonrightbrace.char
duplicate$ "." = swap$
duplicate$ "!" = swap$
"?" = or or
{ "} " * }
{ type$ "incollection" = booktitle empty$ not and volume empty$ and editor empty$ and booktitleaddon empty$ and
{ "} " * }
{ "}\bibatsep {} " * }
if$
}
if$
}
尽管我不确切知道所有涉及的函数的作用,但可以猜测,这段代码试图检查中的最后一个字符是否为booktitle
,.
或!
,?
并且在这种情况下\bibatsep {}
(产生逗号)被抑制。
如果您不想这样做,删除此功能的最佳方法是修改文件,.bst
使之不执行此类测试。实际上,此测试有三种情况,必须全部删除。
刚刚展示的函数将简化为
FUNCTION {check.punct.instead.of.add.period.incoll}
{ type$ "incollection" = booktitle empty$ not and volume empty$ and editor empty$ and booktitleaddon empty$ and
{ "} " * }
{ "}\bibatsep {} " * }
if$
}
类似的事情也会发生在check.punct.instead.of.add.period
和中这个习语的其他出现的地方check.punct.instead.of.add.period.art
。
由于修改过程繁琐,我已将修改后的文件上传至https://gist.github.com/moewew/8dccdc76c6897b38c06b97f046a7943b。
diff
原文全文jurabib.bst
如下:
--- jurabib.bst 2009-03-24 11:00:31.000000000 +0100
+++ jurabib-allowdoublepunctuation.bst 2020-01-06 20:48:06.139082800 +0100
@@ -1,3 +1,13 @@
+%%%% `jurabib-allowdoublepunctuation.bst'
+%%%% 2020-01-06 MW
+%%%% https://tex.stackexchange.com/q/523082/35864
+%%%% allow comma after `.', `!' and `?'
+%%%% `jurabib.bst' actively suppresses these combinations,
+%%%% this modification removes the code for that
+%%%% changes to
+%%%% check.punct.instead.of.add.period
+%%%% check.punct.instead.of.add.period.art
+%%%% check.punct.instead.of.add.period.incoll
%%
%% This is file `jurabib.bst',
%% generated with the docstrip utility.
@@ -689,59 +699,37 @@
FUNCTION {check.punct.instead.of.add.period}
-{ duplicate$
- get.final.nonrightbrace.char
- duplicate$ "." = swap$
- duplicate$ "!" = swap$
- "?" = or or
- { "} " * }
- { "}\bibatsep {} " * }
- if$
+{
+ "}\bibatsep {} " *
}
FUNCTION {check.punct.instead.of.add.period.art}
-{ duplicate$
- get.final.nonrightbrace.char
- duplicate$ "." = swap$
- duplicate$ "!" = swap$
- "?" = or or
+{ pages empty$ note empty$ url empty$ and and
{ "} " * }
- { pages empty$ note empty$ url empty$ and and
- { "} " * }
- { volume empty$
- { pages empty$
- { "}\ajtsep {} " * }
- { crossref missing$
- { month empty$
- { "}\ajtsep {} " * }
- { "}\ajtsep " * }
- if$
- }
- { "}\ajtsep " * }
- if$
- }
- if$
- }
- { "}\ajtsep {} " * }
- if$
- }
- if$
+ { volume empty$
+ { pages empty$
+ { "}\ajtsep {} " * }
+ { crossref missing$
+ { month empty$
+ { "}\ajtsep {} " * }
+ { "}\ajtsep " * }
+ if$
+ }
+ { "}\ajtsep " * }
+ if$
+ }
+ if$
+ }
+ { "}\ajtsep {} " * }
+ if$
}
if$
}
FUNCTION {check.punct.instead.of.add.period.incoll}
-{ duplicate$
- get.final.nonrightbrace.char
- duplicate$ "." = swap$
- duplicate$ "!" = swap$
- "?" = or or
- { "} " * }
- { type$ "incollection" = booktitle empty$ not and volume empty$ and editor empty$ and booktitleaddon empty$ and
- { "} " * }
- { "}\bibatsep {} " * }
- if$
- }
+{ type$ "incollection" = booktitle empty$ not and volume empty$ and editor empty$ and booktitleaddon empty$ and
+ { "} " * }
+ { "}\bibatsep {} " * }
if$
}
如果您不想修改文件.bst
,我猜解决这个问题的最快方法确实是按照\relax
您在问题中所建议的那样。
booktitle = {Mit Freundschaft oder mit Recht?\relax},
?
不再是字符串中的最后一个字符(模括号),因此测试将产生错误并且jurabib
不会检测到?
。
类似的替代方案是
booktitle = {Mit Freundschaft oder mit Recht?{}},
请注意不是帮助保护?
带有括号的或整个标题(如booktitle = {Mit Freundschaft oder mit Recht{?}},
或类似),因为jurabib
在查看字符串之前会删除所有右括号。