An archived instance of a Chaos and Fractals forum

Math input for Math Discourse

mark

Mathematical input in Math Discourse should be entered using snippets of LaTeX which is then interpreted by MathJax. This post describes a bit about how we type that in.

LaTeX and MathJax?

LaTeX is a document preparation tool built for mathematical typesetting. LaTeX is quite a large system enabling book length manuscript. We need only snippets of LaTeX, though - little bits for typing out specific formulae.

MathJax is a Javasript library that interprets just that portion of LaTeX intended to create mathematical formulae.

Using MathJax here

Within the Math Discourse editor, we indicate that we’re going to type LaTeX by delimiting the input with dollar signs; thus our input might look like $latex_input$. For example, if I wanted to write 2x^2-3x+1, I’d type $2x^2-3x+1$.

Often, the code is quite simple like that, it does get more involved for more complicated math. There are specific LaTeX commands that are typically prefixed with a backslash. The Greek symbol \pi, for example, can be typed $\pi$.

Note that single dollar sign delimiters place the mathematics inline, as in the previous paragraph. Sometimes, we want our mathematics to span its own line displaystyle. To do so, we use double dollar signs - each on their own line with the input in between. For example, if I wanted to write

e^{i\pi + 1} = 0,

I’d type

$$
e^{i\pi + 1} = 0,
$$

Some LaTeX commands accept more than one argument. For example, \frac{top}{bot}. I might use this to write

\sin\left(\frac{2\pi}{3}\right) = \frac{\sqrt{3}}{2}

by typing

$$
\sin\left(\frac{2\pi}{3}\right) = \frac{\sqrt{3}}{2}
$$

Note the \left( and \right) used to match the parentheses so they size correctly to contain the content. The use of \left and \right is not strictly necessary but does make the output look quite nice.

Grouping

Braces {like these} are used for grouping in LaTeX. For example, if we want to enter

e^{-x^2},

everything in the exponent should be included in a group. We type that like so: e^{-x^2}.

A trick for learning from the forum

When you see a mathematical formula that someone else has typed into the forum, you can find out exactly how they typed it in by cntrl-clicking on the formula and selecting from the contextual menu

Show Math As > TeX Commands

For example, if I cntrl-click on the \sin(2\pi/3) formula above, I should see something like so:

After I select TeX Commands, a window with the LaTeX Code (excluding $ delimeters) should pop up.

Assistive Editor

You can pull up a math editor that makes it pretty easy to type mathematics under gear button in the editor:

After selecting the math editor, you should see a window that looks like so:

Screen Shot 2021-08-22 at 10.55.53 AM

The formula is typeset immediately as you type. Once done, you can hit the insert equation button to insert the LaTeX code directly into your post. It should be inserted as display mode:

$$
f(x) = 
$$

You can delete one dollar sign on either side to change to inline.