INNER CODE UNIT · Python

start_index

RQLuo/MixTeX-Latex-OCR · mixtex_data_gen/gen.py:140

        start_index = i * group_size
        end_index = start_index + group_size
        current_group = strings[start_index:end_index]
        width = random.randint(12, 15)
        margin = random.randint(3, 4)
        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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…