1

Main question: How KhanAcademy formats latex inside HTML pages?

It means: How can I write \LaTex like code (per example inside the HTML annotation tag below) inside regular HTML pages and it be correctly displayed by browsers. Also how can I extend the latex macros as made below using the \blueE and \redE macros inside the tex-html environment.

Checking the HTML source code from Khan's Academy: Curl in 2 dimensions I came to notice it uses a syntax like:

<math>
<semantics>
<annotation encoding="application/x-tex">
\begin{aligned}
  \text{div}\, \blueE{\textbf{F}}\goldE{(x, y)} = 
  \lim_{\left|\redE{A}_{\goldE{(x, y)}}\right| \to 0}
  \underbrace{
      \dfrac{1}{\left|\redE{A}_{\goldE{(x, y)}}\right|}
      \overbrace{
          \oint_{\redE{C}} \blueE{\textbf{F}} \cdot \greenE{\hat{\textbf{n}}}\;\redE{ds}
      }^{\text{2d-flux through $\redE{C}$}}
  }_{\text{Flux per unit area}}
\end{aligned}
</annotation>
</semantics>
</math>

I know this isn't a pure \LaTeX question, but also isn't a pure HTML5 or CSS3 question, we are here in the grey areas of multi-disciplinarity and I have really high hopes about the higher level of knowledge of \LaTeX community.

Extra question: Where is that \redE came from? I would love to colorize my math in educational papers.

Lin
  • 1,191
  • 4
    I guess that \redE is a predefined color specifier. The LaTeX code is awful. And the question is? – egreg Jun 28 '18 at 14:11
  • 1
    Is your question mostly about how math-ml (markup language) works? Please advise. – Mico Jun 28 '18 at 14:32
  • For coloured math in LaTeX: https://tex.stackexchange.com/questions/21598/how-to-color-math-symbols (And possibly https://tex.stackexchange.com/questions/100619/latex-color-setting-for-math-mode) – Torbjørn T. Jun 28 '18 at 14:35
  • @mico I don't know what my question is about, because I don't know how to accomplish that. What I know is that I want to write LaTeX code (or something VERY similar) inside a regular HTML page and be able to display math correctly. Seems that the way Khan' does allows it even to extend \LaTeX with new macros. And that is very welcome (since I want to write many repetitive things as Taylor's Expansions and indexed functions in a discrete grid.). Being able to get my papers equations and just paste inside a HTML "latexmath" tag is very welcome. – Lin Jun 28 '18 at 15:02
  • 2
    Might it be that an adjusted (?) version of MathJax is used to show the formulas? – albert Jun 28 '18 at 15:03
  • 4
    Looking at the page you link to, it seems rather likely that they're using a slightly modified version of MathJax (called KathJax). See https://www.mathjax.org – egreg Jun 28 '18 at 15:03

0 Answers0