Use cases/Creative & Building

LaTeX Paper Writing

Write academic papers conversationally with instant PDF compile — no local TeX install, no manual error spelunking, no editor-PDF context switch.

Creative & Buildingmedium~20m setup
Tools
execread_filewrite_file
Channels
desktop

Local LaTeX is a pain — gigabytes of TeX Live, cryptic compile errors, switching between editor and PDF viewer breaks flow. The agent handles the LaTeX layer: you describe the section you want, it generates the source, compiles, surfaces errors plainly, and shows you the PDF. You stay in chat (or your editor of choice).

What it does

  • Generate LaTeX source from a description ("write a methodology section about X")
  • Compile via pdflatex / xelatex / lualatex inside an isolated workspace
  • Parse compile errors and surface them in plain English
  • Apply iterative edits ("change the third paragraph to argue Y")
  • Manage figures, citations, BibTeX
  • Final output: a polished PDF + clean source tree ready to submit

What you'll need

  • A LaTeX environment — either local TeX Live or a Docker image (texlive/texlive works fine)
  • Exec tool for compilation
  • A paper template to start from (Overleaf templates, university templates, or write your own)

Setup

1. Set the working directory convention

Send to Flowly
Remember LaTeX project convention: For each paper, working directory: ~/papers/<paper-slug>/ Files: main.tex — entry point sections/*.tex — chapter content (\input{sections/intro}) refs.bib — BibTeX figures/ — images out/ — generated (gitignored) Compile command: cd ~/papers/<slug> && pdflatex -output-directory=out main.tex For BibTeX: pdflatex → bibtex → pdflatex × 2 (yes, twice)

2. Initialise a paper

Send to Flowly
Start a new paper called "agents-survey": Create the directory structure above. main.tex should: - Use article class, A4 - Standard packages: amsmath, amssymb, graphicx, hyperref, biblatex - biblatex with refs.bib - Sections via \input{sections/intro}, \input{sections/methods}, etc. Generate placeholder sections/intro.tex and sections/methods.tex. Compile to verify the skeleton builds.

3. Write iteratively

"Add a methodology section. The paper is a survey of AI agent plugin architectures. Compare LangChain, Flowly, and OpenClaw on sandboxing, lifecycle hooks, and discovery."

The agent writes sections/methods.tex, compiles, surfaces any warnings (undefined references, overfull boxes), and shows you the output PDF path. You skim, ask for tweaks:

"Make the comparison a table instead of prose."

Section gets re-written, recompiled.

4. Citations

"Add a citation for the OpenClaw plugin paper. The reference is github.com/hesamsheikh/awesome-openclaw-usecases — fill in sensible BibTeX from the URL."

Agent fetches the page, generates BibTeX, appends to refs.bib.

"Cite that in the methodology section's first paragraph."

Adds \cite{...} in context.

5. Compile error handling

When pdflatex fails, the agent parses the error log, finds the problematic line, and either fixes it (common cases: missing }, unbalanced $, undefined command) or asks you for guidance:

"Compile failed at line 42 of methods.tex:

  • ! Undefined control sequence \citep{flowly2026}.*
  • l.42 ...as introduced in \citep{flowly2026}*

That's a citation to a key not in refs.bib. Do you want me to add a placeholder or fetch the BibTeX?"

Tips

  • Use \input{sections/...}. Single-file LaTeX gets unmanageable past 5 pages. Modular sections compile faster too (PDFs of partial drafts).
  • Compile twice for refs. First pass writes .aux, second pass resolves citations. The agent should know this.
  • Diff-friendly source. One sentence per line in your .tex source — git diffs become readable, agent edits become surgical.
  • Don't fight the conventions. When submitting to a journal, use their template verbatim. Customising margins or fonts is the fastest path to desk rejection.
  • Backup before big edits. A "rewrite the whole results section" prompt can lose work. Commit to git first.
  • Image management. Keep figures in figures/, reference with \includegraphics{figures/foo.pdf}. The agent should refuse to embed binary images inline.
  • Spell check stays manual. LaTeX hides typos in commands. Run aspell -t main.tex or your editor's spell-check before submitting.