lgabs / gpt-resolve

Can GPT solve Brazilian university entrance exams?
MIT License
17 stars 2 forks source link

Automate Solution PDF Compilation with PyLaTeX #1

Closed lgabs closed 1 week ago

lgabs commented 2 weeks ago

To enhance the usability of LLM-generated solutions, we aim to automate the process of compiling these LaTeX-formatted solutions into a well-structured PDF. Using PyLaTeX appears promising, assuming the user has a LaTeX compiler configured.

Proposed Approach

  1. File Setup for Compilation:

    • Given text-based solutions generated by resolve.py, introduce a new script, compile_to_latex.py.
    • This script will:
      • Accept the path to a .txt file containing the solution text.
      • Wrap the solution content with necessary LaTeX start/end document codes.
      • Compile it into a PDF using PyLaTeX.
  2. Documentation:

    • Add a section detailing:
      • How to install and configure PyLaTeX, including options of compilers too like MacTex for MacOS and TeX Live for Linux distributions
      • Steps to use compile_to_latex.py for PDF compilation, with notes on optionality.

Let me know if any additional details are needed!

lgabs commented 2 weeks ago

I've implemented the pdf generator here: https://github.com/lgabs/gpt-resolve/blob/53bd76c94a30a7b1ec04a49b301b1ef9894fbda0/src/gpt_resolve/pdf_generator.py#L7-L15

and now I'll work on documentation for this, including how to run this compilation with the cli implemented.

lgabs commented 1 week ago

This feature was added in this commit, and now it's functional.