# texstudio-org/texstudio architecture

> Architecture diagram of the GitHub repository texstudio-org/texstudio, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/texstudio-org/texstudio
- Repository: https://github.com/texstudio-org/texstudio

## Overview

TeXstudio is a desktop LaTeX authoring application. The main workflow is editing a document, using language-aware assistance and checks, building it through configured tools, then viewing the resulting PDF. The README also highlights reference, citation, grammar, spellchecking, structure, and inline-preview features; these are represented as separate capabilities, though their exact wiring is not shown in the excerpts. Edges with null evidence are dashed to mark relationships that are plausible from the product workflow but not directly evidenced here.

Main entry points: [`src/latexeditorview.cpp`](https://github.com/texstudio-org/texstudio/blob/master/src/latexeditorview.cpp) (LaTeX editor view), [`src/texstudio.cpp`](https://github.com/texstudio-org/texstudio/blob/master/src/texstudio.cpp) (Main window), [`src/buildmanager.cpp`](https://github.com/texstudio-org/texstudio/blob/master/src/buildmanager.cpp) (Build manager), [`src/pdfviewer/pdfrendermanager.cpp`](https://github.com/texstudio-org/texstudio/blob/master/src/pdfviewer/pdfrendermanager.cpp) (PDF render manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop application"]
  node_texstudio["Main window<br/>[texstudio.cpp]"]
end

subgraph group_editing["Editing and language tools"]
  node_latexeditor["LaTeX editor view"]
  node_qeditor["Code editor<br/>[qeditor.cpp]"]
  node_document["Document model<br/>[qdocument.cpp]"]
  node_completion["Command completion"]
  node_parser["LaTeX parser<br/>[latexparser.cpp]"]
  node_structure["Structure view"]
  node_syntax["Syntax checking<br/>[syntaxcheck.cpp]"]
  node_references["Reference checking<br/>[latexdocument.cpp]"]
  node_citations["Citation tools<br/>[bibtexreader.cpp]"]
end

subgraph group_build["Build and PDF"]
  node_buildmanager["Build manager<br/>[buildmanager.cpp]"]
  node_externaltools(("TeX tools"))
  node_pdfmanager["PDF render manager"]
  node_renderengine["PDF render engine"]
  node_pdfdocument["PDF document viewer<br/>[PDFDocument.cpp]"]
end

subgraph group_assistance["Writing assistance"]
  node_grammar["Grammar checking<br/>[grammarcheck.cpp]"]
  node_spell["Spellchecking<br/>[spellerutility.cpp]"]
  node_preview["Inline preview"]
  node_ai["AI assistant"]
  node_aihistory["AI query history"]
end

subgraph group_platform["Internal services"]
  node_utilities["Shared utilities"]
  node_config["Configuration<br/>[configmanager.cpp]"]
end

node_user(("LaTeX author"))

node_user -.->|"uses"| node_texstudio
node_texstudio -.->|"opens editing"| node_latexeditor
node_latexeditor -.->|"hosts editor"| node_qeditor
node_qeditor -.->|"edits document"| node_document
node_completion -->|"uses editor"| node_qeditor
node_latexeditor -.->|"parses LaTeX"| node_parser
node_latexeditor -.->|"updates structure"| node_structure
node_latexeditor -.->|"checks syntax"| node_syntax
node_latexeditor -.->|"checks references"| node_references
node_latexeditor -.->|"checks citations"| node_citations
node_texstudio -.->|"starts build"| node_buildmanager
node_buildmanager -.->|"runs tools"| node_externaltools
node_pdfmanager -->|"dispatches rendering"| node_renderengine
node_pdfdocument -.->|"requests pages"| node_pdfmanager
node_buildmanager -->|"uses helpers"| node_utilities
node_pdfmanager -->|"uses helpers"| node_utilities
node_latexeditor -.->|"checks grammar"| node_grammar
node_latexeditor -.->|"checks spelling"| node_spell
node_latexeditor -.->|"shows preview"| node_preview
node_texstudio -.->|"offers assistance"| node_ai
node_ai -.->|"stores query history"| node_aihistory
node_texstudio -.->|"reads settings"| node_config

click node_texstudio "https://github.com/texstudio-org/texstudio/blob/master/src/texstudio.cpp"
click node_latexeditor "https://github.com/texstudio-org/texstudio/blob/master/src/latexeditorview.cpp"
click node_qeditor "https://github.com/texstudio-org/texstudio/blob/master/src/qcodeedit/lib/qeditor.cpp"
click node_document "https://github.com/texstudio-org/texstudio/blob/master/src/qcodeedit/lib/document/qdocument.cpp"
click node_completion "https://github.com/texstudio-org/texstudio/blob/master/src/qcodeedit/lib/qcodecompletionengine.cpp"
click node_parser "https://github.com/texstudio-org/texstudio/blob/master/src/latexparser/latexparser.cpp"
click node_structure "https://github.com/texstudio-org/texstudio/blob/master/src/structuretreeview.cpp"
click node_syntax "https://github.com/texstudio-org/texstudio/blob/master/src/syntaxcheck.cpp"
click node_references "https://github.com/texstudio-org/texstudio/blob/master/src/latexdocument.cpp"
click node_citations "https://github.com/texstudio-org/texstudio/blob/master/src/bibtexreader.cpp"
click node_buildmanager "https://github.com/texstudio-org/texstudio/blob/master/src/buildmanager.cpp"
click node_pdfmanager "https://github.com/texstudio-org/texstudio/blob/master/src/pdfviewer/pdfrendermanager.cpp"
click node_renderengine "https://github.com/texstudio-org/texstudio/blob/master/src/pdfviewer/pdfrenderengine.cpp"
click node_pdfdocument "https://github.com/texstudio-org/texstudio/blob/master/src/pdfviewer/PDFDocument.cpp"
click node_grammar "https://github.com/texstudio-org/texstudio/blob/master/src/grammarcheck.cpp"
click node_spell "https://github.com/texstudio-org/texstudio/blob/master/src/spellerutility.cpp"
click node_preview "https://github.com/texstudio-org/texstudio/blob/master/src/latexeditorview.cpp"
click node_ai "https://github.com/texstudio-org/texstudio/blob/master/src/aichatassistant.cpp"
click node_aihistory "https://github.com/texstudio-org/texstudio/blob/master/src/aiquerystoragemodel.cpp"
click node_utilities "https://github.com/texstudio-org/texstudio/blob/master/src/smallUsefulFunctions.cpp"
click node_config "https://github.com/texstudio-org/texstudio/blob/master/src/configmanager.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_texstudio toneBlue
class node_latexeditor,node_qeditor,node_document,node_completion,node_parser,node_structure,node_syntax,node_references,node_citations toneAmber
class node_buildmanager,node_externaltools,node_pdfmanager,node_renderengine,node_pdfdocument toneMint
class node_grammar,node_spell,node_preview,node_ai,node_aihistory toneRose
class node_utilities,node_config,node_user toneIndigo
```

## Components

### Desktop application

- [Main window](https://github.com/texstudio-org/texstudio/blob/master/src/texstudio.cpp): `src/texstudio.cpp`

### Editing and language tools

- [LaTeX editor view](https://github.com/texstudio-org/texstudio/blob/master/src/latexeditorview.cpp): `src/latexeditorview.cpp`
- [Code editor](https://github.com/texstudio-org/texstudio/blob/master/src/qcodeedit/lib/qeditor.cpp): `src/qcodeedit/lib/qeditor.cpp`
- [Document model](https://github.com/texstudio-org/texstudio/blob/master/src/qcodeedit/lib/document/qdocument.cpp): `src/qcodeedit/lib/document/qdocument.cpp`
- [Command completion](https://github.com/texstudio-org/texstudio/blob/master/src/qcodeedit/lib/qcodecompletionengine.cpp): `src/qcodeedit/lib/qcodecompletionengine.cpp`
- [LaTeX parser](https://github.com/texstudio-org/texstudio/blob/master/src/latexparser/latexparser.cpp): `src/latexparser/latexparser.cpp`
- [Structure view](https://github.com/texstudio-org/texstudio/blob/master/src/structuretreeview.cpp): `src/structuretreeview.cpp`
- [Syntax checking](https://github.com/texstudio-org/texstudio/blob/master/src/syntaxcheck.cpp): `src/syntaxcheck.cpp`
- [Reference checking](https://github.com/texstudio-org/texstudio/blob/master/src/latexdocument.cpp): `src/latexdocument.cpp`
- [Citation tools](https://github.com/texstudio-org/texstudio/blob/master/src/bibtexreader.cpp): `src/bibtexreader.cpp`

### Build and PDF

- [Build manager](https://github.com/texstudio-org/texstudio/blob/master/src/buildmanager.cpp): `src/buildmanager.cpp`
- **TeX tools**
- [PDF render manager](https://github.com/texstudio-org/texstudio/blob/master/src/pdfviewer/pdfrendermanager.cpp): `src/pdfviewer/pdfrendermanager.cpp`
- [PDF render engine](https://github.com/texstudio-org/texstudio/blob/master/src/pdfviewer/pdfrenderengine.cpp): `src/pdfviewer/pdfrenderengine.cpp`
- [PDF document viewer](https://github.com/texstudio-org/texstudio/blob/master/src/pdfviewer/PDFDocument.cpp): `src/pdfviewer/PDFDocument.cpp`

### Writing assistance

- [Grammar checking](https://github.com/texstudio-org/texstudio/blob/master/src/grammarcheck.cpp): `src/grammarcheck.cpp`
- [Spellchecking](https://github.com/texstudio-org/texstudio/blob/master/src/spellerutility.cpp): `src/spellerutility.cpp`
- [Inline preview](https://github.com/texstudio-org/texstudio/blob/master/src/latexeditorview.cpp): `src/latexeditorview.cpp`
- [AI assistant](https://github.com/texstudio-org/texstudio/blob/master/src/aichatassistant.cpp): `src/aichatassistant.cpp`
- [AI query history](https://github.com/texstudio-org/texstudio/blob/master/src/aiquerystoragemodel.cpp): `src/aiquerystoragemodel.cpp`

### Internal services

- [Shared utilities](https://github.com/texstudio-org/texstudio/blob/master/src/smallUsefulFunctions.cpp): `src/smallUsefulFunctions.cpp`
- [Configuration](https://github.com/texstudio-org/texstudio/blob/master/src/configmanager.cpp): `src/configmanager.cpp`

### Other components

- **LaTeX author**

## Connections

- LaTeX author → Main window: uses
- Main window → LaTeX editor view: opens editing
- LaTeX editor view → Code editor: hosts editor
- Code editor → Document model: edits document
- Command completion → Code editor: uses editor (evidence: `src/qcodeedit/lib/qcodecompletionengine.cpp`)
- LaTeX editor view → LaTeX parser: parses LaTeX
- LaTeX editor view → Structure view: updates structure
- LaTeX editor view → Syntax checking: checks syntax
- LaTeX editor view → Reference checking: checks references
- LaTeX editor view → Citation tools: checks citations
- Main window → Build manager: starts build
- Build manager → TeX tools: runs tools
- PDF render manager → PDF render engine: dispatches rendering (evidence: `src/pdfviewer/pdfrendermanager.cpp`)
- PDF document viewer → PDF render manager: requests pages
- Build manager → Shared utilities: uses helpers (evidence: `src/buildmanager.cpp`)
- PDF render manager → Shared utilities: uses helpers (evidence: `src/pdfviewer/pdfrendermanager.cpp`)
- LaTeX editor view → Grammar checking: checks grammar
- LaTeX editor view → Spellchecking: checks spelling
- LaTeX editor view → Inline preview: shows preview
- Main window → AI assistant: offers assistance
- AI assistant → AI query history: stores query history
- Main window → Configuration: reads settings
