Skip to content

\htmlId and subscripts / superscripts #3675

Discussion options

You must be logged in to vote

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…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by edemaine
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3674 on July 30, 2022 19:59.