使用 bibtool 保留 @comment 行

使用 bibtool 保留 @comment 行

我刚刚bibtool在我的 bib 文件(由 BibDesk 管理)上运行以删除摘要字段(感谢 ananswer从 .bib 中删除摘要?)。但是,这样做会删除@commentBibDesk 添加的行。

有没有办法@comment在运行时保留线路(和我的静态组!)bibtool

答案1

该选项pass.comments=on通过“将注释附加到其后的条目”来保留注释[1]

因此,下面的一行代码可以解决您的问题:

bibtool -- pass.comments=on -- delete.field={abstract} bibdesk.bib -o bibdesk_cleaned.bib

您可能希望在 bibtool *.rsc 文件中指定这些选项并使用 加载它-r preserve_bibdesk.rsc。我尝试在这里尽可能紧密地使用这样的 bibtool 资源文件模仿 BibDesk 的输出格式:https://github.com/ge-ne/bibtool/files/4906579/preserve_bibdesk.zip

请注意,bibtool 可能会影响带有换行符的字段(例如,如果你“误用”注释用于注释)因为“BibTool 假定文本末尾使用 (La)TeX 排版。因此会考虑到该目标的规则。” [3] 因此 bibtool 会消除单个换行符并相应地折叠多个换行符。


[1] BibTool手册,第29页:https://mirror.easyname.at/ctan/biblio/bibtex/utils/bibtool/bibtool.pdf

[2] BibTool快速参考:https://mirror.easyname.at/ctan/biblio/bibtex/utils/bibtool/ref_card.pdf

[3] BibTool 作者澄清换行行为:https://github.com/ge-ne/bibtool/issues/77#issuecomment-657127528

相关内容