A very brief intro to typesetting math in markdown

Intro

For my CSCI 3358 class this year, we are using Jupyter notebooks (via Google Colab) to tackle homework problems that are a mix of coding and proof writing. Without getting too into the weeds on what these notebooks are, they are typically identified with a .ipynb file extension. You can open these notebooks through Google Colab or through Jupyter.

One benefit of these notebooks is that we can isolate our Python code to run in cells, which might only be run one at a time, and might be split by text. For our homeworks, this text will include non-coding questions. Some of these will require proofs or typing up some other math. The text cells of a Jupyter notebook support Markdown for formatting. For math, the Markdown syntax largely aligns with \(\LaTeX\), which is a typesetting language often used to generate PDFs.

I truly believe practicing your markdown will help many of you in future careers or hobbies— it’s commonly used for software engineers writing documentation on Github repos and in web development (this page is in markdown). If you don’t want to use markdown to typeset math, please submit your submissions (photos of handwritten math?) to me via the Canvas.

If you’re new to markdown/\(\LaTeX\), there are a few things to know:

  • To enter and leave math mode in the middle of a sentence, use two dollar signs $$. For example, we can type \(\Pr_D[\mathcal{A}(D) = s] \geq \epsilon\) in the math environment.
  • Once in math mode, pretty much any of the LaTeX symbols are fair game.
  • Some important ones:
    • \(\frac{a}{b+c} \geq e^{x}\) is written by \frac{a}{b+c} \geq e^{x}.
    • Sperscripts use the carrot ^, and subscripts use the underscore _. For example \(a^2_i\) is written a^{2}_{i}. You can next superscripts and subscripts, but you shouldn’t need to.
    • If you want to type words in math mode, you can use \text{your text here}; otherwise, it will not render spaces.
    • Add a little spice to a variable with \(\hat x =\)\hat{x} or \(\tilde x =\)\tilde{x}.

Github also has much more expansive docs on typesetting math markdown. If you’re curious about \(\LaTeX\), check out Bo Waggoner’s Jumpstart LaTeX post.




Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • Another faculty job market anecdote
  • Diversity, Equity, and Inclusion in Academia
  • Unsolicited advice on graduate applications
  • NSF GRFP Example