优化 generateLaTeXBodyContent 的设置, misc为{}时可生成只有题号和题目内容的\item 字符串

This commit is contained in:
weiye.wang 2024-02-07 12:39:07 +08:00
parent 8d5bb08377
commit a78e62f61a
1 changed files with 3 additions and 3 deletions

View File

@ -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: