Skip to content

adding subscripts in expressions #2590

Answered by josdejong
jchatkinson asked this question in Q&A
Discussion options

You must be logged in to vote

For variables names you can use characters like letters, numbers (except as first character), and underscrore _. However the brackets { and } have a special meaning: these are used to create an object like A = {"name": "Joe"}. So you can't use these characters in a variable name.

If you do need something like that, you could maybe do some post processing of the names yourself, like in expressions you use A_rect, and for displaying in tex you replace the part after the underscore with A_{rect}. To achieve that, you can write your own LaTeX handler: https://mathjs.org/docs/expressions/customization.html#handler

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jchatkinson
Comment options

@josdejong
Comment options

Answer selected by jchatkinson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants