Back to News
Advertisement
sswimmingbrain about 4 hours ago 9 commentsRead Article on github.com

DE version is available. Content is displayed in original English for accuracy.

I'm a master's engineering student and a big fan of LaTeX, which I used for my thesis and research articles. I have used Overleaf and that was fine until I wanted to git sync, which unfortunately sits behind a paywall. Since I didn't want to pay subscriptions for things that should simply just work, I built the editor I wanted in my free time, where you open a tab, write LaTeX, get your PDF and the files stay all in one folder on my disk.

TeXbrain is a static site with no backend. pdfTeX is compiled to WebAssembly (SwiftLaTeX) and runs in your browser. The editor can read and write your project folder through the File System Access API, so you can use git, any local TeX install, local AI Agents, or any other editor on the same files. Git is built in through isomorphic-git for anyone who would rather not touch a terminal and clone, branch, commit, push or pull via commands. No account is needed, no analytics, and everything works offline after the first load.

Try it out: https://tex.swimmingbrain.dev/ (Chromium browsers get direct folder access, while Firefox or Safari fall back to a virtual filesystem)

Or for self-hosting/contributing: https://github.com/swimmingbrain/texbrain (MIT, the pdfTeX engine is EPL 2.0 / GPL 2.0 and is listed in the THIRD_PARTY_LICENSES file).

The part I'm most proud of getting to work is the package loading. The engine itself is only 1.8 MB. When it asks for a file it doesn't have, then a service worker intercepts the request and resolves it through Cache Storage first, then a small bundled subset, then a TeX Live tree mirrored on jsDelivr, then a SwiftLaTeX style server as a last resort. Every file is fetched once at most and after the first successful compilation, the core subset is prefetched in the background so that the offline story actually holds. Only file names go over the network, never any document content.

So far, it only supports pdfTeX (no XeTeX or LuaTeX), so fontspec or polyglossia won't work, packages are pinned to the TeX Live 2020 era to stay coherent with the engine's format file and there is no bibtex or biber in the engine yet, which is maybe the roughest edge.

This is should be a good solution for people on a work laptop, a Chromebook, or a university lab PC where installing TeX Live isn't always an option, and people who don't want to maintain a TeX install at all. If you already have a local setup you like, keep it. This isn't necessarily thought as a replacement for that.

Some people have already used it for their thesis in the past months and their bug reports (which I would never have hit on my own) were then most of the summer's work. The first outside PR also landed recently, so if something doesn't compile for you, an issue with the package name or the bug itself is the most useful thing you can send me!

Advertisement

⚡ Community Insights

Discussion Sentiment

83% Positive

Analyzed from 232 words in the discussion.

Trending Topics

#context#latex#error#tex#file#line#safari#https#wrote#live

Discussion (9 Comments)Read Original on HackerNews

kccqzy•about 3 hours ago
I copy-pasted a random LaTeX doc from many years ago (I made sure I wrote it before 2020 so it did not use any new features not in TeX Live 2020), and upon compilation I got the error

    Font OT1/cmr/m/n/10.95=cmr10 at 10.95pt not loadable: Bad metric (TFM) file.
on line 13017. The document had only 200 lines so this must be from a package. It was really not clear where the error was coming from. I guessed that it was coming from \usepackage{microtype}, so I commented it out, but the same error persisted.

I decided to hard refresh the tab and this time I got a different error:

    TeX capacity exceeded, sorry [text input levels=15].
on line 39. Again it was unclear line 39 of which package.
kccqzy•about 3 hours ago
Does this work on Firefox or Safari? You say “Firefox or Safari fall back to a virtual filesystem” but somehow I can’t get this fallback to work. When I click New Project I just get a reminder to use Chrome or Edge. Is there a button to press to trigger the fallback?
zahrevsky•about 3 hours ago
I'm on Safari, and it seems you can open your local LaTeX file to use the tool. It's an “Open file” button at the top.

Although I agree that it would be cool to have some hello-world example pre-opened.

kccqzy•about 2 hours ago
Ooh. That worked. Thanks.
Gualdrapo•about 4 hours ago
This is super cool. I wish there was something like this for ConTeXt too.
Wdorf•about 3 hours ago
My project https://latex.to supports ConTeXt (plus all other TeX Live engines). Click + then New from showcase then ConTeXt to try it.
thangalin•about 2 hours ago
I wrote a Markdown -> ConTeXt -> PDF editor that may interest you.

* https://keenwrite.com/

* https://keenwrite.com/screenshots.html

kccqzy•about 1 hour ago
Interesting. I usually use pandoc for converting my Markdown, which goes via LaTeX. Is there a specific reason you picked ConTeXt?
copperx•about 4 hours ago
Well done!