export_pdf.py Documentation¶
Introduction¶
export_pdf.py converts a Nobius sheet into LaTeX and can optionally compile that LaTeX to PDF with pdflatex.
Usage¶
Run the script from the Nobius directory:
python export_pdf.py --sheet-path SHEET_PATH [--content-mode MODE] [--no-pdf] [--batch-mode] [--config CONFIG] [--profile PROFILE]
Where:
--sheet-pathor-spoints to the Nobius sheet directory.--content-modechooses one ofquestions,review, orsolutions.--no-pdfwrites LaTeX output without runningpdflatex.--batch-modeprocesses multiple sheets in one run.--configpoints to the Nobius config JSON. If omitted,Nobius/nobius.jsonis used.--profileselects the named Nobius profile. If omitted, the config'sdefault_profileis used.
Output¶
The script writes generated files into the sheet's renders/ directory:
<sheet_name>.texfor question content<sheet_name>_review.texfor review content<sheet_name>_solutions.texfor solutions content
If PDF generation is enabled and pdflatex succeeds, matching PDF files are written alongside the TeX files in renders/. Source figures and other sheet assets continue to be read from the sheet's media/ directory.
In batch mode, sheets are rendered and merged in SheetInfo.json number order so section numbering stays consistent even if folder names sort differently.
Heading Profiles¶
The LaTeX preamble contains configurable heading strings such as the section label and footer label.
export_pdf.py resolves:
- a named Nobius profile
- that profile's
pdf.heading - the concrete heading strings from the top-level
pdf.headingssection
The concrete heading fields control:
footer_label: the label used in the footer before the current sheet/section name and page number context.section_label: the prefix used in the main section heading, for exampleProblem Set #orExam #.
Example:
{
"default_profile": "exam",
"profiles": {
"exam": {
"pdf": {
"heading": "exam"
}
},
"html_preview": {
"pdf": {
"heading": "generic"
}
}
},
"pdf": {
"headings": {
"problem_sets": {
"footer_label": "Set \\#",
"section_label": "MECH50010 Problem Set \\#"
},
"generic": {
"footer_label": "Sheet \\#",
"section_label": "Nobius Sheet \\#"
}
}
}
}
This means PDF presentation is fully profile-dependent. There is no separate heading override flag anymore.
Notes¶
- Not all HTML content translates cleanly to LaTeX.
- Some valid TeX output may still fail to compile depending on the installed LaTeX toolchain.
- Media files referenced by the sheet are copied into the generated output flow automatically.
- The review mode is designed as a QA artifact rather than a polished student handout. It intentionally exposes metadata such as filenames, UIDs, response modes, media counts, and solution availability in a compact summary block.