mathjax / MathJax

Beautiful and accessible math in all browsers
http://www.mathjax.org/
Apache License 2.0
10.22k stars 1.16k forks source link

Port the \textsc Command #2652

Open Libric0 opened 3 years ago

Libric0 commented 3 years ago

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

dpvc commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

This is a duplicate of #1940