diff --git a/工具v2/database_tools.py b/工具v2/database_tools.py index d191bfe7..2cc33b12 100644 --- a/工具v2/database_tools.py +++ b/工具v2/database_tools.py @@ -1046,12 +1046,12 @@ def generateLaTeXBodyContent(id,adict,objdict,misc): #根据id,读取的json内 # } # } id = str(id).zfill(6) - if misc["教师版"] == False: + if not "教师版" in misc or misc["教师版"] == False: output = f"\n\\item {{\\tiny ({id})}} {adict[id]['content']}" - if "答案" in misc["字段显示设置"] and misc["字段显示设置"]["答案"] == True: + if "字段显示设置" in misc and "答案" in misc["字段显示设置"] and misc["字段显示设置"]["答案"] == True: ans = adict[id]["ans"] if len(adict[id]["ans"]) > 0 else "暂无答案" output += f"\n\n答案: \\textcolor{{red}}{{{ans}}}\n\n" - if "题后空间" in misc["字段显示设置"] and misc["字段显示设置"]["题后空间"] == True: + if "字段显示设置" in misc and "题后空间" in misc["字段显示设置"] and misc["字段显示设置"]["题后空间"] == True: space = f"\n\n\\vspace*{{{adict[id]['space']}}}\n\n" if len(adict[id]["space"]) > 0 else "" output += space else: