How not to get lost in nested brackets?

The code you posted¹ looks to be Typst in math mode², so maybe this won’t be useful to you but…

I find Typst code much more readable when things are placed on new lines. Basically if any function call is using more than 1 or 2 parameters then I break them out onto their own lines:

#table(columns: 3, table.header[A][B][C], align: center, range(3).map( v=> table.cell(v)))

versus

#table(
  columns: 3,
  table.header[A][B][C],
  align: center,
  range(3).map( 
    v=> table.cell(v)
  )
)

Indentation is critical here too.


Re-reading the question makes me realize my answer misses the “automatic” part of your question. Tinymist can auto-format code though it doesn’t by default put things on new lines.


  1. This gives an idea of the problem you are facing but it does not compile when copy/pasted into a blank file. In this case it probably isn’t necessary, but in general it lowers the barrier for trying to answer questions. See https://www.sscce.org/ for best practices
  2. If it is math mode please edit your post and wrap it in ```typm ``` so that the formatting is correct. See How to post in the Questions category