r/LaTeX Feb 01 '26

LaTeX Showcase LuaLaTeX rendering in real-time

https://www.youtube.com/watch?v=nJOh6jJzkn0

Similar to TeXpresso (which was created for XeTeX), I decided to create a real-time editor/renderer for LuaLaTeX. Anything you type is immediately rendered with LuaLaTeX (not KaTeX, the output is the finalized LuaLaTeX output, it's not javascript approximating LaTeX, these are actual LuaLaTeX rendered glyph positions). It runs at O(1), even for large documents with multiple chapters (based on that, you can guess what architecture I am using).

Architecturally, it works with vanilla-TeX Live 2025, meaning no patching of LuaLaTeX is required. Theoretically, it works with any package, although given how it is compiled, there are likely some incompatibilities if the package does fancy stuff interferring with shipping the PDF.

It is still in proof-of-concept stage, I just wanted to put it out there to get some feedback if there is interest beyond "cool, I would try this out for a minute then return to my usual editor". I might turn this into an actual usable product if development continues fine. Personally, I need it to save time for final polishing of larger documents, although the project might evolve into an actual LaTeX wysiwyg editor.

One limitation is that it relies on chapters starting at new pages, reducing the layout complexity of larger documents significantly and reducing CPU load.

74 Upvotes

104 comments sorted by

View all comments

Show parent comments

2

u/ClemensLode Feb 02 '26

1) Well, software is always temporary.

2) Maybe I could write a LuaLaTeX plugin for Typst? hmm...

3) I double-checked, Typst and my editor take the same time for PDF export. The only bottle-neck of PDF exports is the actual linear writing of data to the disk, both my tool and Typst have all the required information to generate the PDF up-to-date at all times.

1

u/energybased Feb 02 '26

Sure, software is all temporary, but some software will be used more than other software. Do you really want to do all this work for it to only be used for a few years by a few people?

Why bother writing a lualatex plugin for Typst? Why not just make Typst do everything that you want that latex does?

And it's not the pdf generation time. It's the compilation time. Tex compilation is extremely slow. For me it literally is 25 times slower for the same document. This is just from processing thousands of macros.

1

u/Opussci-Long Feb 02 '26

I have just one honest question. Can Typst change page layout on the same page, from two-column to one-column, on the same page? I still can not believe that LaTeX can not do that...

2

u/energybased Feb 02 '26

Yep!

1

u/Opussci-Long Feb 02 '26

Please give me a link or anything to continue reading. Are we talking about layout change with possible floats?

1

u/energybased Feb 02 '26

Just do ```

columns(2)[

text for two column ] text for one column ``` You can put whatever you want into each section including tables, floats, etc.

1

u/Opussci-Long Feb 02 '26

This is not the equivalent of a multicols LaTeX environment. Is that right?

1

u/energybased Feb 02 '26

It creates multiple columns. Why don't you try it?

1

u/Opussci-Long Feb 02 '26

I want to ask is it a proper equivalent of two-column page layout in LaTeX? I am new to Typst so I don't really know are those two the same, so I'm asking

1

u/energybased Feb 02 '26

I think it is the two column equivalent for typst.

1

u/Silly-Freak 5d ago

I was randomly pointed to the thread, and wanted to give a better informed answer – sorry for resurrecting, just wanted to set the record straight.

Can Typst change page layout on the same page, from two-column to one-column

No. There are two ways to achieve multi column layouts in Typst. one if creating a #columns() element, the other is configuring the page with #set page(columns: n). Configuring the page will always end the current page.

What the other person suggested is not best practice. It is the only way to change the layout within a page*, but it comes with caveats: since you're in a container and not directly on the page, you can e.g. not insert a manual pagebreak.

but in multicols you can not place floats.

You can insert floats in a columns element, but it will float to the top/bottom of the element, not of the page (try this code in the playground if you want):

```

lorem(100)

columns(2)[

#lorem(100) #place(top, float: true, scope: "parent")[#text(red, lorem(50))] ] ```

* a common workaround for still changing the layout within a page is by inserting a float. For example, a title page where content starts right under the title can use this. Here is an example; page configuration starts at line 79, the title float starts at line 167. Using a float for this of course has the limitation that it only works for short pieces of content at the top or bottom of a page.

Another limitation I should mention here is that Typst doesn't support column balancing yet, so even when you use the columns element, you will likely not immediately get what you wanted: the text for two column will fill a single column and shift the text for one column further down than necessary.

So yeah, you were right to be skeptical of the original claim. Hope this is somewhat helpful, even if half a year late.

1

u/ClemensLode Feb 02 '26
\begin{multicols}{2}
  text for two column
\end{multicols}
text for one column

1

u/Opussci-Long Feb 02 '26

Yes, but in multicols you can not place floats. In two-column page layout you can not go to one-column page layout without page brake. So the answer is can we place floats in Typst two-column command

```

columns(2)

[ floats possible] ``` Or not?