I’ve recently started exploring Typst and really like how clean and flexible it is compared to traditional document tools.
At the same time, I’ve been experimenting with using AI to speed up things like:
Writing structured content
Generating templates
Automating repetitive formatting
Assisting with documentation
So I’m curious:
Are any of you using AI tools alongside Typst?
If yes, what does your workflow look like?
If not, where do you think AI could actually help (or not help)?
I’m especially interested in real use cases—academic writing, reports, documentation, etc.
I’ve used AI as a tool to help me write Typst code. To that end I use LM Studio plus the Typst Coder 9B model. For example I wanted Typst to highlight character dialog and it suggested the following statement:
#show regex("\"([^\"]*)\""): it => text(fill: blue, weight: "bold", it.text)
That is very handy when proofreading to make sure that quotation marks match.
Hi. I don’t really have much to say. I think this discussion is already on the forum, but it seems that Claude still handles Typst code/markup better. Though I haven’t tried the math mode. And I think it still had array-related syntax errors. So not perfect, but for a rewrite from Python it can help a lot, maybe some scaffolding and stuff.
I usually write code myself anyway, so the only other use case for me is text generation, but that is almost unrelated to Typst, depending on if you have sections and lists. In which case Claude might get the syntax right, but can be worse and text writing part. So probably should add some rules regarding the basic syntax and hope that it will remember it (or make it an automatic part of each prompt).
The workflow is just any website with the Open WebUI style (though duck.ai is the goat) and either copying stuff into clipboard, or into primary selection and then pasting into a text editor.
May I ask you to share the correct way to write this Regex? The code I shared does work and it helped me identify several instances of missing or duplicated quotation marks. It’s not clear to me how the documentation applies to my AI-generated Regex.
Here are some thoughts on the regex/text show rule.
Sorry, I just didn’t think this through, the regex itself is not too bad (but the parentheses are redundant). But on the other hand, actually the rule itself is even worse, now that I look at it again (and see the output). If you want to highlight stuff, just use highlight, though if you need to change text styling, then it’s a different story.
For almost any regex you should use this:
#show regex("\\w+"): set text(blue, weight: "bold")
But since the smart quotes are involved, the generated rule and the show-set rule will kill the smart part, so you’d probably have to do something like this:
#show regex("\"[^\"]*\""): it => text(blue)[*"#it.text.slice(1, -1)"*]
// #show regex("\"[^\"]*\""): it => ["#it.text.slice(1, -1)"]
// #show regex("\"[^\"]*\""): set text(blue, weight: "bold")
If you have any questions, please post a topic in Questions.
to chime into this: I recommend using raw with the .text value of it for writing regex, since you don’t have to escape symbols manually. So you can test your regex first in a tool like https://regex101.com/ and then just copy paste the regex into Typst like following:
#show regex(`\w+`.text): set text(blue, weight: "bold")
#show regex(`"[^"]*"`.text): it => text(blue)[*"#it.text.slice(1, -1)"*]