From c5bdbed9cbc459707459ab7d5c4ab7a01659e307 Mon Sep 17 00:00:00 2001 From: "weiye.wang" Date: Wed, 1 May 2024 23:06:22 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E9=A2=98=E7=BC=96=E8=AF=91=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=94=B9=E4=B8=BA=E5=85=88=E7=94=9F=E6=88=90=E5=AD=97?= =?UTF-8?q?=E5=85=B8,=20=E5=86=8D=E7=94=9F=E6=88=90LaTeX=E4=BB=A3=E7=A0=81?= =?UTF-8?q?,=20=E5=9C=A8=E9=A2=98=E7=9B=AE=E5=A4=9A=E4=BA=8E50=E9=A2=98?= =?UTF-8?q?=E6=97=B6=E5=B0=86=E6=98=BE=E8=91=97=E5=8A=A0=E5=BF=AB=E7=94=9F?= =?UTF-8?q?=E6=88=90LaTeX=E4=BB=A3=E7=A0=81=E7=9A=84=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 工具v4/指定题号编译pdf.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/工具v4/指定题号编译pdf.py b/工具v4/指定题号编译pdf.py index 03144841..dab2acc8 100644 --- a/工具v4/指定题号编译pdf.py +++ b/工具v4/指定题号编译pdf.py @@ -128,17 +128,21 @@ class MyWindow_xtby(QWidget,Ui_Form): latex_raw = re.sub(r"fontset[\s]*=[\s]*none","fontset = fandol",latex_raw) latex_raw = re.sub(r"\\setCJKmainfont",r"% \\setCJKmainfont",latex_raw) - bodystring = "\\tableofcontents\n\n\\newpage\n\n" + if len(self.TitleID_list) > 1: + bodystring = "\\tableofcontents\n\n\\newpage\n\n" + else: + bodystring = "\n\n" bodylist = [] # problems_dict = configjson["标题与题号"] starttime = time.time() mydb = connect(hostname = db_host, port = db_port, username=db_user, pwd=db_pwd, db = self.database_name) mycursor = mydb.cursor() + pro_dict,obj_dict,bn_dict,unit_obj_dict = generateDictsfromMariaDB(mycursor) for p,IDs in self.TitleID_list: currentbodystring = f"\\section{{{p}}}\n\\begin{{enumerate}}\n\n" print(f"正在从数据库获取数据, 生成源代码...") - for id in tqdm.tqdm(generate_number_set(IDs)): - currentbodystring += generateLaTeXBodyContentfromMariaDB(mycursor,id,configjson) + for id in tqdm.tqdm(generate_number_set(IDs,pro_dict), desc = f"生成 {p} 章节LaTeX代码"): + currentbodystring += generateLaTeXBodyContentFromDict(id,pro_dict,obj_dict,configjson) currentbodystring += "\\end{enumerate}" bodylist.append(currentbodystring) bodystring += "\n\n\\newpage\n\n".join(bodylist)