将Zotero BibTex文件转换为LaTeX友好表示。
zotero-bibtize的Python项目详细描述
佐特罗比茨
将导出的Zotero BibTex书目重新整理成一个更为友好的表示形式。在
在当前状态下,将Zotero数据库的内容导出到Bibtex 格式大多数特殊字符被Zotero内部版本或 在写入输出文件之前进行了转义。这种行为是异常的 如果条目包含要由^{img1}处理的代码,则很烦人$ (即标题中的化学或数学表达式和公式等)。在
zotero-bibtize
可用于后处理生成的Zotero输出文件
转义序列和删除序列是相同的
存储在Zotero接口中的原始条目内容)
使用
安装包之后,zotero-bibtize
可以通过调用
zotero-bibtize
命令行上的命令:
$ zotero-bibtize zotero_bibliography.bib bibtized_bibliography.bib
它将处理原始内容zotero_bibliography.bib
并写入
新的bibtized_bibliography.bib
文件的已处理内容。
请注意,指定目标文件是可选的,输入文件将是
如果省略则重写。在
示例
Zotero export生成的原始bibtex条目:
^{pr2}$运行zotero-bibtize zotero_bibliography.bib
后:
$ cat zotero_bibliography.bib @article{LangCM2015, title = {Lithium Ion Conduction in \ce{LiTi2(PO4)3} and Related Compounds Based on the NASICON Structure: A First-Principles Study}, volume = {27}, issn = {0897-4756, 1520-5002}, shorttitle = {Lithium Ion Conduction in \ce{LiTi2(PO4)3} and Related Compounds Based on the NASICON Structure}, url = {http://pubs.acs.org/doi/10.1021/acs.chemmater.5b01582}, doi = {10.1021/acs.chemmater.5b01582}, language = {en}, number = {14}, urldate = {2019-02-11}, journal = {Chem. Mater.}, author = {Lang, Britta and Ziebarth, Benedikt and Els\"{a}sser, Christian}, month = jul, year = {2015}, pages = {5040--5048}}
定制BibTex键(非常实验性)
自定义BibTex键可以通过可选的--key-format
选项定义
将写入书目文件而不是默认键
由佐特罗生成。密钥格式定义了如何组合和格式化
从BibTex输入字段获取的内容,以构建自定义密钥格式。在
格式键的格式为
[field1:option][field2:option]...
其中field
定义了BibTex条目字段,从中获取内容
选项定义将应用于内容的不同格式选项。
目前实现了以下字段:
作者
将作者的姓氏添加到密钥项
通用格式:[author:num:options]
数字
定义用于密钥的最大作者名称数
选项
将应用于作者姓名的格式选项,即
- 大写:名称大写
- 大写:变换名称大写
- lower:将名称转换为小写
- 缩写:只有我们的第一个字母,而不是全名
标题
将标题字符串的内容添加到密钥项
通用格式:[title:num:options]
数字
定义标题中用于关键字的最大字数 (注意function keys 不考虑在内)
选项
将应用于标题内容的格式选项,即
- 大写:名称大写
- 大写:变换名称大写
- lower:将名称转换为小写
- 缩写:只有我们的第一个字母,而不是全名
日志
将日志名称的内容添加到密钥项
通用格式:[journal:options]
选项
将应用于日志名称的格式选项,即
- 大写:名称大写
- 大写:变换名称大写
- lower:将名称转换为小写
- 缩写:只有我们的第一个字母,而不是全名
年
将发布年份添加到关键条目
通用格式:[year:option]
选项
添加年份仅允许指定两种类型的选项:
- 短:将年份作为2位数添加到密钥中
- long:将整年相加(即4位数)
示例
在下面的示例中,我们创建一个包含第一个
作者姓名和出版物后面的缩写期刊名
年。定义该密钥的密钥格式如下:
[author:1:capitalize][journal:capitalize:abbreviate][year]
Zotero生成的原始条目如下所示:
$ cat zotero_bibliography.bib @article{lang_lithium_ion_conduction_2015, title = {Lithium {Ion} {Conduction} in {\textbackslash}ce\{{LiTi}2({PO}4)3\} and {Related} {Compounds} {Based} on the \{{NASICON}\} {Structure}: {A} {First}-{Principles} {Study}}, volume = {27}, issn = {0897-4756, 1520-5002}, shorttitle = {Lithium {Ion} {Conduction} in {\textbackslash}ce\{{LiTi}2({PO}4)3\} and {Related} {Compounds} {Based} on the {NASICON} {Structure}}, url = {http://pubs.acs.org/doi/10.1021/acs.chemmater.5b01582}, doi = {10.1021/acs.chemmater.5b01582}, language = {en}, number = {14}, urldate = {2019-02-11}, journal = {Chem. Mater.}, author = {Lang, Britta and Ziebarth, Benedikt and Els{\textbackslash}"\{a\}sser, Christian}, month = jul, year = {2015}, pages = {5040--5048}}
运行zotero-bibtize zotero_bibliography.bib --key-format [author:1:capitalize][journal:capitalize:abbreviate][year]
后
原始内容将由zotero-bibtize
和原件
Zotero密钥将替换为修改后的版本:
$ cat zotero_bibliography.bib @article{LangCM2015, title = {Lithium Ion Conduction in \ce{LiTi2(PO4)3} and Related Compounds Based on the NASICON Structure: A First-Principles Study}, volume = {27}, issn = {0897-4756, 1520-5002}, shorttitle = {Lithium Ion Conduction in \ce{LiTi2(PO4)3} and Related Compounds Based on the NASICON Structure}, url = {http://pubs.acs.org/doi/10.1021/acs.chemmater.5b01582}, doi = {10.1021/acs.chemmater.5b01582}, language = {en}, number = {14}, urldate = {2019-02-11}, journal = {Chem. Mater.}, author = {Lang, Britta and Ziebarth, Benedikt and Els\"{a}sser, Christian}, month = jul, year = {2015}, pages = {5040--5048}}
- 项目
标签: