This site is here to facilitate mathematical and computational discussion. As such, it is often nice to format your questions and responses as nicely as possible - including typeset mathematics, images, and code as appropriate.
Markdown and LaTeX
Textual entry into discourse is based on Markdown - a lightweight markup language that makes formatting relatively easy. Markdown is easy and does a pretty good job of structuring a document into sections, creating lists, tables, images, code, and other formatted text. Many Markdown environments also understand small snippets of LaTeX to create typeset mathematical formulae.
This post gives a brief overview of how to use Markdown and LaTeX together. You can find a more thorough introductions at:
I’m sure you can find many more resources on the web. Be aware, though, that we don’t use LaTeX for document structure, as you might find on Overleaf. Rather, we use Markdown for the overall structure of our post and simple text formatting and we use small LaTeX snippets for typesetting mathematical formulae. Other environments that use a similar approach include
Markdown
As already mentioned, Markdown does a reasonable of setting up overall document structure using a fairly simple syntax. To start this particular section, for example, I simply entered:
## Markdown
Organizing your post into sections or even subsections is a good idea for complicated posts, like we might see in a 400 level writing assignment. Within each section, paragraphs are not a bad idea either.
You can generate paragraphs by simply using two returns. For example,
This would be one paragraph.
And, this would be another.
Formatted text
Text can be formatted in bold, italic, and strike through like so:
Text can be formatted in **bold**, *italic*,
and ~~strike through~~
Lists
We can create the following unordered list
- Item 1
- Item b
- Last item
like so:
- Item 1
- Item b
- Last item
To create a numbered list, just replace the dashes ( -
) with numbers.
Code
Sometimes, we’d like to enter computer code - like I just did above to indicate how to start a section. To do so, just indent your input four spaces. That’s how I input the following:
def f(x):
if x%2 == 0:
return int(x/2)
else:
return 3*x+1
x = 7
while x > 1:
x = f(x)
print(x)
Images
When you’re editing a post, you’ll notice a toolbar with an image uploader, as I’ve circled here:
Of course, I used exactly that to upload that very image!
LaTeX snippets
The forum uses a Javascript library called MathJax to render snippets of LaTeX markup as mathematical formulae. For example, to type the following:
If f(x) = e^{-x^2}, then
I would type in
If $f(x) = e^{-x^2}$, then
$$
\int_{-\infty}^{\infty} f(x) \, dx = \sqrt{\pi}.
$$
Note that the inline mathematics is enclosed in single dollar sings `$like this while larger display style math is enclosed in double dollar signs with line breaks
$$
like this
$$
Note that the Discourse parser requires that the double dollar signs be on separate lines, unlike most LaTeX parsers.