美文网首页
基于AMS的杂志缩写

基于AMS的杂志缩写

作者: 破旧的大卡车 | 来源:发表于2018-12-28 15:52 被阅读14次

美国数学会出版了一个csv文件, 里面有常见杂志的缩写. 为了方便, 我用python将其转为amsrefs可以使用的tex文件, 也可以参考我的项目vanabel/ams-abbrevs, python源码如下:

#!/bin/python3
# -*- coding: utf-8 -*-

import pandas
data = pandas.read_csv('./annser.csv',
                       header=0,
                       na_values=[''],
                       usecols=[0, 1, 3, 4])
abbrevs = ""
for index, rows in data.iterrows():
    abbrev = "".join(
        [s[:1] for s in (str(rows[1])).split(' ') if s[:1].isupper()]).lower()
    if(str(rows[3]) == 'nan'):
        rows[3] = "?" + abbrev
    abbrevs += "".join([
        "\\DefineJournal{",
        abbrev,
        "}{",
        str(rows[3]),
        "}\n{",
        str(rows[0]),
        "}\n{",
        str(rows[1]),
        "}\n"
    ])
file = open("annser-abbrev.tex", "w")
file.write(abbrevs)
file.close()

相关文章

网友评论

      本文标题:基于AMS的杂志缩写

      本文链接:https://www.haomeiwen.com/subject/btxelqtx.html