跟随如何让 BibLaTeX-chicago 使用标题大小写? 我将源图修改为:
<sourcemap>
<maps datatype="bibtex" map_overwrite="1">
<map>
<map_step map_field_source="TITLE"
map_match="(^|\s)(\w+\S*w*)" map_replace="$1\u\L$2"/>
<map_step map_field_source="TITLE"
map_match="\-(\w+)" map_replace="\-\u\L$1"/>
<map_step map_field_source="TITLE"
map_match="(\s+|\-)(A(|n|nd|s|t)|werden|zur|f\{\\"\{u\}\}r|die|B(ut|y)|F(or|rom)|I(n|s)|O(f|n|r)|T(he|o)|With)\b"
map_replace="$1\L$2"/>
<map_step map_field_source="TITLE"
map_match="([:;]\s+)([a-z])" map_replace="$1\u$2"/>
</map>
</maps>
</sourcemap>
为了获得非英语(即德语)正确格式的参考资料:
@misc{AdrianLobe2016,
author = {{A. Lobe}},
title = {{Social-Media-Daten werden zur Ampel f{\"{u}}r die Kreditw{\"{u}}rdigkeit}},
url = {http://mobil.derstandard.at/2000042297313/Social-Media-Daten-werden-zur-Ampel-fuer-die-Kreditwuerdigkeit},
urldate = {2016-08-05},
year = {2016}
}
正如https://regex101.com/r/RwzhFT/1正则表达式应该匹配,但连接词没有小写,并且呈现为:
Social-Media-Daten Werden Zur Ampel Für Die Kreditwürdigkeit
另外,我想对字段应用相同的预处理JOURNAL
,但是它没有被选中。
编辑
这是一个完整的示例:
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{biber.conf}
<?xml version="1.0" encoding="UTF-8"?>
<config>
<sourcemap>
<maps datatype="bibtex" map_overwrite="1">
<map>
<map_step map_field_source="TITLE"
map_match="(^|\s)(\w+\S*w*)" map_replace="$1\u\L$2"/>
<map_step map_field_source="TITLE"
map_match="\-(\w+)" map_replace="\-\u\L$1"/>
<map_step map_field_source="TITLE"
map_match="(\s+|\-)(A(|n|nd|s|t)|werden|zur|f\{\\"\{u\}\}r|die|B(ut|y)|F(or|rom)|I(n|s)|O(f|n|r)|T(he|o)|With)\b"
map_replace="$1\L$2"/>
<map_step map_field_source="TITLE"
map_match="([:;]\s+)([a-z])" map_replace="$1\u$2"/>
</map>
</maps>
</sourcemap>
</config>
\end{filecontents*}
\begin{filecontents*}{\jobname.bib}
@misc{AdrianLobe2016,
author = {{A. Lobe}},
title = {{Social-Media-Daten werden zur Ampel f{\"{u}}r die Kreditw{\"{u}}rdigkeit}},
url = {http://mobil.derstandard.at/2000042297313/Social-Media-Daten-werden-zur-Ampel-fuer-die-Kreditwuerdigkeit},
urldate = {2016-08-05},
year = {2016}
}
@BOOK{Smith2003,
title = {This is an off-the-hook book title, but it doesn't have a subtitle},
publisher = {Penguin},
year = {2003},
author = {Smith, James},
address = {London}}
@ARTICLE{Doe1970,
author = {H{\"a}user, {\O}rnulf},
title = {{\O}rnulf H{\"a}user's letter to the editor: an $\alpha$-to-$\omega$
summary of $\epsilon$--improvement},
journal = {Great Journal},
year = {1970},
volume = {40},
pages = {207-234}}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
答案1
这是一个部分答案,但也许有用。
我无法按原样编译您的代码(biber 出现错误,它实际上运行顺利吗?),但我无法识别您的正则表达式中“für”的问题。
此外,您提到的 Audrey 答案中的正则表达式已将首字母大写,并将其替换为小写。
因此,如果您使用(请注意大写的首字母):
map_match="(\s+|\-)(A(|n|nd|s|t)|Werden|Zur|Die|B(ut|y)|F(or|rom)|I(n|s)|O(f|n|r)|T(he|o)|With)\b"
你得到:
除“Für”外,所有内容均按预期呈现。我不知道如何为此编写正则表达式,它不会给我 biber 错误。
但是,如果您愿意在 bibentry 的标题中使用\usepackage[utf8]{inputenc}
andfür
代替,那么:f{\"{u}}r
map_match="(\s+|\-)(A(|n|nd|s|t)|Werden|Zur|Für|Die|B(ut|y)|F(or|rom)|I(n|s)|O(f|n|r)|T(he|o)|With)\b"
完成了工作。但也许有人比我更擅长正则表达式,可以进一步阐明“für”的情况。
对于期刊案例,您可以复制源映射条目,用“TITLE”代替“JOURNAL”。
更新:这是一个完整的 MWE,假设[utf8]{inputenc}
情况如下:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{biber.conf}
<?xml version="1.0" encoding="UTF-8"?>
<config>
<sourcemap>
<maps datatype="bibtex" map_overwrite="1">
<map>
<map_step map_field_source="TITLE"
map_match="(^|\s)(\w+\S*w*)" map_replace="$1\u\L$2"/>
<map_step map_field_source="TITLE"
map_match="\-(\w+)" map_replace="\-\u\L$1"/>
<map_step map_field_source="TITLE"
map_match="(\s+|\-)(A(|n|nd|s|t)|Werden|Zur|Für|Die|B(ut|y)|F(or|rom)|I(n|s)|O(f|n|r)|T(he|o)|With)\b"
map_replace="$1\L$2"/>
<map_step map_field_source="TITLE"
map_match="([:;]\s+)([a-z])" map_replace="$1\u$2"/>
<map_step map_field_source="JOURNAL"
map_match="(^|\s)(\w+\S*w*)" map_replace="$1\u\L$2"/>
<map_step map_field_source="JOURNAL"
map_match="\-(\w+)" map_replace="\-\u\L$1"/>
<map_step map_field_source="JOURNAL"
map_match="(\s+|\-)(A(|n|nd|s|t)|Werden|Zur|Für|Die|B(ut|y)|F(or|rom)|I(n|s)|O(f|n|r)|T(he|o)|With)\b"
map_replace="$1\L$2"/>
<map_step map_field_source="JOURNAL"
map_match="([:;]\s+)([a-z])" map_replace="$1\u$2"/>
</map>
</maps>
</sourcemap>
</config>
\end{filecontents*}
\begin{filecontents*}{\jobname.bib}
@misc{AdrianLobe2016,
author = {{A. Lobe}},
title = {{Social-Media-Daten Werden Zur Ampel Für Die Kreditw{\"{u}}rdigkeit}},
url = {http://mobil.derstandard.at/2000042297313/Social-Media-Daten-werden-zur-Ampel-fuer-die-Kreditwuerdigkeit},
urldate = {2016-08-05},
year = {2016}
}
@BOOK{Smith2003,
title = {This is an off-the-hook book title, but it doesn't have a subtitle},
publisher = {Penguin},
year = {2003},
author = {Smith, James},
address = {London}}
@ARTICLE{Doe1970,
author = {H{\"a}user, {\O}rnulf},
title = {{\O}rnulf H{\"a}user's letter to the editor: an $\alpha$-to-$\omega$
summary of $\epsilon$--improvement},
journal = {Great Die Journal},
year = {1970},
volume = {40},
pages = {207-234}}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}