\LaTeX logo in Mathjax

a slight improvement

latex
typography
Author

baptiste

Published

January 3, 2023

The \LaTeX logo in Mathjax looks rather awful,

\[ \LaTeX \] A cheap workaround is to redefine the macro to something like this,

$$
\renewcommand\LaTeX{%
\rm L\kern-.345em\raise.374ex{\scriptsize A}\kern-.166emT\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX
}
\LaTeX
$$

\[ \renewcommand\LaTeX{% \rm L\kern-.345em\raise.38ex{\scriptsize A}\kern-.166emT\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX } \LaTeX \] which can then be reused throughout the document — \(\LaTeX\).

The positions could be fine-tuned a little better, but the main issue is actually the letter A, which should probably be set in small caps — unfortunately, they don’t seem available in Mathjax’ default font.

A better solution?

The fancy-text extension provides a shortcode for LaTeX in multiple formats, but it appears to simply defer to Mathjax’ implementation:

\LaTeX

gives

\(\LaTeX\)

(since we’ve redefined it)

A more web-native solution might be to define the logo with CSS rules, as in

 <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/dreampulse/computer-modern-web-font@master/fonts.css">
  <style>
    .tex sub, .latex sub, .latex sup {
    font-family: "Computer Modern Serif";
    font-variant: small-caps;
    }

    .tex sub, .latex sub {
    font-family: "Computer Modern Serif";
      text-transform: uppercase;
      vertical-align: 0.125ex;
      margin-left: -0.1667em;
      margin-right: -0.16em;
    }

    .tex, .latex, .tex sub, .latex sub {
    font-family: "Computer Modern Serif";
      font-size: 1em;
    }

    .latex sup {
    font-family: "Computer Modern Serif";
      font-size: 0.9em;
      vertical-align: -0.3em;
      margin-left: -0.35em;
      margin-right: -0.15em;
    }
    </style>

with

<span class="latex">L<sup>a</sup>T<sub>e</sub>X</span>

producing

LaTeX

Last Updated: 06 January 2023

Reuse