新增 单一题目转成图片文件 功能 施工中
This commit is contained in:
parent
799a268d69
commit
6a58c745ff
|
|
@ -0,0 +1,19 @@
|
|||
id = "2024"
|
||||
|
||||
from database_tools import *
|
||||
|
||||
pro_dict = load_dict("../题库0.3/Problems.json")
|
||||
content = pro_dict[id.zfill(6)]["content"]
|
||||
latex_raw = ReadTextFile("模板文件/独立文件模板.txt")
|
||||
|
||||
latexdata = StringSubstitute(r"<<待替换\d*>>",latex_raw,[content])
|
||||
try:
|
||||
os.mkdir("临时文件/pics")
|
||||
except:
|
||||
pass
|
||||
|
||||
SaveTextFile(latexdata,"临时文件/pics/temp.tex")
|
||||
os.system("xelatex -interaction=batchmode -output-directory=临时文件/pics temp.tex")
|
||||
os.chdir("临时文件/pics")
|
||||
os.system("pdftocairo temp.pdf -png -r 600")
|
||||
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
\documentclass[border = {2pt 2pt 2pt 2pt},varwidth=50em,12pt]{standalone}
|
||||
\usepackage[UTF8,fontset = windows]{ctex}
|
||||
\setCJKmainfont[BoldFont=黑体,ItalicFont=楷体]{华文中宋}
|
||||
\usepackage{amssymb,amsmath,amsfonts,amsthm,mathrsfs,graphicx}
|
||||
\usepackage{ifthen,indentfirst,enumerate,color,titletoc}
|
||||
\usepackage{tikz}
|
||||
\usepackage{multicol}
|
||||
\usepackage{multirow}
|
||||
\usepackage{makecell}
|
||||
\usepackage{longtable}
|
||||
\usepackage{diagbox}
|
||||
\usetikzlibrary{arrows,calc,intersections,patterns,decorations.pathreplacing,3d,angles,quotes,positioning,shapes.geometric}
|
||||
\usepackage[bf,small,indentafter,pagestyles]{titlesec}
|
||||
% \usepackage[top=1in, bottom=1in,left=0.8in,right=0.8in]{geometry}
|
||||
\renewcommand{\baselinestretch}{1.65}
|
||||
\newtheorem{defi}{定义~}
|
||||
\newtheorem{eg}{例~}
|
||||
\newtheorem{ex}{~}
|
||||
\newtheorem{rem}{注~}
|
||||
\newtheorem{thm}{定理~}
|
||||
\newtheorem{coro}{推论~}
|
||||
\newtheorem{axiom}{公理~}
|
||||
\newtheorem{prop}{性质~}
|
||||
\newcommand{\blank}[1]{\underline{\hbox to #1pt{}}}
|
||||
\newcommand{\bracket}[1]{(\hbox to #1pt{})}
|
||||
\newcommand{\onech}[4]{\par\begin{tabular}{p{.9\linewidth}}
|
||||
A.~#1\\
|
||||
B.~#2\\
|
||||
C.~#3\\
|
||||
D.~#4
|
||||
\end{tabular}}
|
||||
\newcommand{\twoch}[4]{\par\begin{tabular}{p{.46\linewidth}p{.0\linewidth}p{.46\linewidth}p{.0\textwidth}}
|
||||
A.~#1& &B.~#2&\\
|
||||
C.~#3& &D.~#4&
|
||||
\end{tabular}}
|
||||
\newcommand{\vartwoch}[4]{\par\begin{tabular}{p{.46\linewidth}p{.46\linewidth}}
|
||||
(1)~#1& (2)~#2\\
|
||||
(3)~#3& (4)~#4
|
||||
\end{tabular}}
|
||||
\newcommand{\fourch}[4]{\par\begin{tabular}{p{.23\linewidth}p{.23\linewidth}p{.23\linewidth}p{.23\linewidth}}
|
||||
A.~#1 &B.~#2& C.~#3& D.~#4
|
||||
\end{tabular}}
|
||||
\newcommand{\varfourch}[4]{\par\begin{tabular}{p{.23\linewidth}p{.23\linewidth}p{.23\linewidth}p{.23\linewidth}}
|
||||
(1)~#1 &(2)~#2& (3)~#3& (4)~#4
|
||||
\end{tabular}}
|
||||
\begin{document}
|
||||
|
||||
<<待替换1>>
|
||||
|
||||
\end{document}
|
||||
Reference in New Issue