# How to format posts, including math and code

**URL:** <https://www.rubin.community/t/how-to-format-posts-including-math-and-code/38>\
**Category:** Meta\
**Tags:** forum-howto\
**Created:** [August 10, 2015, 9:16pm UTC](https://www.rubin.community/t/how-to-format-posts-including-math-and-code/38 "2015-08-10T21:16:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsick](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/jsick/32/672_2.png) [@jsick](https://www.rubin.community/u/jsick)\
**Post date:** [August 10, 2015, 9:16pm UTC](https://www.rubin.community/t/how-to-format-posts-including-math-and-code/38/1 "2015-08-10T21:16:53Z")

</div>

You can format posts to _[community.lsst.org](https://community.lsst.org)_ using [Markdown](http://daringfireball.net/projects/markdown/) or HTML. Math expressions can even be typeset using standard LaTeX notation.

Much of the formatting can be done with the toolbar at the top of every editing window, but if you’re interested in learning how to format with simple markup, read on.

## Markdown Basics

### Headers

You can can organize your post into sections by creating headers. Simply prepend the section title with `#`, and repeat the `#` character to signify the level of the heading. For example, the headers here were written as

```
## Markdown Basics

### Headers

```

For posts we recommend you start with a Level 2 header, i.e., `## Title`. The Level 1 header is effectively the topic’s title.

### Emphasis

Add nuance to your writing with _italic_ (created via `*italics*`) and **bold** (` **bold** ``) typefaces.

### Links

You can write links using Markdown’s `[text](url)` syntax. For example, [LSST DM](http://dm.lsst.org) was written as `[LSST DM](http://dm.lsst.org)`.

The forum will also automatically hyperlink any text that can be interpreted as a URL, for example: [http://dm.lsst.org](http://dm.lsst.org).

**Tip** : If you link to another post on this forum, that topic’s title will appear in the sidebar of your post.

### Lists

Create bullet lists by prepending `-` or `*` to each item. For example:

```auto
- item one
- item two

```

renders as

- item one
- item two

Numbered lists can created by prepending each line with the item number and a period. For example:

```auto
1. item one
2. item two

```

renders as

1. item one
2. item two

You can create sub-lists by indenting three spaces relative to the parent list and adding a line between each item. For example:

```auto
1. Item one

2. Item two

   * foo
   * bar

3. Item three

```

renders into:

1. Item one

2. Item two

3. Item three

### Code snippets

You can write inline code snippets and other pre-formatted text using the back tick delimiter (```). For example, ``import lsst`` renders as `import lsst`.

To include blocks of code, surround the section with a GitHub-style ‘code fence’ consisting of three back ticks before and after the code. For example,

````
```
import numpy as np
import lsst
```

````

renders as

```auto
import numpy as np
import lsst

```

The forum will try to guess what programming language you’re writing and highlight that code. If you need to override that, add the language’s name after the first set of back ticks. For example:

````
```python
import numpy as np
import lsst
```

````

Support languages include: `bash`, `cpp`, `diff`, `xml`, `http`, `json`, `java`, `javascript`, `makefile`, `markdown`, `ruby`, `perl`, `python`, `sql`. Use `text` to disable highlighting.

### Tables

Our Discourse platform [doesn’t support GitHub Flavored Markdown-style tables](https://meta.discourse.org/t/markdown-table-support-in-a-discourse-topic/13546?u=jsick) at the moment.

In the meantime, you can create plaintext tables with code fences and the ‘`text`’ tag (see above). Consider using the [GitHub Flavoured Markdown table syntax](https://help.github.com/articles/github-flavored-markdown/#tables) to be future-proof.

If you’re particularly ambitious, you can also markup your table in HTML.

### Images

Just drag-and-drop images from your filesystem onto the editor window. This will upload the image to the _[community.lsst.org](https://community.lsst.org)_ server and add the appropriate markup to your post.

## Writing Math in LaTeX

_[community.lsst.org](https://community.lsst.org)_ uses [MathJax](https://www.mathjax.org) to render mathematical expressions in the browser using the LaTeX markup you already know and love.

### Inline Math Expressions

To write an inline expression, just enclose the LaTeX markup with single dollar signs (`$`).

For example, `$m = -2.5 \log_{10}(F)$` renders into $m = -2.5 \log\_{10}(F)$.

### Display Math

To make an expression render onto its own line (i.e., display math), enclose the expression in double dollar signs (`$$`).

For example, `$$\ln\,p(y\,|\,x,\sigma,m,b,f) = -\frac{1}{2} \sum_n \left[\frac{(y_n-m\,x_n-b)^2}{s_n^2} + \ln \left ( 2\pi\,s_n^2 \right ) \right]$$` renders as $$\ln,p(y,|,x,\sigma,m,b,f) = -\frac{1}{2} \sum\_n \left[\frac{(y\_n-m,x\_n-b)^2}{s\_n^2} + \ln \left ( 2\pi,s\_n^2 \right ) \right]$$

**Tip** : with the `$$` delimiter, you don’t have use type newlines for the expression to appear on its own line.

(Hat tip to [Dan Foreman-Mackey](http://dan.iel.fm/emcee/current/user/line/) for this likelihood function example.)

### Multiple Equations

If you have multiple equations and would like to align them, use the `align` environment. For example,

```auto
\begin{align}
\nabla \cdot \bf{E} & = \frac{\phi}{\epsilon_0} \\
\nabla \cdot \bf{B} & = 0 \\
\nabla \times \bf{E} & = -\frac{\partial \bf{B}}{\partial t} \\
\nabla \times \bf{B} & = \mu_0 \left( \bf{J} + \epsilon_0 \frac{\partial \bf{E}}{\partial t} \right)
\end{align}

```

renders as

\begin{align}  
\nabla \cdot \bf{E} & = \frac{\phi}{\epsilon\_0} \  
\nabla \cdot \bf{B} & = 0 \  
\nabla \times \bf{E} & = -\frac{\partial \bf{B}}{\partial t} \  
\nabla \times \bf{B} & = \mu\_0 \left( \bf{J} + \epsilon\_0 \frac{\partial \bf{E}}{\partial t} \right)  
\end{align}

* * *

[Learn more about using the LSST Community forum →](http://www.rubin.community/tags/forum-howto)

---

<div class="post-metadata">

**Author:** ![jsick](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/jsick/32/672_2.png) [@jsick](https://www.rubin.community/u/jsick)\
**Post date:** [August 14, 2015, 4:28pm UTC](https://www.rubin.community/t/how-to-format-posts-including-math-and-code/38/2 "2015-08-14T16:28:03Z")

</div>

2 posts were split to a new topic: [Markdown or restructuredText for DM?](https://www.rubin.community/t/markdown-or-restructuredtext-for-dm/71)

---

<div class="post-metadata">

**Author:** ![mahmud.nobe](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@mahmud.nobe](https://www.rubin.community/u/mahmud.nobe)\
**Post date:** [July 28, 2025, 10:16pm UTC](https://www.rubin.community/t/how-to-format-posts-including-math-and-code/38/4 "2025-07-28T22:16:59Z")

</div>

The equations are not rendering correctly just using dollar signs ($):  
$m = -2.5 \log\_{10}(F)$  
Is there something I need to add/change?

---

<div class="post-metadata">

**Author:** ![jsick](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/jsick/32/672_2.png) [@jsick](https://www.rubin.community/u/jsick)\
**Post date:** [July 29, 2025, 5:01pm UTC](https://www.rubin.community/t/how-to-format-posts-including-math-and-code/38/5 "2025-07-29T17:01:07Z")

</div>

Sorry about that @mahmud.nobe, our MathJax integration broke and we’re looking into restoring it.
