biblatex中参考文献期刊名缩写的实现
可以存在非常多的实现方法,这里介绍7种常用的方法:
对于下面这样的一个文献:
@article{Chen1990a,
author = {Chen, S. and Billing, S. A. and Cowan, C. F. and others},
title = {Practical identification of MARMAX models},
journal = {Int Journal of Control},
year = {1990},
volume = {52},
number={6},
pages = {1327-1350},
}
假设其中期刊Int Journal of Control的缩写名为Int J Control,那么可以采用如下方法实现:
一、首先是域内容替换的方法:
1. 使用jabref等工具软件替换
首先可以利用jabref维护一个期刊缩写的列表,接口在菜单:选项下的管理期刊缩写,
使得Int Journal of Control对应缩写名为Int J Control
接着选择需要转换的参考文献条目,然后利用菜单:工具下的缩写期刊名选项进行替换
2. 使用其他工具,比如写一个脚本来对bib文件的期刊内容进行替换
比如使用biblatex-map.PY工具
在py文件中设置
sourcemaps=[#maps
[#map1:根据标题的字符编码范围确定标题的语言类型
[{"fieldsource":"journal","match":r'Int Journal of Control',"final":True}],#step1
[{"fieldset":"journal","fieldvalue":r'Int J Control'}]#step2
],
]
然后设置输入bib文件为需要修改的bib文件,接着运行该py脚本。
3. 在bib文件中利用string进行替换
修改bib文件内容为:
%@string{CHENJOURNAL="Int Journal of Control"}
@string{CHENJOURNAL="Int J Control"}
@article{Chen1990a,
author = {Chen, S. and Billing, S. A. and Cowan, C. F. and others},
title = {Practical identification of MARMAX models},
journal = CHENJOURNAL,
year = {1990},
volume = {52},
number={6},
pages = {1327-1350},
}
4. 在bib文件中直接手动修改域内容进行替换
这就是最笨的方法,手动将bib文件中的Int Journal of Control更改为Int J Control。
二、接着介绍不进行域内容替换的方法:
1. 利用biblatex的动态数据修改
在导言区增加:
\DeclareStyleSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=journal,match={Int Journal of Control},final]%当存在booktitle域是映射为inbook
\step[fieldset=journal,fieldvalue={Int J Control}]
}
}
}
2. 增加shortjournal域结合期刊域输出的设置
条目内容更改为:
@article{Chen1990a,
author = {Chen, S. and Billing, S. A. and Cowan, C. F. and others},
title = {Practical identification of MARMAX models},
journal = {Int Journal of Control},
shortjournal={Int J Control},
year = {1990},
volume = {52},
number={6},
pages = {1327-1350},
}
期刊名域输出格式修改为:
\renewbibmacro*{journal}{%
\iffieldundef{shortjournal}
{\ifboolexpr{
test {\iffieldundef{journaltitle}}
and
test {\iffieldundef{journalsubtitle}}
}%
{}%
{\printtext[journaltitle]{%
\printfield[titlecase]{journaltitle}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{journalsubtitle}}%
}%
}%
{\printtext[journaltitle]{%
\printfield[titlecase]{shortjournal}}%
}%
}
3. 增加shortjournal域结合域的临时保持和恢复
条目内容更改为:
@article{Chen1990a,
author = {Chen, S. and Billing, S. A. and Cowan, C. F. and others},
title = {Practical identification of MARMAX models},
journal = {Int Journal of Control},
shortjournal={Int J Control},
year = {1990},
volume = {52},
number={6},
pages = {1327-1350},
}
在导言区增加,如下设置:
%在输出文献表时使用钩子
\AtEveryBibitem{
\savefield{shortjournal}{\temptitle}%
\restorefield{journaltitle}{\temptitle}%
}
后两种的示例测试见:biblatex 简明使用手册
4. 增加journaltitle+an数据注解来实现替换
数据注解方式是另一中能实现的方式,对于journaltitle域来说,可以增加一个journaltitle+an域作注解注解,其中采用提供“可用文本”的方式为journaltitle提供缩写,然后修改journaltitle输出宏实现替换。
具体为:
\begin{filecontents*}{\jobname.bib}
@Inproceedings{Nemec1997-209-214,
Title = {Force control of redundant robots},
Author = {B Nemec and Zhao, Mou Mou},
Booktitle = {Processings of Symposium on Robot Control},
Pages = {209-214},
Country = {Nantes France},
Year = {1997},
AUTHOR+an = {2=thesisauthor},
booktitle+an={="PSRC"}
}
@Article{Chiani1998-2998-3008,
Title = {Error probability for block codes over channels with block interference},
Author = {Zhao, Mou Mou and Chiani, M.},
Journal = {IEEE Trans. Inf. Theory},
Number = {7},
Pages = {2998-3008},
Volume = {44},
Year = {1998},
AUTHOR+an = {1=thesisauthor},
journaltitle+an={="ITIT"}
}
\end{filecontents*}
\documentclass{ctexart}
\usepackage{xcolor}
\usepackage[style=gb7714-2015ay]{biblatex}
\makeatletter
\renewbibmacro*{booktitle}{%
\ifboolexpr{
test {\iffieldundef{booktitle}}
and
test {\iffieldundef{booksubtitle}}
}
{}
{\printtext[booktitle]{\bibtitlefont%
\textcolor{red}{\getfieldannotation[booktitle]}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{booksubtitle}}%
\setunit{\subtitlepunct}}%
\printfield{booktitleaddon}}
\newbibmacro*{journal}{%
\ifboolexpr{
test {\iffieldundef{journaltitle}}
and
test {\iffieldundef{journalsubtitle}}
}
{}
{\printtext[journaltitle]{%
\textcolor{red}{\getfieldannotation[journaltitle]}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{journalsubtitle}}%
\newunit}%
\iffieldundef{journaltitleaddon}
{}
{\printfield{journaltitleaddon}}}
\makeatother
\addbibresource{\jobname.bib}
\begin{document}
\cite{Nemec1997-209-214,Chiani1998-2998-3008}
\printbibliography
\end{document}
结果为:
注意其中,期刊 IEEE Trans. Inf. Theory 被替换为了 ITIT。
总结:
从实践看采用jabref这种工具是最便捷的方法,当然增加shortjournal或者数据注解的方法在有更多格式定制要求时会是更好的选择。