MathJax icon indicating copy to clipboard operation
MathJax copied to clipboard

Port the \textsc Command

Open Libric0 opened this issue 4 years ago • 3 comments

Hello,

In theoretical computer science (like complexity theory), the \textsc - command is the standart notation for algorithmic problems. E.g, image

One can simulate it using \text{AR {\small EACH}} instead of \textsc{AReach}, but this is more than just tedious, especially if you have a problem like image

As I use MathJax to make computer science more accessible to students, it would be very helpful if this command could be ported to standart MathJax.

Thank you for your consideration

Libric0 avatar Mar 17 '21 14:03 Libric0

The MathJax fonts don't currently include a small-caps font, though it could be simulated, I suppose.

In the meantime, you could consider the following:

MathJax = {
  tex: {
    macros: {
      textsc: ['\\style{font-variant-caps: small-caps}{\\text{#1}}', 1]
    }
  },
  chtml: {
    mtextFont: "serif"
  },
  svg: {
    mtextFont: "serif"
  }
}

This will use a non-MathJax font for all text elements, and the \textsc macro applies the browser's small-caps transformation on the text. The weight of the small caps is not ideal, but it may be sufficient for your use.

dpvc avatar Mar 17 '21 14:03 dpvc

PS, according to can-i-use, the font-variant-caps style has good coverage. They indicate it doesn't work in Safari, but I checked it there and it does (Safari 12.1.1), so the only notable hold-out is IE.

dpvc avatar Mar 17 '21 14:03 dpvc

This is a duplicate of #1940

dpvc avatar Mar 11 '22 18:03 dpvc