20221007 night 编译pdf前可识别系统自动分配字体
This commit is contained in:
parent
6bb2725264
commit
d9e9d74197
|
|
@ -139,7 +139,7 @@
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.9.7 ('base')",
|
"display_name": "Python 3.8.8 ('base')",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
|
|
@ -153,12 +153,12 @@
|
||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.9.7"
|
"version": "3.8.8"
|
||||||
},
|
},
|
||||||
"orig_nbformat": 4,
|
"orig_nbformat": 4,
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
"hash": "e4cce46d6be9934fbd27f9ca0432556941ea5bdf741d4f4d64c6cd7f8dfa8fba"
|
"hash": "d311ffef239beb3b8f3764271728f3972d7b090c974f8e972fcdeedf230299ac"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import os,re,time,json\n",
|
"import os,re,time,json,sys\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\"\"\"\n",
|
"\"\"\"\n",
|
||||||
"模板文件目录下 题目清单.tex 文件不能缺失\n",
|
"模板文件目录下 题目清单.tex 文件不能缺失\n",
|
||||||
|
|
@ -145,6 +145,10 @@
|
||||||
" #替换latex文件的内容并编译\n",
|
" #替换latex文件的内容并编译\n",
|
||||||
" with open(\"模板文件/题目清单.tex\",\"r\",encoding = \"utf8\") as f:\n",
|
" with open(\"模板文件/题目清单.tex\",\"r\",encoding = \"utf8\") as f:\n",
|
||||||
" latex_raw = f.read()\n",
|
" latex_raw = f.read()\n",
|
||||||
|
" #识别操作系统\n",
|
||||||
|
" if sys.platform != \"win32\":\n",
|
||||||
|
" latex_raw = re.sub(r\"fontset[\\s]*=[\\s]*windows\",\"fontset = fandol\",latex_raw)\n",
|
||||||
|
" latex_raw = re.sub(r\"\\\\setCJKmainfont\",r\"% \\\\setCJKmainfont\",latex_raw)\n",
|
||||||
" latex_teachers = latex_raw.replace(\"编译模板\",data_teachers)\n",
|
" latex_teachers = latex_raw.replace(\"编译模板\",data_teachers)\n",
|
||||||
" with open(teachers_latex_file,\"w\",encoding = \"utf8\") as f:\n",
|
" with open(teachers_latex_file,\"w\",encoding = \"utf8\") as f:\n",
|
||||||
" f.write(latex_teachers)\n",
|
" f.write(latex_teachers)\n",
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"import os,re,json,time\n",
|
"import os,re,json,time,sys\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\"\"\"---设置模式(1为整卷统一编号, 0为每一部分从1开始编号)---\"\"\"\n",
|
"\"\"\"---设置模式(1为整卷统一编号, 0为每一部分从1开始编号)---\"\"\"\n",
|
||||||
"enumi_mode = 0\n",
|
"enumi_mode = 0\n",
|
||||||
|
|
@ -119,6 +119,12 @@
|
||||||
"#读取模板\n",
|
"#读取模板\n",
|
||||||
"with open(template_file,\"r\",encoding=\"utf8\") as f:\n",
|
"with open(template_file,\"r\",encoding=\"utf8\") as f:\n",
|
||||||
" latex_raw = f.read()\n",
|
" latex_raw = f.read()\n",
|
||||||
|
"\n",
|
||||||
|
"#识别操作系统\n",
|
||||||
|
"if sys.platform != \"win32\":\n",
|
||||||
|
" latex_raw = re.sub(r\"fontset[\\s]*=[\\s]*windows\",\"fontset = fandol\",latex_raw)\n",
|
||||||
|
" latex_raw = re.sub(r\"\\\\setCJKmainfont\",r\"% \\\\setCJKmainfont\",latex_raw)\n",
|
||||||
|
"\n",
|
||||||
"#预处理\n",
|
"#预处理\n",
|
||||||
"for command in exec_list:\n",
|
"for command in exec_list:\n",
|
||||||
" latex_raw = re.sub(command[0],command[1],latex_raw)\n",
|
" latex_raw = re.sub(command[0],command[1],latex_raw)\n",
|
||||||
|
|
|
||||||
Reference in New Issue