Forum | Documentation | Website | Blog

Skip to content

fix: conf.py file to automate PDF generation from .rst files, including those in subdirectories

Sahil Jaiswal requested to merge Sahil7741/gsoc.beagleboard.io:pdf-gen-fix into main

This PR updates the conf.py file to ensure that LaTeX builds (e.g., make latexpdf) generate PDFs for all proposal .rst files, including those in subdirectories like proposals/2025/index/. Previously, only top-level proposals (e.g., proposals/template.rst) were processed, omitting nested files.

Changes:

  • Updated the proposal detection logic to use os.walk() for scanning all .rst files within the proposals/ directory.
  • Modified latex_documents to generate .tex files for each proposal while preserving the full source path. Filenames now follow {basename}.tex, ensuring sahil_jaiswal.rst results in sahil_jaiswal.pdf.
  • Ensured latex_elements and other configurations apply consistently to all generated PDFs.

Result:

  • Running make latexpdf now produces PDFs for all proposals, such as template.pdf and sahil_jaiswal.pdf.
  • Ensures automatic inclusion of newly added proposal files without manual changes to conf.py.

Testing:

  • Ran make clean && make latexpdf locally and verified output.
  • Checked _build/latex/ directory to confirm that PDFs (e.g., sahil_jaiswal.pdf) are generated correctly.
  • Tested for make html to confirm HTML files are also generated.
  • Validated content inside sahil_jaiswal.pdf to ensure it matches proposals/2025/Sahil Jaiswal/sahil_jaiswal.rst.

Attachments:

  • Screenshot of _build/latex/ directory showing generated PDFs.
  • Screenshot of _build/html/ directory showing generated HTML files.
  • Sample page from sahil_jaiswal.pdf to confirm content.
  • Snapshot from sahil_jaiswal.html to confirm content.

This resolves the issue where proposals inside subdirectories were not included in the LaTeX output. It also eliminates the need for manual build commands for individual files.

@lorforlinux Sir can you please review and let me know if further changes are needed ?

pdf_files

Sample1

Sample2

html_file

Sample_html

Merge request reports