我使用 Zotero 从网络上获取参考文献,然后使用以下biblatex
格式将其导出到 LaTeX这工作流程。
我对如下所示的参考书目及其输出的样式很满意,但现在我想使用相同的样式切换到短期刊名称,因为它们是在 Zotero 导出的数据库中提供的。我确保所有参考文献在 Zotero 数据库中都有一个短期刊名称,但如果代码在其他情况下可以恢复为长名称,那就太好了(虽然在参考书目列表中同时包含这两个名称并不优雅,但作为最后的手段,这个问题可以在以后从 Zotero 内部修复)。我检查了这一点邮政,但却没能达到我的目标。
如果有人能提出比编写所有这些代码更好的方法来实现相同或类似的风格,我也会非常感激。我的大学对博士论文书目没有具体规定。
我的问题是:
- 如何在以下情况下显示简短的期刊名称可用的?
- 如何实现相同的输出(见下文),但使用较短的期刊名称并编写较少的代码?
- 我在 BibLaTeX 手册中找不到该
chem-acs
样式的解释,这种样式包含什么?
MWE 代码
\documentclass{scrartcl}
\usepackage[backend=biber,style=chem-acs,terseinits=true,sorting=none,isbn=false,doi=false,backref=true]{biblatex} \renewcommand*{\bibfont}{\small} % smaller font for bibliography list
\ExecuteBibliographyOptions{%
citetracker=true,
sorting=none,
alldates=long,
articletitle=true,
maxcitenames=1
}
% remove brackets around the number of each bibliography entry
\DeclareFieldFormat{labelnumberwidth}{#1\addperiod}
% Suppress article title, doi, url, etc. in citations
\AtEveryCitekey{%
\ifentrytype{article}
{\clearfield{title}}
{}%
\clearfield{doi}%
\clearfield{url}%
\clearlist{publisher}%
\clearlist{location}%
\clearfield{note}%
}
% Print year instead of date, when available; make use of urldate
\DeclareFieldFormat{urldate}{\bibstring{urlseen}\space#1}
\renewbibmacro*{date}{% Based on date bib macro from chem-acs.bbx
\iffieldundef{year}
{\ifentrytype{online}
{\printtext[urldate]{\printurldate}}
{\printtext[date]{\printdate}}}
{\printfield[date]{year}}}
% Remove period from titles
\DeclareFieldFormat*{title}{#1}
\DeclareFieldFormat[book]{date}{\textbf{#1}} %
\DeclareFieldFormat[report]{date}{\textbf{#1}} %
\DeclareFieldFormat[software]{date}{\textbf{#1}} %
\DeclareFieldFormat[inproceedings]{date}{\textbf{#1}} %
% Embed doi and url in titles, when available
\renewbibmacro*{title}{% Based on title bib macro from biblatex.def
\ifboolexpr{ test {\iffieldundef{title}}
and test {\iffieldundef{subtitle}} }
{}
{\ifboolexpr{ test {\ifhyperref}
and not test {\iffieldundef{doi}} }
{\href{http://dx.doi.org/\thefield{doi}}
{\printtext[title]{%
\printfield[titlecase]{title}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}}}}
{\ifboolexpr{ test {\ifhyperref}
and not test {\iffieldundef{url}} }
{\href{\thefield{url}}
{\printtext[title]{%
\printfield[titlecase]{title}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}}}}
{\printtext[title]{%
\printfield[titlecase]{title}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}}}}%
\newunit}%
\printfield{titleaddon}%
\clearfield{doi}%
\clearfield{url}%
\clearlist{language}%
\clearfield{note}%
\ifentrytype{article}% Delimit article and journal titles with a period
{\adddot}
{}}
\renewbibmacro*{name:andothers}{% Based on name:andothers from biblatex.def
\ifboolexpr{
test {\ifnumequal{\value{listcount}}{\value{liststop}}}
and
test \ifmorenames
}
{\ifnumgreater{\value{liststop}}{1}
{\finalandcomma}
{}%
\andothersdelim\bibstring[\emph]{andothers}}
{}}
\usepackage{filecontents}
\begin{filecontents}{jobname.bib}
@article{rand_objective_1971,
title = {Objective criteria for the evaluation of clustering methods},
volume = {66},
issn = {01621459},
url = {http://www.jstor.org/discover/10.2307/2284239?uid=3737864&uid=2&uid=4&sid=21103234673533},
doi = {10.2307/2284239},
pages = {846},
number = {336},
journaltitle = {Journal of the American Statistical Association},
shortjournal = {J Amer Statist Assoc},
author = {Rand, William M.},
urldate = {2013-12-18},
date = {1971-12},
keywords = {Comparing partitions, Rand, statistics}
}
@article{hubert_comparing_1985,
title = {Comparing partitions},
volume = {2},
issn = {0176-4268, 1432-1343},
url = {http://link.springer.com/article/10.1007/BF01908075},
doi = {10.1007/BF01908075},
pages = {193-218},
number = {1},
journaltitle = {Journal of Classification},
shortjournal = {J Classif},
author = {Hubert, Lawrence and Arabie, Phipps},
urldate = {2013-12-18},
date = {1985-12-01},
langid = {english},
keywords = {{ARI}, Comparing partitions, Consensus indices, Measures of agreement, Measures of association, statistics, Statistics, general}
}
\end{filecontents}
\addbibresource{jobname.bib}
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{ %
colorlinks, linkcolor={magenta},
citecolor={black}, urlcolor={blue}
}
\begin{document}
This is the main text citing~\parencite{hubert_comparing_1985} and~\parencite{rand_objective_1971}
\printbibliography[title={References}]
\end{document}
MWE 输出
答案1
您可以使用 Biber 源映射功能将数据从一个字段传输到另一个字段:
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{ % Notice the overwrite: replace one field with another
\step[fieldsource=shortjournal,fieldtarget=journaltitle]
}
}
}
例如在 biblatex 中 \DeclareSourcemap有关此功能的更多信息。映射仅在源可用时才适用,因此对于没有简称的情况,这是“安全的”。
答案2
作为约瑟夫·赖特在他的评论中指出,使用 的可接受答案DeclareSourcemap
似乎不再适用于较新版本的 biblatex。(如果有人可以让它工作,请在该评论线程中回复。)
反而,biblatex Github 存储库上的此评论建议结合使用 biblatexDeclareFieldInputHandler
和单独的包贾布夫自动生成缩写的期刊标题:
\usepackage{jabbrv}
\DeclareFieldInputHandler{journaltitle}{%
\def\NewValue{\JournalTitle{#1}}}
至少,您需要从上面链接的 jabbrv 存储库下载文件 jabbrv.sty、jabbrv-ltwa-all.ldf 和 jabbrv-ltwa-en.ldf 到您的工作目录中。
編輯:用戶@moewe善意地指出,我错误地认为所接受的解决方案不适用于较新版本的 biblatex。这可能只是我旧版本的 biblatex 的一个错误。
然后,我提出这个解决方案作为公认解决方案的替代方案,其中简短的期刊缩写是自动从期刊标题中推断出来的;并且还为那些拥有类似有缺陷的 biblatex 版本的人提供了一种解决方法。