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

Emacs

313 readers
2 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.

top 5 comments
sorted by: hot top controversial new old
[–] _viz_@alien.top 1 points 1 year ago (1 children)

Outline + imenu is the way I roll. For automatic bookmarking, you may look at Bookmark+. I believe it has such a functionality.

[–] remillard@alien.top 1 points 1 year ago (1 children)

I tried turning outline mode on, however it turned off typst-ts-mode, so I may have to just work with imenu and see about tweaking it as /u/mickeyp suggests above.

[–] StrangeAstronomer@alien.top 1 points 1 year ago (1 children)

Did you try outline-minor-mode ?

[–] remillard@alien.top 1 points 1 year ago

I didn't see it when I did M-x so I'll check to see if it needs installing.

[–] 00-11@alien.top 1 points 1 year 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.