Gemini_for_enonce : améliorations
This commit is contained in:
@@ -69,7 +69,7 @@ def pdf_images_of_contexts(root_dir, label, all_labels):
|
||||
|
||||
# Sort by first_idx to ensure contexts are returned in logical reading order
|
||||
pertinent_contexts.sort(key=lambda x: x[0])
|
||||
return [path for _, path in pertinent_contexts]
|
||||
return [path for _, path in pertinent_contexts]
|
||||
|
||||
|
||||
def get_exam_file_content(folder_path, mode, label):
|
||||
@@ -117,23 +117,13 @@ import tempfile
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
def compile_to_pdf(text, output_pdf_path): # 21 cm + 3.8 (dimension de la marge de gauche)
|
||||
"""Wraps text in a standalone template and compiles it to PDF."""
|
||||
latex_template = f"""\\documentclass[varwidth=24.8cm,margin=0.4cm]{{standalone}}
|
||||
\\usepackage[utf8]{{inputenc}}
|
||||
\\usepackage[T1]{{fontenc}}
|
||||
\\usepackage{{lmodern}}
|
||||
\\usepackage{{amsmath, amssymb}}
|
||||
\\usepackage{{commands}}
|
||||
\\usepackage{{minted}}
|
||||
\\usepackage{{graphicx}}
|
||||
\\usepackage{{enumitem}}
|
||||
\\begin{{document}}
|
||||
\\begin{{minipage}}{{24.8cm}}
|
||||
{text}
|
||||
\\end{{minipage}}
|
||||
\\end{{document}}
|
||||
"""
|
||||
from config import LATEX_AFTER, LATEX_BEFORE
|
||||
|
||||
|
||||
def compile_to_pdf(text, output_pdf_path):
|
||||
"""Wraps text in standalone header/footer templates and compiles it to PDF."""
|
||||
latex_template = f"{LATEX_BEFORE}{text}{LATEX_AFTER}"
|
||||
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
tex_filename = 'text.tex'
|
||||
pdf_filename = 'text.pdf'
|
||||
|
||||
Reference in New Issue
Block a user