我在 Windows 和 OS X 上工作。在 Mac 上,我喜欢 BibDesk 以及它显示关键字和链接文件的方式。在 Windows 上,我使用 JabRef,它很好,但不是 BibDesk。
我遇到的主要问题是如何保存文件。我将.bib
文件保存在 git 下,当我在一个应用程序中打开文件、编辑某些条目并保存文件时,所有条目都会被修改,因此 git diff 并不能表明实际更改了什么。例如,以下是 BibDesk 保存一个条目的方式:
@article{bib:farzaneh,
Author = {Seyed Amir Farzaneh and Mehran Sohrabi},
Date-Added = {2015-02-09 19:04:24 +0000},
Date-Modified = {2015-02-09 19:06:24 +0000},
Journal = {Chemical Engineering Research and Design},
Keywords = {CO2 foam, heavy oil recovery, foam flood, foam stability, alkaline, surfactant screening},
Pages = {375-389},
Title = {Experimental investigation of CO2-foam stability improvement by alkaline in the presence of crude oil},
Volume = {94},
Year = {2015},
Bdsk-File-1 = {YnBsaXN0MDDUAQIDBAUGJCVYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoKgHCBMUFRYaIVUkbnVsbNMJCgsMDxJXTlMua2V5c1pOUy5vYmplY3RzViRjbGFzc6INDoACgAOiEBGABIAFgAdccmVsYXRpdmVQYXRoWWFsaWFzRGF0YV8QUy4uL0Ryb3Bib3gvcGFwZXJzL0ZhcnphbmVoXzIwMTVfRXhwZXJpbWVudGFsIGludmVzdGlnYXRpb24gb2YgQ08yLWZvYW0gc18wMDAwMDAucGRm0hcLGBlXTlMuZGF0YU8RAkgAAAAAAkgAAgAADk1haW4gUGFydGl0aW9uAAAAAAAAAAAAAAAAANC1mYhIKwAAAAt4uR9GYXJ6YW5laF8yMDE1X0V4cGVyaSMyMDk2REEucGRmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIJba0P5/EgAAAAAAAAAAAAEAAwAACSAAAAAAAAAAAAAAAAAAAAAGcGFwZXJzABAACAAA0LW1qAAAABEACAAA0P6bMgAAAAEAEAALeLkAC3bdAAUzQAAAwAoAAgBVTWFpbiBQYXJ0aXRpb246VXNlcnM6AGZhYmlvZm9ydGthbXA6AERyb3Bib3g6AHBhcGVyczoARmFyemFuZWhfMjAxNV9FeHBlcmkjMjA5NkRBLnBkZgAADgCEAEEARgBhAHIAegBhAG4AZQBoAF8AMgAwADEANQBfAEUAeABwAGUAcgBpAG0AZQBuAHQAYQBsACAAaQBuAHYAZQBzAHQAaQBnAGEAdABpAG8AbgAgAG8AZgAgAEMATwAyAC0AZgBvAGEAbQAgAHMAXwAwADAAMAAwADAAMAAuAHAAZABmAA8AHgAOAE0AYQBpAG4AIABQAGEAcgB0AGkAdABpAG8AbgASAGRVc2Vycy9mYWJpb2ZvcnRrYW1wL0Ryb3Bib3gvcGFwZXJzL0ZhcnphbmVoXzIwMTVfRXhwZXJpbWVudGFsIGludmVzdGlnYXRpb24gb2YgQ08yLWZvYW0gc18wMDAwMDAucGRmABMAAS8AABUAAgAU//8AAIAG0hscHR5aJGNsYXNzbmFtZVgkY2xhc3Nlc11OU011dGFibGVEYXRhox0fIFZOU0RhdGFYTlNPYmplY3TSGxwiI1xOU0RpY3Rpb25hcnmiIiBfEA9OU0tleWVkQXJjaGl2ZXLRJidUcm9vdIABAAgAEQAaACMALQAyADcAQABGAE0AVQBgAGcAagBsAG4AcQBzAHUAdwCEAI4A5ADpAPEDPQM/A0QDTwNYA2YDagNxA3oDfwOMA48DoQOkA6kAAAAAAAACAQAAAAAAAAAoAAAAAAAAAAAAAAAAAAADqw==}}
以下是 JabRef 保存的方式(我没有编辑它,只是打开并保存了文件)。请注意,内容没有改变,但大小写、间距和输入顺序是:
@Article{bib:farzaneh,
title = {Experimental investigation of CO2-foam stability improvement by alkaline in the presence of crude oil},
author = {Seyed Amir Farzaneh and Mehran Sohrabi},
journal = {Chemical Engineering Research and Design},
year = {2015},
pages = {375-389},
volume = {94},
bdsk-file-1 = {YnBsaXN0MDDUAQIDBAUGJCVYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoKgHCBMUFR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IFZOU0RhdGFYTlNPYmplY3TSGxwiI1xOU0RpY3Rpb25hcnmiIiBfEA9OU0tleWVkQXJjaGl2ZXLRJidUcm9vdIABAAgAEQAaACMALQAyADcAQABGAE0AVQBgAGcAagBsAG4AcQBzAHUAdwCEAI4A5ADpAPEDPQM/A0QDTwNYA2YDagNxA3oDfwOMA48DoQOkA6kAAAAAAAACAQAAAAAAAAAoAAAAAAAAAAAAAAAAAAADqw==},
date-added = {2015-02-09 19:04:24 +0000},
date-modified = {2015-02-09 19:06:24 +0000},
keywords = {CO2 foam, heavy oil recovery, foam flood, foam stability, alkaline, surfactant screening}
}
有什么方法可以改变(在任一程序中)条目的保存方式,以使其保持一致?
答案1
解决您的问题的一个方法是将一个脚本添加到您的 git 工作流中,该脚本重新格式化您的 .bib 文件。 其中一个工具处于biber
工具模式。
呼叫:
$ biber --tool example.bib
生成一个格式良好的文件,文件名为example_bibertool.bib
:
@ARTICLE{bib:farzaneh,
AUTHOR = {Seyed Amir Farzaneh and Mehran Sohrabi},
BDSK-FILE-1 = {YnBsaXN0MDDUAQIDBAUGJCVYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoKgHCBMUFRYaIVUkbnVsbNMJCgsMDxJXTlMua2V5c1pOUy5vYmplY3RzViRjbGFzc6INDoACgAOiEBGABIAFgAdccmVsYXRpdmVQYXRoWWFsaWFzRGF0YV8QUy4uL0Ryb3Bib3gvcGFwZXJzL0ZhcnphbmVoXzIwMTVfRXhwZXJpbWVudGFsIGludmVzdGlnYXRpb24gb2YgQ08yLWZvYW0gc18wMDAwMDAucGRm0hcLGBlXTlMuZGF0YU8RAkgAAAAAAkgAAgAADk1haW4gUGFydGl0aW9uAAAAAAAAAAAAAAAAANC1mYhIKwAAAAt4uR9GYXJ6YW5laF8yMDE1X0V4cGVyaSMyMDk2REEucGRmAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIJba0P5/EgAAAAAAAAAAAAEAAwAACSAAAAAAAAAAAAAAAAAAAAAGcGFwZXJzABAACAAA0LW1qAAAABEACAAA0P6bMgAAAAEAEAALeLkAC3bdAAUzQAAAwAoAAgBVTWFpbiBQYXJ0aXRpb246VXNlcnM6AGZhYmlvZm9ydGthbXA6AERyb3Bib3g6AHBhcGVyczoARmFyemFuZWhfMjAxNV9FeHBlcmkjMjA5NkRBLnBkZgAADgCEAEEARgBhAHIAegBhAG4AZQBoAF8AMgAwADEANQBfAEUAeABwAGUAcgBpAG0AZQBuAHQAYQBsACAAaQBuAHYAZQBzAHQAaQBnAGEAdABpAG8AbgAgAG8AZgAgAEMATwAyAC0AZgBvAGEAbQAgAHMAXwAwADAAMAAwADAAMAAuAHAAZABmAA8AHgAOAE0AYQBpAG4AIABQAGEAcgB0AGkAdABpAG8AbgASAGRVc2Vycy9mYWJpb2ZvcnRrYW1wL0Ryb3Bib3gvcGFwZXJzL0ZhcnphbmVoXzIwMTVfRXhwZXJpbWVudGFsIGludmVzdGlnYXRpb24gb2YgQ08yLWZvYW0gc18wMDAwMDAucGRmABMAAS8AABUAAgAU//8AAIAG0hscHR5aJGNsYXNzbmFtZVgkY2xhc3Nlc11OU011dGFibGVEYXRhox0fIFZOU0RhdGFYTlNPYmplY3TSGxwiI1xOU0RpY3Rpb25hcnmiIiBfEA9OU0tleWVkQXJjaGl2ZXLRJidUcm9vdIABAAgAEQAaACMALQAyADcAQABGAE0AVQBgAGcAagBsAG4AcQBzAHUAdwCEAI4A5ADpAPEDPQM/A0QDTwNYA2YDagNxA3oDfwOMA48DoQOkA6kAAAAAAAACAQAAAAAAAAAoAAAAAAAAAAAAAAAAAAADqw==},
DATE-ADDED = {2015-02-09 19:04:24 +0000},
DATE-MODIFIED = {2015-02-09 19:06:24 +0000},
JOURNALTITLE = {Chemical Engineering Research and Design},
KEYWORDS = {CO2 foam, heavy oil recovery, foam flood, foam stability, alkaline, surfactant screening},
PAGES = {375-389},
TITLE = {Experimental investigation of CO2-foam stability improvement by alkaline in the presence of crude oil},
VOLUME = {94},
YEAR = {2015},
}
您现在可以重命名并提交它。
另外:biber
可以做更多的事情(排序、转换、重新编码),只需查看第 3.12 节手动的。