메뉴
HN
Hacker News • 31일 전

TeXbrain: 브라우저에서 pdfTeX(WASM)로 돌아가는 LaTeX 편집기

IMP
5/10
핵심 요약

TeXbrain은 완전 무료 오픈소스 LaTeX 편집기로, pdfTeX을 WebAssembly로 포팅해 브라우저 안에서 .tex 파일을 PDF로 컴파일합니다. 서버나 백엔드 없이 모든 편집·컴파일·Git 작업이 클라이언트 측에서 이루어지며, CTAN 패키지를 온디맨드로 다운로드해 오프라인에서도 사용할 수 있습니다.

번역된 본문

TeXbrain은 완전히 브라우저에서 동작하는 무료 오픈소스 LaTeX 편집기입니다. 계정도, 설치도, 서버도 필요 없습니다. 탭을 열고 바로 쓰면 됩니다. 지금 사용해 보세요 → tex.swimmingbrain.dev

이 도구를 만든 이유는 원래 무료여야 할 기능에 돈을 내는 것이 지겨웠기 때문입니다. 작년에 LaTeX으로 학위 논문을 쓰면서 실제 글쓰기보다 도구와 씨름하는 데 더 많은 시간을 보냈습니다. 온라인 솔루션들은 git 동기화를 유료 결벽 뒤에 숨겨두고, 로컬 설정은 컴퓨터마다 깨지곤 했습니다. 그냥 되는 것을 원했습니다. 브라우저를 열고, LaTeX을 쓰고, PDF를 받는 것. 그래서 직접 만들었습니다.

기능 소개

texbrain은 .tex 파일을 브라우저에서 직접 PDF로 컴파일하는 완전한 LaTeX 편집기입니다. 백엔드가 없고, 파일을 처리하는 서버도 없습니다. 편집기, 컴파일러, git 클라이언트 모두 클라이언트 측에서 실행됩니다. 로컬 프로젝트 폴더를 열고, 파일을 편집하고, PDF 업데이트를 확인하고, 변경 사항을 커밋하고, GitHub에 푸시할 수 있습니다. 전부 하나의 탭에서 가능합니다.

주요 기능

브라우저 내 LaTeX 컴파일. pdfTeX의 WebAssembly 포트(SwiftLaTeX)를 사용합니다. .tex 파일이 컴퓨터를 떠나지 않고 PDF로 컴파일됩니다. 패키지는 필요할 때 로드되어 로컬에 캐시되므로, 첫 컴파일 시 문서가 실제로 사용하는 것만 다운로드됩니다. 재컴파일은 프로젝트 복잡도에 따라 1~5초 걸립니다.

CTAN 대부분을 온디맨드로 지원. 자주 쓰는 패키지는 앱에 내장되어 있습니다. 그 외의 것들도(memoir, abntex2, KOMA-Script 등 무엇이든) 문서에서 처음 필요로 할 때 TeX Live 미러에서 자동으로 해석되어 다운로드된 뒤, 오프라인 사용을 위해 로컬에 캐시됩니다.

실시간 PDF 미리보기. pdf.js로 렌더링되며, 여러 페이지, 확대/축소, 텍스트 선택이 가능합니다.

완전한 git 통합. 저장소 복제, 브랜치 생성, 파일 스테이징, 커밋, 푸시, 풀, 병합까지 모두 브라우저에서 동작하는 isomorphic-git으로 처리됩니다. CLI가 필요 없습니다.

로컬 파일 시스템 접근. File System Access API를 사용해 디스크의 프로젝트 폴더를 직접 읽고 씁니다(Chrome/Edge).

다중 파일 프로젝트. 파일 트리, 탭, 드래그 앤 드롭을 지원합니다. .tex, .bib, .sty, .cls 등을 지원합니다.

CodeMirror 6 편집기. 구문 강조, 70개 이상의 LaTeX 명령 자동완성, 괄호 매칭, 코드 폴딩, 스니펫, 다크/라이트 테마를 제공합니다.

명령 팔레트. 키보드 단축키로 동작에 빠르게 접근할 수 있습니다.

스니펫 선택기. 수식 환경, 문서 구조, 그리스 문자, 자주 쓰는 명령들을 검색 가능하고 분류되어 제공합니다.

오프라인 동작. 한 번 로드되면 인터넷 연결 없이도 앱이 동작합니다. 컴파일도 로컬에서, 편집도 로컬에서 이루어집니다. 한 번 컴파일해 본 패키지는 캐시되며, 처음 보는 패키지만 최초 1회 네트워크가 필요합니다.

프로젝트 템플릿. 빈 문서로 시작하거나 템플릿(article, thesis, beamer, report, CV, letter, minimal)을 선택할 수 있습니다.

내부 동작 방식

마법도 백엔드도 없습니다.

편집기. CodeMirror 6 기반으로 커스텀 LaTeX 문법(Lezer 파서), 자동완성 제공자, 테마 시스템을 갖추고 있습니다. 탭으로 여러 파일을 열 수 있으며, 내용은 로컬 파일 시스템과 메모리 내 git 작업 트리 양쪽과 동기화됩니다.

컴파일러. LaTeX 컴파일은 WebAssembly로 컴파일된 SwiftLaTeX의 pdfTeX 엔진을 사용합니다. 엔진은 메모리 파일 시스템(MEMFS)에서 실행되며, 컴파일 전에 프로젝트 파일이 여기에 기록됩니다. 엔진이 갖고 있지 않은 파일(클래스, 패키지, 폰트 등)을 요청하면 서비스 워커가 다음 순서로 해석합니다: 먼저 이전에 캐시된 파일, 다음으로 앱에 번들된 패키지 서브셋, 마지막으로 TeX Live 미러(jsDelivr의 texmf-dist 미러, 커뮤니티 SwiftLaTeX 서버가 폴백). 해석된 모든 파일은 브라우저 캐시 저장소에 저장되므로 각 패키지는 최대 한 번만 다운로드됩니다. 첫 컴파일 성공 후에는 번들 서브셋도 백그라운드에서 미리 받아와 핵심 패키지 세트가 오프라인에서 동작합니다.

Git. 모든 git 작업은 git의 순수 JavaScript 구현체인 isomorphic-git을 사용합니다. 저장소는 IndexedDB를 기반으로 하는 메모리 파일 시스템(LightningFS)에 존재합니다. 프로젝트 파일은 로컬 파일 시스템과 git 작업 트리 사이에서 동기화됩니다. 원격 작업(푸시/풀/클론)은 브라우저의 CORS 제한 때문에 CORS 프록시를 거쳐 처리됩니다.

원문 보기
원문 보기 (영어)
TeXbrain A free, open-source LaTeX editor that runs entirely in your browser. No accounts. No installs. No servers. Just open a tab and write. Try it now → tex.swimmingbrain.dev I built this because I was tired of paying for features that should be free. I wrote my thesis last year in LaTeX and spent more time fighting tooling than actually writing. Online solutions lock git sync behind a paywall. Local setups break between machines. I wanted something that just works. Open a browser, write LaTeX, get a PDF. So I built it. What it does texbrain is a full LaTeX editor that compiles your .tex files to PDF directly in the browser. There is no backend. No server processing your files. Everything (the editor, the compiler, the git client) runs client-side. You can open a local project folder, edit your files, see the PDF update, commit your changes, and push to GitHub. All from one tab. Features LaTeX compilation in the browser. Uses a WebAssembly port of pdfTeX (SwiftLaTeX). Your .tex files are compiled to PDF without ever leaving your machine. Packages are loaded on demand and cached locally, so the first compile only downloads what your document actually uses. Recompilations take 1 to 5 seconds depending on project complexity. Most of CTAN, loaded on demand. Common packages ship with the app. Anything else ( memoir , abntex2 , KOMA-Script, you name it) is resolved automatically from a TeX Live mirror the first time a document needs it, then cached locally for offline use. Live PDF preview. Rendered with pdf.js. Multi-page, zoomable, with text selection. Full git integration. Clone repos, create branches, stage files, commit, push, pull, merge. All powered by isomorphic-git running in the browser. No CLI needed. Local file system access. Uses the File System Access API to read and write directly to your project folder on disk (Chrome/Edge). Multi-file projects. File tree, tabs, drag-and-drop. Supports .tex , .bib , .sty , .cls and more. CodeMirror 6 editor. Syntax highlighting, autocomplete for 70+ LaTeX commands, bracket matching, code folding, snippets, dark/light theme. Command palette. Quick access to actions via keyboard shortcut. Snippet picker. Math environments, document structures, Greek letters, common commands. Searchable and categorized. Works offline. Once loaded, the app works without an internet connection. Compilation is local, editing is local. Packages you've compiled with before are cached; only a package you've never used needs the network once. Project templates. Start from scratch or pick a template (article, thesis, beamer, report, CV, letter, minimal). How it works under the hood There's no magic and no backend. Editor. Built on CodeMirror 6 with a custom LaTeX grammar (Lezer parser), autocomplete provider, and theme system. The editor supports multiple open files via tabs and syncs content with both the local filesystem and the in-memory git working tree. Compiler. LaTeX compilation uses SwiftLaTeX 's pdfTeX engine compiled to WebAssembly. The engine runs in a memory filesystem (MEMFS), where your project files are written before each compilation. When the engine asks for a file it doesn't have (a class, package, font, ...), the service worker resolves it through a chain: previously cached files first, then the package subset bundled with the app, then a TeX Live mirror (a texmf-dist mirror on jsDelivr, with a community SwiftLaTeX server as fallback). Every resolved file is stored in the browser's cache storage, so each package is downloaded at most once. After the first successful compile, the bundled subset is also prefetched in the background so the core package set works offline. Git. All git operations use isomorphic-git , a pure JavaScript implementation of git. The repository lives in an in-memory filesystem ( LightningFS ) backed by IndexedDB. Your project files are synced between the local filesystem and the git working tree. Remote operations (push/pull/clone) go through a CORS proxy since browsers can't speak the git protocol directly. PDF viewer. Rendered with pdf.js , Mozilla's PDF rendering library. Supports multi-page rendering with a text layer for selection and search. File system. The app uses the File System Access API to read/write your actual files on disk. This requires a Chromium-based browser (Chrome, Edge, Arc, Brave). For other browsers, there's a fallback using the Origin Private File System (OPFS). Frontend. SvelteKit with the static adapter. The entire app is pre-built to static HTML/CSS/JS and deployed to GitHub Pages. No SSR, no API routes, no server. Tailwind CSS handles styling. Known limitations pdfTeX only. No XeTeX or LuaTeX, so fontspec , polyglossia and anything else that needs them won't compile. No bibtex or biber. The engine doesn't ship either. Documents using biblatex get a plain thebibliography generated from the .bib file, so references show up but the citation style is ignored. Classic bibtex workflows need a .bbl in the project. A real bibtex in WASM is next on the list. TeX Live 2020 era. Packages are pinned to the same era as the engine's format file, so newer package versions aren't available. Git remotes need a CORS proxy. Browsers can't speak the git protocol directly. The default proxy is configurable, see below. Direct folder access is Chromium only. Firefox and Safari fall back to a virtual filesystem, see Browser support . Security and privacy Everything runs in your browser. Your files never leave your machine unless you explicitly push to a remote. No telemetry, no analytics, no tracking. No accounts, no cookies, no data collection. Git authentication tokens are stored in your browser's localStorage. They never touch a server I control. LaTeX compilation happens in a WebAssembly sandbox. There are no shell commands being executed. No pdflatex , no exec() , no spawn() . Git operations use a JavaScript library, not CLI commands. No command injection is possible. The CORS proxy for git remotes is a known trade-off. By default it uses cors.isomorphic-git.org (the isomorphic-git project's public proxy). You can point it at your own if you prefer. Packages that aren't bundled are fetched from public TeX Live mirrors on demand. Only package filenames are sent, never your document content. Fetched files are cached locally, so this happens once per package. The fallback server can be changed or disabled entirely via the texliveMirror preference (empty string turns it off). LaTeX and TeX are free and open-source software. This project uses them. It doesn't redistribute or modify their source. Tech stack Layer Technology Framework Svelte 5 + SvelteKit (static adapter) Editor CodeMirror 6 + custom LaTeX language support Compiler pdfTeX via WebAssembly (SwiftLaTeX) Git isomorphic-git + LightningFS PDF pdf.js Styling Tailwind CSS 4 Language TypeScript Deployment GitHub Pages Running locally git clone https://github.com/swimmingbrain/texbrain.git cd texbrain pnpm install pnpm dev Open http://localhost:5173 in Chrome or Edge. Browser support Full functionality requires the File System Access API, which is available in Chromium-based browsers (Chrome, Edge, Arc, Brave, Opera). Firefox and Safari can still use the editor with the virtual filesystem fallback, but won't be able to read/write directly to local folders. License MIT Built by Braian Plaku