# Partial support for mathjax

It seems that simple equations cannot be rendered in write.as: see my curve fitting draft. The same formula does work using conventional latex editors such as Overleaf.

Does anyone know how to solve this compatibility issue, or is write.as just not very good for formulas ?

Does it work if you put everything on a single line, like this?

$$f\theta(x) = 1 + (x -\theta2)^{2 + 2\theta_3}$$


I just edited my blog post to show it doesn’t work

One problem is that the subscript _ inside the $$…$$ is sometimes interpreted as markdown italics (in markdown write _this_ to get this ).

I found a hack that solves the problem, one should escape every underscore in mathmode. Instead of writing “_” , write “\_” !

Oh cool, glad you found a workaround! We definitely want to these fix issues with Markdown / MathJax parsing, and there’s actually an old WriteFreely issue for this in particular: #177.

1 Like

I’ll add any other tricks/hacks other users will need to typeset latex.
A new hack was needed when using the align environment: \begin{align*} ... \end{align*}.
Using the “normal” latex syntax (with escaped underscores):

\begin{align*} y &\approx f\_\theta \circ g\_\phi (y) \\ x &\approx g\_\phi \circ f\_\theta (x) \\ \end{align*}


Does not produce the expected aligned equations. Instead, one should use:

\begin{align\*} y &\approx f\_\theta \circ g\_\phi (y) \\\ x &\approx g\_\phi \circ f\_\theta (x) \\\ \end{align\*}


This means two things: one should

• escape the * in the begin & end, giving the syntax \begin{align\*}
• escape the line jumps \\, giving the syntax \\\ at the end of each line

I think a good rule of thumb is: if your latex symbol has meaning in markdown (e.g. _ , *, \, etc), you should escape it in your latex code. This is because the markdown interpretation of the syntax takes precedence over the latex one.

2 Likes

Another issue: when typing the variable $r$ in mathmode, one sometimes writes parentheses () around r: $$r$$ for function values. This will create a registered trademark symbol ® . To avoid this, put spaces $( r )$ around r.

A specific case when one might need to escape symbols is for set notation.
The set { x } is usually obtained using the syntax \{x\}, but for now we need to write \\{ x \\}.