Old font command support: \rm, \sf, \tt, \bf, \it #675
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #252 by supporting old LaTeX (2.09)
\rm
,\sf
,\tt
,\bf
,\tt
commands. (\sl
and\sc
aren't supported because their analogous\textsl
and\textsc
aren't supported in KaTeX, from lack of fonts.) These old (LaTeX 2.09) font commands are defined inarticle.cls
as follows:The last argument is how they behave in math mode. For example,
\rm xxx
behaves like\mathrm{xxx}
in math mode but\normalfont\rmfamily xxx
(not supported by KaTeX) in text mode, whereas\sl xxx
behaves like\textsl{xxx}
.I also noticed that the parsing of implicit groups didn't correctly parse spaces. For example,
\text{x\large y}
outputs a space in current KaTeX, but not LaTeX (the space is part of the macro name). This is now fixed for size and styling commands, in addition to the newly supported old-font commands.This was surprisingly easy to implement -- unfortunately, because existing font commands (e.g.
\textbf
) are implemented as if they are full-reset commands (like\bf
), whereas they are only supposed to set one aspect of the font. That's for another issue... (#676)