How to refer to function argument in math mode

Welcome to the typst Discourse! You can put your code examples between ``` markers to make them more readable. See here for other tips.

It’s a bit hard to know what you have in mind with your second example without seeing a complete (minimal) working example. But generally speaking I think it’s a bad idea to try and do everything in math mode. Writing edge(PY, PZ, "->", $f^*$, right) makes a lot of sense: the dollar signs show what part is actually a math formula. The diagram itself is not a formula.

If you really want to use this shortcut form, I think you’ll have layout problems with the nodes since they are not coded to be math elements. I suppose you could get some things to work, like the edges. To fix the particular issue you have mentioned with shift, you will have to write shift: #(-0.5). I think you will quickly find that the savings in $ characters are quickly lost by the workarounds required to make other things work in math mode :slight_smile:

1 Like