Good morning,

I recently have become enamored of Typst for document creation. It’s fast, it’s approachable, it’s cross platform, and it’s extremely capable even in preview beta. I never really got the swing of LaTeX with all the backslash/curlybrace mayhem.

In any event, I find myself actually working on a long technical document in Typst in Emacs. There does exist typst-ts-mode so thanks tree-sitter and all those people who manage the grammar libraries for it. However I’m finding myself in need of a better way of navigating the huge document to get to sections I want to do.

I looked into the baked-in bookmarks and I could probably use that capability, though I was hoping for more of an customizeable outline mode. Manually setting the bookmarks for an entire document seems tedious. I mainly just want to navigate by headings and that would be sufficient.

What do people use for this sort of thing (possibly in the LaTeX world?) Just bookmarks with some sort of automated way of populating the bookmarks? I did check the typst-ts-mode and while there are some functions there for compiling, there don’t seem to be any functions for navigating by semantic structures. Perhaps that’s baked into tree-sitter itself?

Anyhow, any help greatly appreciated here.

  • 00-11@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    10 months ago

    As /u/mickeyp said, Imenu should do what you want. That presumes that LaTeX mode in Emacs has set up Imenu in a useful way for what you want. If it doesn’t, you can do that yourself - define Imenu’s menus for the mode you’re using (e.g. LaTeX), to recognize the section headers you want, etc.