\htmlId and subscripts / superscripts #3675
-
If I try Similar issue with This is an awesome project, thank you!!! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi Ashok, That's the expected behaviour. As you guessed, the braces are basically groupers; they have various effects on the final output. In general, KaTeX seeks to recreate LaTeX's behaviour, and LaTeX requires nested subscripts to be wrapped in braces, e.g.
will cause an error, but
will not. The same holds for any command that takes an argument, placed in a subscript, so
will give an error, because of
will not, because In your case, the In general, until you're very comfortable with LaTeX, you can avoid a lot of confusing, hard-to-understand bugs if you always include the braces. If you're new to TeX / LaTeX etc. I'd suggest taking a peek at the tex.se and overleaf sites. At the former, you'll find detailed answers to a broad range of questions from some of the most knowledgeable members of the TeX community (just be sure to read the rules of the site before posting); at the latter, you'll find well-documented introductions and tutorials. All the best, Jacob |
Beta Was this translation helpful? Give feedback.
-
Thank you very much Jacob for the useful answer. |
Beta Was this translation helpful? Give feedback.
Hi Ashok,
That's the expected behaviour. As you guessed, the braces are basically groupers; they have various effects on the final output.
In general, KaTeX seeks to recreate LaTeX's behaviour, and LaTeX requires nested subscripts to be wrapped in braces, e.g.
x_1_i
will cause an error, but
x_{1_i}
will not. The same holds for any command that takes an argument, placed in a subscript, so
x_\sin{x}
will give an error, because of
\sin
's argument, however,x_\oplus
will not, because
\oplus
does not take an argument.In your case, the
\htmlId{}{}
command takes two arguments, so the error you're getting is the expected behaviour.In general, until you're very comfortable with LaTeX, yo…