this post was submitted on 15 Nov 2023
1 points (100.0% liked)

Emacs

311 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

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.

you are viewing a single comment's thread
view the rest of the comments
[–] 00-11@alien.top 1 points 11 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.