使用Biblatex
来自的样式这里并调整了一些其他的东西,我取得了一些成功,但对于参考书目中的这个东西却没有成功;我有一个重复的物种名称,也就是Helicobacter pylori
,如何编写代码来识别这个词,也可能是其他一些词,以便 Biblatext 一旦在 .bib 文件中找到它们就可以用强调的文字写出来?
PS:该词Helicobacter pylori
在参考文献标题中可以以不同的形式出现,由于它们是物种名称,因此都应强调,如下所示:
Helicobacter pylori
Helicobacter
H. pylori
H.pylori
即,有时会省略中间的空格Helicobacteraceae
,尽管很少
代码:
\documentclass[oneside]{scrbook}
\usepackage[none]{hyphenat}%
%=====================Language, Fonts============================
\usepackage[ngerman,english]{babel}
\selectlanguage{english}
\usepackage{courier,mathptmx,amsmath,amsfonts,amssymb} %
\usepackage[utf8]{inputenc} %
\usepackage[T1]{fontenc} %
\usepackage{cmbright}
%=====================Referencing============================
\usepackage{xcolor} %
\usepackage{hyperref} %
\definecolor{dark-red}{rgb}{0.4,0.15,0.15}
\definecolor{dark-blue}{rgb}{0.15,0.15,0.4}
\definecolor{medium-blue}{rgb}{0,0,0.5}
\hypersetup{
colorlinks, linkcolor={dark-red},
citecolor={dark-blue}, urlcolor={medium-blue} %url can be magenta
}
\usepackage{filecontents} % to provide file
\begin{filecontents}{\jobname.bib}
@book{kennedy_pcr_2011,
title = {{PCR} Troubleshooting and Optimization: The Essential Guide},
isbn = {9781904455721},
shorttitle = {{PCR} Troubleshooting and Optimization},
language = {en},
pagetotal = {245},
publisher = {Horizon Scientific Press},
author = {Kennedy, Suzanne},
date = {2011-01-01},
keywords = {{PCR} troubleshooting, Polymerase Chain Reaction, {qPCR}, Science / Chemistry / General, Science / Life Sciences / Genetics \& Genomics}
}
@article{akira_role_2000,
title = {The role of {IL-18} in innate immunity},
volume = {12},
issn = {0952-7915},
url = {http://www.ncbi.nlm.nih.gov/pubmed/10679398},
issue = {1},
pages = {59-63},
journaltitle = {Current Opinion in Immunology},
shortjournal = {Curr Opin Immunol},
author = {Akira, S},
urldate = {2011-09-06},
date = {Feb 2000},
note = {{PMID:} 10679398},
keywords = {Animals, Immunity, Innate, Interferon-gamma, Interleukin-1, Interleukin-12, Interleukin-18, Interleukin-18 Receptor alpha Subunit, Killer Cells, Natural, Mice, Models, Immunological, Receptors, Interleukin, Receptors, Interleukin-18, Signal Transduction, Th1 Cells}
}
@article{vignali_il-12_2012,
title = {{IL-12} family cytokines: immunological playmakers},
volume = {13},
rights = {© 2012 Nature Publishing Group, a division of Macmillan Publishers Limited. All Rights Reserved.},
issn = {1529-2908},
url = {http://www.nature.com/ni/journal/v13/n8/full/ni.2366.html},
doi = {10.1038/ni.2366},
shorttitle = {{IL-12} family cytokines},
language = {en},
issue = {8},
pages = {722-728},
journaltitle = {Nature Immunology},
shortjournal = {Nat Immunol},
author = {Vignali, Dario A. A. and Kuchroo, Vijay K.},
urldate = {2012-11-20},
date = {2012},
keywords = {{IL-12} family, key reference, language, review},
file = {Vignali und Kuchroo - 2012 - IL-12 family cytokines immunological playmakers.pdf:D:\Documents\Zotero_Backup\storage\4WZFHV46\Vignali und Kuchroo - 2012 - IL-12 family cytokines immunological playmakers.pdf:application/pdf}
}
@software{matthias_kohl_slqpcr:_2007,
title = {{SLqPCR:} Functions for analysis of real-time quantitative {PCR} data at {SIRS-Lab} {GmbH.} R package, {SIRS-Lab} {GmbH.} Jena.},
author = {{Matthias Kohl}},
date = {2007},
note = {www.sirs-lab.com}
}
@article{lu_duodenal_2005-1,
title = {Duodenal ulcer promoting gene of Helicobacter pylori},
volume = {128},
issn = {0016-5085},
url = {http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3130061/},
issue = {4},
pages = {833-848},
journaltitle = {Gastroenterology},
shortjournal = {Gastroenterology},
author = {{LU}, {HONG} and {HSU}, {PING–I} and {GRAHAM}, {DAVID} Y. and {YAMAOKA}, {YOSHIO}},
urldate = {2012-12-19},
date = {2005-4},
note = {{PMID:} 15825067
{PMCID:} {PMC3130061}},
keywords = {{dupA}, first reference, H.pylori, {IL-8}, key reference, virulence},
file = {LU et al. - 2005 - Duodenal Ulcer Promoting Gene of Helicobacter pylo.pdf:D:\Documents\Zotero_Backup\storage\TDCZTC4F\LU et al. - 2005 - Duodenal Ulcer Promoting Gene of Helicobacter pylo.pdf:application/pdf}
}
\end{filecontents}
\usepackage[backend=biber,style=chem-acs,sorting=none,isbn=false,doi=false]{biblatex}
\addbibresource{\jobname.bib} % extension must be written
\ExecuteBibliographyOptions{%
citetracker=true,% Citation tracker enabled in order not to repeat citations, and have two lists.
sorting=none,% Don't sort, just print in the order of citation
alldates=long,% Long dates, so we can tweak them at will afterwards
dateabbrev=false,% Remove abbreviations in dates, for same reason as ``alldates=long''
articletitle=true,% To have article titles in full bibliography
maxcitenames=999% Number of names before replacing with et al. Here, everyone.
}
% No 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}
% Make year bold for @book types
\DeclareFieldFormat[book]{date}{\textbf{#1}} % doctorate added this line
% 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}% doctorate added this
\clearfield{note}% doctorate added this
\ifentrytype{article}% Delimit article and journal titles with a period
{\adddot}
{}}
\begin{document}
The book reference is here~\parencite{kennedy_pcr_2011}. This article has a bold year in the bibliographye~\parencite{vignali_il-12_2012}, whereas this one not~\parencite{akira_role_2000}. This article also with no year shown~\parencite{lu_duodenal_2005-1}, but has species name called ``\textit{Helicobacter pylori}'' that I want to be emphasized as it should be. If it is possible also to make the author name lower case, otherwise I have to hack this from within the Biblatex translator of Zotero citation manager. I am using TexStudio as \LaTeX{} IDE, while you may use a different one, but that should'nt be a problem anyway.How about using \verb|multicite| commands of the \verb|Biblatex| neat package by citing all of the above \parencites{see,}{akira_role_2000, kennedy_pcr_2011, vignali_il-12_2012, lu_duodenal_2005-1}. Did you notice that the prenote ``see'' was bold, how to change that to normal?
\printbibliography[title={References}] % change from bibliography to references
\end{document}
排版后结果:
答案1
(评论太长了...)
有两种明显的方法可以一致地格式化术语“幽门螺杆菌”:要么在文档的序言中定义:
\newcommand\helicobacter{\emph{Helicobacter pylori}}
并在您的.bib
文件中使用该字符串;或者,为了将定义与您的.bib
文件更紧密地结合起来,您可以将其放在文件本身中:
@preamble{ "\newcommand\helicobacter{\emph{Helicobacter pylori}}" }
并在参考书目条目中使用相同的字符串。
akira_role_2000
顺便说一句, (即 2000 年 2 月)和lu_duodenal_2005-1
(即 2005-4)的日期格式不正确。请注意biber
的警告,它们通常非常明确且有用。
see
显示为粗体的原因在于您使用不\parencites
正确。您应该将其更改为:
\parencites[see,][]{akira_role_2000, kennedy_pcr_2011, vignali_il-12_2012, lu_duodenal_2005-1} % not: \parencites{see,}{...}
最后,您的最小示例 --- 顺便说一句非常有用 --- 缺少类似的内容\usepackage{xcolor}
。
答案2
最后,我找到了一个合适的解决方法。调整不应该在后续的工具链中进行,例如biblatex
,而应该从一开始就进行,即从引用管理器后端进行,从Zotero
,甚至在你自动从网络上抓取参考文献的那一刻进行(顺便说一句,这就是 Zotero 之所以成为一个有趣的程序的原因)。
<i> Helicobacter pylori </i>
什么可以解决问题根本。因此,每次你从网上获取参考资料时,如果你觉得有些单词需要斜体,那么只需在标题中用类似 HTML 的标签将它们包围起来Zotero
,这样就会得到斜体格式,就像\textit{Helicobacter pylori}
导出为BibTex
文件格式一样,最后幽门螺杆菌LaTeX 排版后,更多类型的格式标签请参考这里网站链接。不幸的是,\emph{}
尚不支持Zotero
导出为 BibTex 格式,一种解决方法非常简单,只需一个查找/替换命令即可找到所有内容\textit
并用\emph
字符串替换它们。
这样,您不必在每次.bib
导出后格式化您的条目Zotero
,最重要的是,这非常适合自动化整个过程从从一个网站抓取参考文献到正确引用该参考文献格式化,将其转换为 LaTeX 文档甚至MS Word
文档(对于那些仍然将其与 LaTeX 一起使用的人来说),而不会引入人为错误,无论是在数据输入阶段还是在引用密钥生成阶段。如果有人对此感兴趣自动化流程参考书目引用使用,恕我直言,多功能书目工具,你可以看看我的回答这里。
编辑:
请注意,我在 Zotero 中注意到了以下行为:
- Zotero 的 Bibtex 导出不支持
\emph{}
解析类似 HTML 的标签,我认为他们也不会这样做,因为这会干扰其他事情 - 我发现,当我引入两个标签来将恰好出现在参考文献的一个标题中的两个单词斜体化时,Zotero 只会正确解析第一个标签,但无法解析其后的标签,因此 Zotero 将在下一版本中修复此问题
如果你的标签恰好位于标题的开头,你会在引文键中再次找到该标签,我认为这不是在 Zotero 中自动生成引文键的优雅方式,应该设计一个更稳定的引文键,理想情况下不会受到潜在标签的影响,要么从这些标签中剥离标题,要么包括除标题之外的其他消歧义键,当然还要加上作者姓名和年份,使引文键尽可能合理,并给出一些关于引用参考的提示
对下一个 Zotero 的一个重要功能请求是能够将引用键复制到剪贴板,通过为 BibTeX 格式导出分配专用的快捷键(顺便说一下这应该不是问题); CTRL+ ALT+B