latex参考文献给会议名和期刊名添加缩写信息 |
您所在的位置:网站首页 › 自动缩写怎么开 › latex参考文献给会议名和期刊名添加缩写信息 |
latex参考文献给会议名和期刊名添加缩写信息
前面我们介绍过在latex参考文献中将期刊名或会议名的全名替换成缩写的方法。本文我们介绍不是替换而是在原有全名的基础上加上缩写方法的。 最简单的方法是在bib文件中对应的域上把期刊名或会议名加上缩写即可。然而这种方式可能存在一个问题,就是若需求发生变化,比如要求不能添加缩写的情况下,需要再次修改bib文件。 显然我们有其它方式可以避免这种重复工作,如果我们能够把缩写信息添加到一个额外的域中,那么控制该信息的输出与否,我们可以利用格式的修改实现。即用格式的修改代替bib文件的反复修改。 主要有两种方式:一种是直接使用新域,然后修改域输出格式使输出这个新域的信息,第二种则是使用数据注解,然后也是修改域的输出格式来输出这个注解信息。 添加新域然后在修改格式中输出首先我们在bib文件中添加一个保存缩写信息的域shortbooktitle Booktitle = {Processings of Symposium on Robot Control}, shortbooktitle ={(PSRC)},然后修改相关booktitle的输出格式: \renewbibmacro*{maintitle+booktitle}{% \usebibmacro{booktitle}\iffieldundef{shortbooktitle}{}{\setunit{\addspace}\printfield{shortbooktitle}}% \newunit}这样就能够实现缩写信息的添加,当我们不需要添加该缩写信息时,那么我们把这个格式修改去掉就可以了。 代码测试: \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}, shortbooktitle ={(PSRC)}, Pages = {209-214}, Country = {Nantes France}, Year = {1997}, AUTHOR+an = {2=thesisauthor}, } @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}, shortbooktitle ={(ITIT)}, Number = {7}, Pages = {2998-3008}, Volume = {44}, Year = {1998}, AUTHOR+an = {1=thesisauthor}, } \end{filecontents*} \documentclass{ctexart} \usepackage{xcolor} \usepackage[backend=biber,style=gb7714-2015,gbfieldtype=true]{biblatex} \renewbibmacro*{maintitle+booktitle}{% \usebibmacro{booktitle}\iffieldundef{shortbooktitle}{}{\setunit{\addspace}\textcolor{red}{\printfield{shortbooktitle}}}% \newunit} \renewbibmacro*{journal+issuetitle}{\bibpubfont% \usebibmacro{journal}\iffieldundef{shortbooktitle}{}{\setunit{\addspace}\textcolor{red}{\printfield{shortbooktitle}}}% \setunit*{\addcomma\addspace}% \iffieldundef{series} {} {\newunit \printfield{series}% \setunit{\addspace}}% \usebibmacro{issue+date}% \iffieldundef{volume}{}{\setunit{\addcomma\space}}% \usebibmacro{issue}% \usebibmacro{volume+number+eid}%把卷期放到年份后面 } \addbibresource[location=local]{\jobname.bib} \begin{document} \nocite{*} \printbibliography[heading=bibliography,title=参考文献] \end{document}结果为: 仍然是在bib文件中添加信息,但不添加新的域(因为有时新的域名未定义的话可能不能被biblatex所利用),而是利用一个数据注解(数据注解的方式见前一篇博客)。比如: Booktitle = {Processings of Symposium on Robot Control}, booktitle+an={="(PSRC)"}因为是文本注释,所以注释的内容需要用双引号包围起来。 然后修改域输出的格式,比如: \renewbibmacro*{booktitle}{% \ifboolexpr{ test {\iffieldundef{booktitle}} and test {\iffieldundef{booksubtitle}} } {} {\printtext[booktitle]{\bibtitlefont% \printfield[titlecase]{booktitle}\space\getfieldannotation[booktitle]% \setunit{\subtitlepunct}% \printfield[titlecase]{booksubtitle}}% \setunit{\subtitlepunct}}% \printfield{booktitleaddon}}看到其中,我们利用\getfieldannotation获取了booktitle域的注释文本信息。 测试代码如下: \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% \printfield[titlecase]{booktitle}\space\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]{% \printfield[titlecase]{journaltitle}\space\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}结果为: 我们利用添加新域和添加原有域的数据注解的方式提供了参考文献添加期刊或会议缩写名的方法。这种方法是通用的,也可以用来添加所有可能希望添加的信息。利用格式修改的方式可以避免bib文件的反复修改。 参考 biblatex-solution-to-latex-bibliography.pdfhttps://github.com/CTeX-org/gbt7714-bibtex-style/issues/87 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |