Logo Samuel Gómez

Math on the web seasoned with markdown

Yeahh, so you are looking for a solution to write math fastly. So here is your recipe:


Markdown is your main ingredient. This is a lightweight and super easy markup language that you can use and learn in just five minutes. Don’t you believe me? Let’s see an example:

So, you can write the previous text in virtually any kind of plain text code editor. I am using vim write now, but you can use whatever you want.

Ok, let’s go again, but now with maths


KaTeX is the fastest library to write math on the web I have found. So let’s add some math to our markdown code:

As you can see the last line of our code is a math expression written in other language called LaTeX. This is a common way to write math using a computer. Ok, let’s go to the next step of the tutorial.


LaTeX is a high-quality typesetting setting to produce technical and scientific documents. It is also a common language among mathematicians and physicists who want to produce math with the computer. The old discussion Word vs LaTeX is an never ended issue, but I recommend you to learn LaTeX if you want really to write math using your computer.

There are many cheat-sheet. I recommend you the David Hamman’s cheat sheet to begin.


Finally, you must transform your markdown file to other format. It is important to translate it to a universal format like pdf. In my experience Pandoc is the best tool. It can transform your previous file with three lines to a pdf file with the header, the line of text and the math expression.

This is the command line I use to transform my code to pdf

After this I get my PDF, but if I need an html file I write in the command line:

Pandoc is the perfect tool to transform my markdown file to other formats like pdf or html for the web.

A real example

You can see a real example of math on the web. Good luck and improved effort.

#markdown #html #math #lightweight #katex #latex #pandoc