INNER CODE UNIT · Python
line
RQLuo/MixTeX-Latex-OCR · mixtex_data_gen/gen.py:145
line = random.randint(4, 20) / 10
bg = f'\\documentclass{{ctexart}}\n\\usepackage[paperwidth={width}in, paperheight=36in, margin={margin}in]{{geometry}}\n'
bg += '\\usepackage{amssymb}\n\\usepackage{amsmath}\n\\usepackage{stmaryrd}\n\\usepackage{color}\n'
bg += '\\nonstopmode\n\\pagestyle{empty}\n\\renewcommand{\\baselinestretch}{' + str(line) + '}\n\n\\begin{document}\n \\newpage'
ed = '\\end{document}'
with open(file_name, 'w', encoding='utf-8') as file:
file.write(bg)
file.write(''.join(current_group))
file.write(ed)
# Main function to connect all steps
# Input:
# input_text_file (str): Path to the input text file
# input_tex_file (str): Path to the input LaTeX (.tex) file containing formulas
# output_folder (str): Folder name to save the output .tex files
# Output:
# None (executes the entire processing pipeline and writes output files)
def main(input_text_file, input_tex_file, output_folder):