I do not understand well, why is so much preferred \mathrm to \rm for index formatting ?
(by occurrence and by user script formatting support.)
Note that I currently use LaTeX/MathJax only in context of SE posts. I have in mind mostly uniform text formatting and MathJax mathematical formulas. Advanced LaTeX documents with document text formatting are probably a different case.
If my understanding is correct, their effect is the same, but they differ in their default scope and delimiting syntax.
The \rm must be explicitly delimited, with \rm being inside delimiters.
\mathrm by default applies to a single character only, with \mathrm outside of delimiters {}.
This theoretically gives an advantage to \mathrm for single letter indexing.
But even in this case, the \rm way to create the source formatting code seems to me as more compact and in case of complex formula more easily to track mentally.
For 2+ symbol indexes, this mentioned advantage of \mathrm disappears, as {} delimiting is needed in both cases.
I ask, because if others apply intensive \mathrm formatting of complex formulas with many indexes, it may convert a relatively compact expression into a "huge formatted beast", difficult to be read and work with at the source code level even for its author.
Later editing of such a formula may be a nightmare.
One solution for me is to create 2(or 4) regex replace expressions to toggle \mathrm (or \rm) index "romanizing" to get the formula readable again for editing/reusing, and then toggle it back.
Some code examples are intentionally wrong for illustrative purposes:
\$\$K_K_{\rm x} K_\mathrm x K\$\$K
\$\$K_K_{\rm xy} K_\mathrm xy K\$\$ wrongK wrong
\$\$K_K_{\rm xy} K_{\mathrm xy} K\$\$K wrong
\$\$K_K_{\rm xy} K_\mathrm {xy} K\$\$K
\$\$K_\rmK_\rm {xy} K_\mathrm {xy} K\$\$ wrongK wrong
$$K_{\rm x} K_\mathrm x K$$ $$K_{\rm xy} K_\mathrm xy K$$ $$K_{\rm xy} K_{\mathrm xy} K$$ $$K_{\rm xy} K_\mathrm {xy} K$$ $$K_\rm {xy} K_\mathrm {xy} K$$