Endpoint
Request parameters
LaTeX source code to compile as a plain string.
Response
On successful compilation, returns a PDF file with the following headers:application/pdfinline; filename="output.pdf"Error responses
Compilation error (400)
Returned when the LaTeX source contains syntax errors or cannot be compiled.Always
true for error responsesError message from the Tectonic compiler, including line numbers and error descriptions. If no specific error message is available, returns “Unknown compilation error”.
Internal error (500)
Returned when an unexpected error occurs during the compilation process.Always
true for error responsesError message describing the internal failure. Returns “Unknown error” if the error object has no message.
Compilation process
The API performs the following steps:- Receive content: Accepts the LaTeX source code as a plain string
- Write temporary file: Saves the source as
input.texin the system temp directory - Create output directories: Sets up
out/andcache/directories for Tectonic - Run Tectonic: Executes the Tectonic compiler with the following arguments:
-X compile- Use experimental compile mode--outdir- Output directory for generated PDF--synctex=false- Disable SyncTeX generation
- Return PDF or error: Returns the compiled PDF or error messages from stderr
Platform-specific behavior
The Tectonic binary location varies by platform:- Linux/Windows:
bin/tectonicrelative to the project root - macOS:
/usr/local/bin/tectonic
Example request
Example error response
Tips for successful compilation
- Ensure all LaTeX packages used in the document are available in Tectonic
- Check that the LaTeX syntax is valid before sending to the API
- Send the LaTeX content as a plain string in the JSON body
- Large documents may take several seconds to compile
- The API does not support multi-file projects (use
\inputor\includedirectives within a single file)