# LaTeX Editor (latex.giit.ch) > Free LaTeX editor in the browser with a live page preview, no sign-up and no upload. Write LaTeX with syntax highlighting, see the typeset pages as you type, click in the preview to jump to the code, and export to PDF (print dialog), PNG/JPG/WebP pages, HTML, text or the .tex source with its pictures. - Language: English - Cost: free - Data: documents stay in the browser (localStorage, pictures in IndexedDB) unless the user sets up a webhook to their own server. - Typesetting: the editor's own LaTeX renderer in the browser plus KaTeX for math, with Latin Modern fonts - no TeX installation. Not shown: TikZ, fontspec. Documents stay valid pdflatex. ## Features - Code and pages side by side; click text in the preview to jump to its place in the code, the cursor's place is framed in the preview. - Standard classes (article, report, book), sections, lists, tabular/tabularx (l c r p{} X, |, @{}, \hline, booktabs, \multicolumn), figure/table with \caption, \label/\ref/\pageref, footnotes, table of contents, thebibliography/\cite, theorems, \newcommand/\newenvironment. - Math: inline and displayed, equation/align/gather with numbers, matrices (amsmath via KaTeX). - xcolor (\definecolor, \textcolor, \colorbox, \fcolorbox, \pagecolor), geometry (paper, margins, paperwidth/paperheight), graphicx (width, height, keepaspectratio, scale, angle), hyperref, minipage, multicols, lstlisting/verbatim/minted, algorithm2e, algorithmic, \fontsize, \vspace/\vfill/\hfill, \rule, babel ngerman. - Problems (missing braces, unknown commands, undefined references) listed with their line. - Document settings that edit the preamble: class, font size, paper (also square and story formats), margins, font, line spacing, language, title. - Pictures stored with the document, used by \includegraphics{name}. - Templates: article, letter, exercise sheet, social media post. - My documents: any number of documents in the browser - open, rename, duplicate, download (.tex, or ZIP with pictures) and delete. - Light, dark or automatic color theme. ## Writing for a user (for AI assistants) Any AI can put a document into the user's open editor with a link; no server, no API key: - `https://latex.giit.ch/#b64=` - `https://latex.giit.ch/#tex=` - `https://latex.giit.ch/#z=` (shorter) - Add `&mode=add` to add text before \end{document} of the current document. - Add `&file=new&name=` to make a new document next to the user's others, or `&file=` to change that one. Without `&file=` the open document changes. - Long documents: split the encoded text and send one link per part with `&part=N&of=M&id=`. Open the link in the user's browser if you can, otherwise give it to the user to click. The user can undo every change. In the editor, "AI Assistant" > "Copy prompt" gives the AI these instructions together with the current document. ## Saving on your own server (webhook) Set under "Save to server" (cloud button), or for one document with `?webhook=` (the user is asked first unless the editor is embedded). On "Save" (Ctrl+S), or automatically a few seconds after each change if chosen, the browser sends: POST Content-Type: application/json Authorization: Bearer (only if a token is set) {"editor":"latex","event":"save","id":"","name":"", "content":"","assets":{"":"data:image/...;base64,..."}, "updated":""} The server must answer CORS requests from https://latex.giit.ch (Access-Control-Allow-Origin, and Access-Control-Allow-Headers: Content-Type, Authorization). `?src=` opens a .tex file from a URL (CORS needed), `&name=` names it. ## Embedding in a website Messages (postMessage; check `event.origin === "https://latex.giit.ch"` and `event.source === iframe.contentWindow`): - Editor -> page: `{type:"latexeditor:ready", version:1, editor:"latex"}` when it can take a document. - Page -> editor: `{type:"latexeditor:load", name, content, assets:{"logo.png":"data:..."}}` opens the document (a document of that name is replaced, otherwise made). - Editor -> page: `{type:"latexeditor:loaded", name}`, then `{type:"latexeditor:change", id, name, content}` on each edit (not after load), and `{type:"latexeditor:save", id, name, content, assets, editor, event, updated}` when the user clicks Save or presses Ctrl+S. - Page -> editor: `{type:"latexeditor:get"}` asks for a `latexeditor:save` message; `{type:"latexeditor:save"}` saves as if the user had clicked Save. In embedded mode the page text below the editor is hidden and a Save button is shown. The SVG Editor (svg.giit.ch) speaks the same protocol with the prefix `svgeditor:`. ## Tools for browser agents (WebMCP) In browsers with WebMCP (`document.modelContext`), the editor page registers tools that run in the page itself: `get_document`, `get_problems`, `list_sections`, `set_document`, `insert_text`, `replace_text`, `show_line`, `undo`, and `list_files`, `open_file`, `new_file` for the user's other documents. Every change is an undo step for the user. ## Pages - [LaTeX Editor](https://latex.giit.ch/) - [Imprint](https://latex.giit.ch/imprint.html) - [Privacy policy](https://latex.giit.ch/privacy.html) A project by [Grünwald Innovation](https://giit.ch/). Sister project: [SVG Editor](https://svg.giit.ch/).