LatexDo Research

LatexDo Research

Systems research behind reliable LaTeX writing.

Compiler diagnostics, bibliography graphs, and agent tools run as one feedback loop: write, check, link, cite, and revise with evidence from the active project.

3
connected systems
1
project context
0
detached demos

Research map

One workflow from source to checked draft.

Each track is built around the same editor state. The compiler produces diagnostics, the graph gives citation context, and the AI uses both before making recommendations.

01

Compiler

What we did in the compiler to make it work.

The compiler is implemented as an Electron-side service around the user's local TeX installation. It runs latexmk, writes output into an isolated .latexdo/build/job-* folder, captures the log, and turns compiler output into structured diagnostics for the editor.

Open compiler research

Pipeline

  • Find latexmk from standard TeX locations, including /Library/TeX/texbin on macOS.
  • Support pdflatex, xelatex, and lualatex through engine-specific latexmk flags.
  • Run with -synctex=1, -file-line-error, -interaction=nonstopmode, and -halt-on-error.
  • Return one compile result with PDF path, duration, raw output, diagnostics, and failure reason.

Diagnostics

  • Parse file-line errors, LaTeX warnings, package warnings, class warnings, and overfull or underfull boxes.
  • Detect low-information failures like emergency stops and surface the real earlier compiler problem.
  • Enrich diagnostics with source context, confidence, highlight text, suggested fixes, and cascade ranking.
  • Sanitize stale latexmk failure output so old failed runs do not confuse the user.

Runtime Controls

Compile jobs are cancellable and have a timeout. On cancellation or timeout the app terminates the process group, waits briefly, then force-kills if needed. Shared cloud projects are materialized into a bounded scratch folder before local compile, with file count and size limits.

02

Knowledge Graph

How the knowledge graph is connected to the bibliography.

The current graph in LatexDo is a deterministic citation graph. It reads project .bib entries and the citation keys used in .tex files, then connects papers that are related by author, venue, year, or title similarity.

Open graph research

Model

  • Each graph node is one bibliography entry with key, title, authors, venue, year, type, cited status, and degree.
  • Edges are typed as shared author, same venue, same year, or similar topic from title-token Jaccard overlap.
  • Weights are configurable, then pruned to the strongest edges per node so large libraries stay readable.
  • Stats include node count, edge count, cited count, and connected component count.

Tools

  • parseBibFile reads BibTeX through bibtex-parse with size and entry limits.
  • extractCitationUsages scans \cite-style commands in project TeX files.
  • analyzeCitationLibrary reports used, unused, missing, duplicate, stale, and low-quality references.
  • The graph view adds search, cited-only filtering, relation toggles, weight sliders, pan, zoom, drag, and citation insertion.

Result

The author can see which references are central, which cited papers are isolated, which uncited papers are related, and where the bibliography has quality problems. The same graph data feeds citation recommendations for selected prose.

03

AI

What we did in the AI tools and how they connect.

The AI assistant is not a detached chatbot. The renderer runs an agent loop that can call LatexDo tools for project files, the active editor, compilation, built-in checks, citation lookup, and graph-backed citation recommendations.

Open AI research

Tool Layer

  • list_files, read_file, and get_active_document inspect project context.
  • edit_selection, insert_at_cursor, and write_file make controlled editor changes.
  • compile verifies edits and returns compiler diagnostics plus the log tail.
  • run_checks, insert_citation, and recommend_citations connect AI to LatexDo's checkers and citation graph.

Models

  • Cloud mode supports Anthropic Messages and OpenAI-compatible chat completions with native tool calls.
  • Ollama runs through Electron main-process IPC and uses Ollama's native tool-calling endpoint.
  • Local GGUF models run through node-llama-cpp with a JSON fallback tool protocol.
  • The setup catalog includes Qwen2.5 Coder, Qwen3, Llama, Phi, SmolLM, and an inline-completion tier.

Guardrails

AI access is controlled by settings for chat history, current editor, project files, bibliography, and researcher profile. Mutating actions can require approval, the agent has a max-step budget, requests can be aborted, and the prompt tells the model to inspect files before editing and compile after risky changes.

System loop

One context, three feedback signals.

01

Compile. Local TeX output becomes ranked diagnostics tied back to source files.

02

Connect. BibTeX entries and citation usage become a graph the editor can query.

03

Assist. AI tools receive the same files, diagnostics, and citation context before acting.