LaTeX Agent
Write, edit, and compile complete LaTeX documents with automatic IQuly footer injection and structured compile errors.
LaTeX Agent
Write, refine, debug, and compile LaTeX documents with a focused production assistant. The agent owns document rendering quality, not document meaning: it turns supplied content into polished, compilable PDFs without inventing facts, citations, data, or conclusions.
What It Helps With
- Turning outlines into complete
.texdrafts vialatex_create - Cleaning up existing LaTeX source
- Writing sections, equations, tables, and references
- Keeping the preamble lean and readable
- Preserving meaning while improving structure and formatting
- Compiling a final PDF with structured error reporting
- Safe unique text patching for compile fixes and revisions
- Rendering structured document packages into professional LaTeX
- Choosing document-type defaults for reports, worksheets, math notes, scientific reports, business reports, and Beamer decks
- Applying disciplined package and engine choices
- Preserving placeholders and citation integrity
- Producing fuller field-specific reports when requested, including tables, figure placeholders, appendices, and warning review
Tool Surface
The agent exposes four narrow LaTeX-specific tools:
latex_create— Create a workspace.texfile from complete LaTeX source.latex_read— Read a workspace.texfile and return its full source.latex_patch_text— Safely replace a unique exact text match in a workspace.texfile.latex_compile— Compile a workspace.texfile and return a verified PDF path or structured first error.
The agent does not use shell_exec, fs_read, fs_write, package_read, or package_list.
PDF path derivation and IQuly footer injection are handled automatically by the tool layer during compile.
Operating Modes
- Full source mode: create or patch supplied
.tex, compile, and repair once if safe. - Structured package mode: convert semantic content into LaTeX, choose layout and packages, then compile.
- Patch mode: apply exact unique edits and compile when a PDF is expected.
- Debug mode: identify the first meaningful compile error, apply a minimal safe fix, and recompile once.
- Template mode: produce clean reusable
.texsource and compile only when requested.
Best For
- Papers
- Reports
- Technical notes
- Worksheets
- Slides (Beamer)
- Math and proof notes
- Chemistry and scientific reports
- Data-heavy reports with professional tables
Production Defaults
- Default engine is
pdflatex; usexelatexorlualatexonly when the source requires it. - Use common TeX Live packages conservatively:
geometry,amsmath,amssymb,amsthm,mathtools,graphicx,booktabs,tabularx,longtable,array,siunitx,mhchem,listings,hyperref. - Prefer
booktabstables, semantic theorem environments, stable labels,hidelinksPDF links, non-invented citations, and compact artifact-oriented replies. - For full reports, use field-specific coverage standards so finance, chemistry, physics, software architecture, and biology/clinical reports do not collapse into sparse skeletons.
- Avoid shell-escape workflows, remote resources, unsupported image references,
arbitrary
\inputpaths, and source dumps unless requested.
The runtime installs TeX Live base, recommended, extra, fonts-recommended, and science collections so math, chemistry, units, tables, Beamer decks, and standard report layouts can compile without ad hoc package fallbacks.
Source Model
There are no package templates. New documents are complete LaTeX files written to the workspace. The compile step injects the IQuly footer into the temporary source used for PDF generation, leaving the editable source focused on the user's document.
Compile Error Extraction
On compile failure, latex_compile returns a structured first_error with:
kind— Error category (e.g.duplicate_macro,missing_math_mode,undefined_control_sequence)line— Source line numbermessage— LaTeX error messageexcerpt— Relevant source excerptsuggested_find/suggested_replace— Ready-to-use values forlatex_patch_text
Retry Policy
One automatic repair attempt per compile failure. If the second compile still fails, the agent reports the remaining error clearly to the user.
Notes
- Best used when you already know the target document type or can describe the content you want.
- It keeps the output focused on LaTeX source rather than generic writing advice.
- Editable drafts belong in the workspace.
- The compile step adds the common IQuly footer automatically.