Wiki › Project

Mistral OCR to LaTeX

Project · app · 2026

Mistral OCR to LaTeX is a web app that takes a PDF or photo of an academic document, such as an exam or problem set, and returns a compilable .tex file with the questions and solutions visually separated. It runs entirely on the free tier of a single Mistral API key.

Pipeline

The backend is a FastAPI service in Python. Each upload is first resized to at most 2048 pixels, then takes one of two paths:

  • Images, often handwritten, are read by Pixtral 12B, Mistral's vision model. A second Pixtral pass cross-checks the transcription against the original pixels and corrects it.
  • PDFs go through Mistral OCR, which keeps the layout and extracts embedded figures. Pixtral then classifies each figure in parallel: redraw it as TikZ, keep it as an image, or skip it.

Both paths end with Mistral Large, which writes the LaTeX document and formats each question and solution in its own box. The result is checked for balanced \begin/\end pairs and braces. If the check fails, the model is sent the list of errors and asked to repair the file, up to two times.

Interface

A single page shows the original on the left and the result on the right. The right side has a rendered preview (Markdown with KaTeX for the maths) and the LaTeX source with syntax highlighting.

See also

In the knowledge graph

Mistral OCR to LaTeX and the 13 things it is linked to. Open any dot for its page, or explore it in the full graph.

When
2023202420252026
Jun 2026 · 5 commits

As data

Everything on this page is read from triples in the knowledge graph. These are the 24 it states about Mistral OCR to LaTeX, and 4 more its ontology implies; the console runs SPARQL over the whole graph, here in your browser.

Download
@prefix id: <https://ask.chaipat.cc/id/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix cj: <https://ask.chaipat.cc/ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

id:MistralOCRLaTeX
    a cj:Project ;
    rdfs:label "Mistral OCR to LaTeX" ;
    cj:description "Upload a PDF or image of an academic document and get a compilable .tex file back, questions and solutions separated." ;
    cj:context id:OpenSource ;
    cj:repository "https://github.com/AppleBoiy/ocr_showcase"^^xsd:anyURI ;
    cj:firstCommit "2026-06-30"^^xsd:date ;
    cj:lastCommit "2026-06-30"^^xsd:date ;
    cj:commitCount 5 ;
    cj:kind "app" ;
    cj:theme id:ThemeML , id:ThemeWeb ;
    cj:uses id:Python ,
            id:FastAPI ,
            id:MistralOCR ,
            id:LaTeX ,
            id:KaTeX ,
            id:TikZ ;
    cj:tier 2 ;
    cj:implements id:OCR ;
    cj:integrates id:MistralAPI ;
    cj:handles id:PDFFormat ;
    cj:article "https://ask.chaipat.cc/wiki/MistralOCRLaTeX"^^xsd:anyURI ;
    cj:activeIn id:Y2026 ;
    cj:activity _:b105 .