Skip to main content
Fixed a code typo; added URL; wording
Source Link
andselisk Mod
  • 38.4k
  • 16
  • 47

\rm shouldn't be used at all as it's a deprecated command existing solely for the backward compatibility. Historically, the two-letter commands such as \it, \bf and \rm are the inheritance of the old $\mathrm{\LaTeX}$ 2.09 and AMS-$\mathrm{\LaTeX}$ 1.1 and are not the part of the current production-level $\mathrm{\LaTeX}2ε$ and probably will be dropped entirely in the upcoming $\mathrm{\LaTeX}3$.

There are two main reasons for not to use \rm from the perspective of a $\mathrm{\LaTeX}$ system:

  1. As it's not a part of $\mathrm{\LaTeX}$, ususally document classes define it as such so that in most cases \rm is equivalent to \normalfont\rmfamily — but there is no standard. Also, some classes such as KOMAKOMA-Script recently dropped the support for \rm completely.

  2. All two-letter commands including \rm are not orthogonal, e.g. the order these commands are given is important and you cannot supply certain font attributes.

\mathrm, on the other hand, only adds math roman typeface and is lacking all these limitations or \rm. As for MathJax, I don't fully understand the reason for keeping \rm, but it is there (compatibility with legacy version, maybe?), buteven though its usage is undesirable as it produces the code that is semantically incorrect and may cause potential problems in the future when MathJax getsreceives a major update.

Addressing you issue with the code formatting, passing the text you want to be an upright math font as an argument to \mathrm{…}, e.g. x_\mathrm{y + z} $(x_\mathrm{y + z})$, always works correctly no matter how many symbols you have. Although for a single symbol \mathrm␣<symbol>, e.g. x_\mathrm{ y} + z $(X_\mathrm{y} + z)$$(X_\mathrm y + z)$, will do. Enclosing {\mathrm foo bar} in curly braces won't turn the upright mode on as it were in case with {\rm foo bar}, so please avoid using it as such unless you know what you doing, e.g. with X_{\mathrm y + z} $(X_{\mathrm y + z})$.

Speaking of code readability, I don't see any difference between \rm and \mathrm. $\mathrm{\LaTeX}$ syntax in general is considered cumbersome by many, but there is no sane alternative yet. If you are really upset with how the MathJax code reads on SE, you can use some text editor with advanced syntax highlighting for editing and writing your posts. Sure, you don't get instant preview out of the box, but OMG look at all these colors:)

VSCode rocks

\rm shouldn't be used at all as it's a deprecated command existing solely for the backward compatibility. Historically, the two-letter commands such as \it, \bf and \rm are the inheritance of the old $\mathrm{\LaTeX}$ 2.09 and AMS-$\mathrm{\LaTeX}$ 1.1 and are not the part of the current production-level $\mathrm{\LaTeX}2ε$ and probably will be dropped entirely in the upcoming $\mathrm{\LaTeX}3$.

There are two main reasons for not to use \rm from the perspective of a $\mathrm{\LaTeX}$ system:

  1. As it's not a part of $\mathrm{\LaTeX}$, ususally document classes define it as such so that in most cases \rm is equivalent to \normalfont\rmfamily — but there is no standard. Also, some classes such as KOMA recently dropped the support for \rm completely.

  2. All two-letter commands including \rm are not orthogonal, e.g. the order these commands are given is important and you cannot supply certain font attributes.

\mathrm, on the other hand, only adds math roman typeface and is lacking all these limitations or \rm. As for MathJax, I don't fully understand the reason for keeping \rm, but it is there (compatibility with legacy version, maybe?), but its usage is undesirable as it produces the code that is semantically incorrect and may cause potential problems in the future when MathJax gets a major update.

Addressing you issue with the code formatting, passing the text you want to be an upright math font as an argument to \mathrm{…}, e.g. x_\mathrm{y + z} $(x_\mathrm{y + z})$, always works correctly no matter how many symbols you have. Although for a single symbol \mathrm␣<symbol>, e.g. x_\mathrm{y} + z $(X_\mathrm{y} + z)$, will do. Enclosing {\mathrm foo bar} in curly braces won't turn the upright mode on as it were in case with {\rm foo bar}, so please avoid using it as such unless you know what you doing, e.g. with X_{\mathrm y + z} $(X_{\mathrm y + z})$.

Speaking of code readability, I don't see any difference between \rm and \mathrm. $\mathrm{\LaTeX}$ syntax in general is considered cumbersome by many, but there is no sane alternative yet. If you are really upset with how the MathJax code reads on SE, you can use some text editor with advanced syntax highlighting for editing and writing your posts. Sure, you don't get instant preview out of the box, but OMG look at all these colors:)

VSCode rocks

\rm shouldn't be used at all as it's a deprecated command existing solely for the backward compatibility. Historically, the two-letter commands such as \it, \bf and \rm are the inheritance of the old $\mathrm{\LaTeX}$ 2.09 and AMS-$\mathrm{\LaTeX}$ 1.1 and are not the part of the current production-level $\mathrm{\LaTeX}2ε$ and probably will be dropped entirely in the upcoming $\mathrm{\LaTeX}3$.

There are two main reasons for not to use \rm from the perspective of a $\mathrm{\LaTeX}$ system:

  1. As it's not a part of $\mathrm{\LaTeX}$, ususally document classes define it as such so that in most cases \rm is equivalent to \normalfont\rmfamily — but there is no standard. Also, some classes such as KOMA-Script recently dropped the support for \rm completely.

  2. All two-letter commands including \rm are not orthogonal, e.g. the order these commands are given is important and you cannot supply certain font attributes.

\mathrm, on the other hand, only adds math roman typeface and is lacking all these limitations or \rm. As for MathJax, I don't fully understand the reason for keeping \rm, but it is there (compatibility with legacy version, maybe?), even though its usage is undesirable as it produces the code that is semantically incorrect and may cause potential problems in the future when MathJax receives a major update.

Addressing you issue with the code formatting, passing the text you want to be an upright math font as an argument to \mathrm{…}, e.g. x_\mathrm{y + z} $(x_\mathrm{y + z})$, always works correctly no matter how many symbols you have. Although for a single symbol \mathrm␣<symbol>, e.g. x_\mathrm y + z $(X_\mathrm y + z)$, will do. Enclosing {\mathrm foo bar} in curly braces won't turn the upright mode on as it were in case with {\rm foo bar}, so please avoid using it as such unless you know what you doing, e.g. with X_{\mathrm y + z} $(X_{\mathrm y + z})$.

Speaking of code readability, I don't see any difference between \rm and \mathrm. $\mathrm{\LaTeX}$ syntax in general is considered cumbersome by many, but there is no sane alternative yet. If you are really upset with how the MathJax code reads on SE, you can use some text editor with advanced syntax highlighting for editing and writing your posts. Sure, you don't get instant preview out of the box, but OMG look at all these colors:)

VSCode rocks

Source Link
andselisk Mod
  • 38.4k
  • 16
  • 47

\rm shouldn't be used at all as it's a deprecated command existing solely for the backward compatibility. Historically, the two-letter commands such as \it, \bf and \rm are the inheritance of the old $\mathrm{\LaTeX}$ 2.09 and AMS-$\mathrm{\LaTeX}$ 1.1 and are not the part of the current production-level $\mathrm{\LaTeX}2ε$ and probably will be dropped entirely in the upcoming $\mathrm{\LaTeX}3$.

There are two main reasons for not to use \rm from the perspective of a $\mathrm{\LaTeX}$ system:

  1. As it's not a part of $\mathrm{\LaTeX}$, ususally document classes define it as such so that in most cases \rm is equivalent to \normalfont\rmfamily — but there is no standard. Also, some classes such as KOMA recently dropped the support for \rm completely.

  2. All two-letter commands including \rm are not orthogonal, e.g. the order these commands are given is important and you cannot supply certain font attributes.

\mathrm, on the other hand, only adds math roman typeface and is lacking all these limitations or \rm. As for MathJax, I don't fully understand the reason for keeping \rm, but it is there (compatibility with legacy version, maybe?), but its usage is undesirable as it produces the code that is semantically incorrect and may cause potential problems in the future when MathJax gets a major update.

Addressing you issue with the code formatting, passing the text you want to be an upright math font as an argument to \mathrm{…}, e.g. x_\mathrm{y + z} $(x_\mathrm{y + z})$, always works correctly no matter how many symbols you have. Although for a single symbol \mathrm␣<symbol>, e.g. x_\mathrm{y} + z $(X_\mathrm{y} + z)$, will do. Enclosing {\mathrm foo bar} in curly braces won't turn the upright mode on as it were in case with {\rm foo bar}, so please avoid using it as such unless you know what you doing, e.g. with X_{\mathrm y + z} $(X_{\mathrm y + z})$.

Speaking of code readability, I don't see any difference between \rm and \mathrm. $\mathrm{\LaTeX}$ syntax in general is considered cumbersome by many, but there is no sane alternative yet. If you are really upset with how the MathJax code reads on SE, you can use some text editor with advanced syntax highlighting for editing and writing your posts. Sure, you don't get instant preview out of the box, but OMG look at all these colors:)

VSCode rocks