20220911 morning 已调整tex模板到同一个文件夹中

This commit is contained in:
weiye.wang 2022-09-11 10:04:02 +08:00
parent 52b918ca5a
commit d6ba64f36f
13 changed files with 83 additions and 53 deletions

View File

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 1,
"metadata": {},
"outputs": [
{
@ -11,7 +11,7 @@
"0"
]
},
"execution_count": 4,
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
@ -19,7 +19,7 @@
"source": [
"import os,re,json\n",
"# 这里修改题目id, 可以不满6位\n",
"index = \"10942\".zfill(6)\n",
"index = \"10233\".zfill(6)\n",
"with open(r\"../题库0.3/Problems.json\",\"r\",encoding = \"utf8\") as f:\n",
" database = f.read()\n",
"line = '\"id\": \"'+index+'\",'\n",
@ -27,6 +27,13 @@
"position = len(re.findall(r\"\\n\",before))\n",
"os.system(r\"code -g ../题库0.3/Problems.json:\" +str(position))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {

View File

@ -43,7 +43,7 @@
" output_data += \"\\n\".join(results_dict[id])\n",
" output_data += \"\\n\\n\"\n",
"\n",
"with open(\"临时文件/统计测试.txt\",\"w\",encoding = \"utf8\") as f:\n",
"with open(\"临时文件/字段数据.txt\",\"w\",encoding = \"utf8\") as f:\n",
" f.write(output_data)\n"
]
}

View File

@ -9,7 +9,7 @@
"import os,re,json\n",
"\n",
"\"\"\"---明确数据文件位置---\"\"\"\n",
"datafile = \"临时文件/统计测试.txt\"\n",
"datafile = \"临时文件/字段数据.txt\"\n",
"# 双回车分隔,记录内单回车分隔列表,首行为字段名\n",
"\"\"\"---文件位置结束---\"\"\"\n",
"\n",

View File

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@ -46,6 +46,13 @@
"with open(r\"临时文件/课时目标提取结果.tex\",\"w\",encoding = \"utf8\") as f:\n",
" f.write(output_string)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {

View File

@ -56,8 +56,8 @@ A.~#1 &B.~#2& C.~#3& D.~#4
% 修改标题处
\newcommand{\notesindex}{1}
\newcommand{\notestitle}{集合}
\newcommand{\notesindex}{标题数字待处理}
\newcommand{\notestitle}{标题文字待处理}
\begin{document}
\begin{center}

View File

@ -2,9 +2,24 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"正在处理题块 1 .\n",
"题块 1 处理完毕.\n",
"正在处理题块 2 .\n",
"题块 2 处理完毕.\n",
"开始编译教师版本pdf文件: 临时文件/复习讲义测试_教师_20220911.tex\n",
"0\n",
"开始编译学生版本pdf文件: 临时文件/复习讲义测试_学生_20220911.tex\n",
"0\n"
]
}
],
"source": [
"import os,re,json,time\n",
"\n",
@ -13,14 +28,14 @@
"\"\"\"---设置模式结束---\"\"\"\n",
"\n",
"\"\"\"---设置模板文件名---\"\"\"\n",
"# template_file = \"第一轮复习讲义模板.tex\"\n",
"template_file = \"测验周末卷模板.tex\"\n",
"template_file = \"模板文件/第一轮复习讲义模板.tex\"\n",
"# template_file = \"模板文件/测验周末卷模板.tex\"\n",
"\"\"\"---设置模板文件名结束---\"\"\"\n",
"\n",
"\"\"\"---设置其他预处理替换命令---\"\"\"\n",
"#2023届第一轮讲义更换标题\n",
"#exec_list = [(r\"\\\\newcommand{\\\\notesindex}\\{1\\}\",r\"\\\\newcommand{\\\\notesindex}{10}\"),(r\"\\\\newcommand{\\\\notestitle}{集合}\",r\"\\\\newcommand{\\\\notestitle}{测试}\")] \n",
"#enumi_mode = 0\n",
"exec_list = [(\"标题数字待处理\",\"10\"),(\"标题文字待处理\",\"测试\")] \n",
"enumi_mode = 0\n",
"\n",
"#2023届测验卷与周末卷\n",
"# exec_list = [(\"标题替换\",\"周末卷02\")]\n",
@ -33,7 +48,7 @@
"\n",
"\n",
"\"\"\"---设置题号数据---\"\"\"\n",
"problems = [\"1,3,5:7\",\"30000:40000\",\"10000:10010\"]\n",
"problems = [\"1,3,5:7\",\"30000:40000\"]\n",
"\"\"\"---设置题号数据结束---\"\"\"\n",
"\n",
"\n",
@ -165,6 +180,13 @@
" os.system(\"xelatex -interaction=batchmode -output-directory=\" + destination_dir + \" \"+ students_latex_file)\n",
" print(os.system(\"xelatex -interaction=batchmode -output-directory=\" + destination_dir + \" \"+ students_latex_file))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {

View File

@ -29,38 +29,6 @@
" f.write(database)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"count = 0\n",
"for id in pro_dict:\n",
" if pro_dict[id][\"genre\"] == \"\":\n",
" count += 1"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"count"
]
},
{
"cell_type": "code",
"execution_count": null,

View File

@ -2,9 +2,28 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"开始编译单元与课时目标信息pdf文件: 临时文件/课时目标及单元目标_20220911.tex\n",
"开始编译课时划分信息pdf文件: 临时文件/课时划分_20220911.tex\n"
]
},
{
"data": {
"text/plain": [
"0"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import os,re,time,json\n",
"\n",
@ -111,7 +130,7 @@
"\n",
"\n",
"#替换单元课时目标的latex文件的内容并编译\n",
"with open(\"课时目标及单元目标.tex\",\"r\",encoding = \"utf8\") as f:\n",
"with open(\"模板文件/课时目标及单元目标.tex\",\"r\",encoding = \"utf8\") as f:\n",
" obj_latex_file_raw = f.read()\n",
"obj_latex_file_new = obj_latex_file_raw.replace(\"课时目标待替换\",lessons_obj_string).replace(\"单元目标待替换\",units_obj_string)\n",
"with open(lessonobj_file,\"w\",encoding = \"utf8\") as f:\n",
@ -123,7 +142,7 @@
"os.system(\"xelatex -interaction=batchmode -output-directory=\" + lessonobj_dir + \" \"+ lessonobj_file)\n",
"\n",
"#替换课时划分的latex文件的内容并编译\n",
"with open(\"课时划分.tex\",\"r\",encoding = \"utf8\") as f:\n",
"with open(\"模板文件/课时划分.tex\",\"r\",encoding = \"utf8\") as f:\n",
" lessons_cut_latex_file_raw = f.read()\n",
"lessons_cut_latex_file_new = lessons_cut_latex_file_raw.replace(\"待替换\",lessons_cut_string)\n",
"with open(lessoncut_file,\"w\",encoding = \"utf8\") as f:\n",
@ -134,6 +153,13 @@
"os.system(\"xelatex -interaction=batchmode -output-directory=\" + lessoncut_dir + \" \"+ lessoncut_file)\n",
"os.system(\"xelatex -interaction=batchmode -output-directory=\" + lessoncut_dir + \" \"+ lessoncut_file)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {

View File

@ -20,7 +20,7 @@
"import os,re,time,json\n",
"\n",
"\"\"\"\n",
"目录下 题目清单.tex 文件不能缺失\n",
"模板文件目录下 题目清单.tex 文件不能缺失\n",
"\"\"\"\n",
"\n",
"\"\"\"---设置题目列表---\"\"\"\n",
@ -132,7 +132,7 @@
"\n",
"\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_teachers = latex_raw.replace(\"编译模板\",data_teachers)\n",
"with open(teachers_latex_file,\"w\",encoding = \"utf8\") as f:\n",