An archived instance of Mark's Discourse site as of Tuesday July 18, 2017.

How do I enter groovy typeset mathematics, images, and code?

mark

This site is here to facilitate statistical and computational discussion. As such, it is often nice to format your questions and responses as nicely as possible - including sections, typeset mathematics, images, and code as appropriate.

Sections and other formatting

Creating a section is easy. To create the section heading above, I just typed

##Sections and other formatting

Creating a bulleted list is as easy as indenting with asterisks. To get this:

  • First item
  • Second item
    • A sub item

Just type this:

* First item
* Second item
  * A sub item

To create typeset mathematics, simply enter a LaTeX snippet. For example, to generate this:
$$E(X) = \frac{1}{2},$$
just type this

$$E(X) = \frac{1}{2},$$

Often, we'll want to enter computer code. To do so, just indent your input four spaces. That's exactly how I entered the example section, list, and typesetting code above. Soon enough, we'll learn about the powerful statistical language called R. To generate a list of 1000 normally distributed numbers and compute their mean, for example, just type:

mylist = rnorm(1000)
mean(mylist)

# Out: 0.0213514040328669

We can generate a histogram of the list as follows:

hist(mylist)

Finally, to actually include an image, look for the upload button in the toolbar, which should look something like this: