Markdown – create your documents in a new way

Did you ever wonder if there is an alternative to Words, Pages, Writer etc.? Then you may heard of LaTeX. But when you looked at LaTeX markup code, you lost courage.
Every tool mentioned above has its own advantage and reason for being out there in the big software universe.
Today I want to present an alternative, which is easy to learn, very slim in its design and still very powerful concerning formatting issues. And for the LaTeX users: you can still use LaTeX code :)
It is called: Markdown.
Overview:

History of Markdown

For a detailed description please check the website of John Gruber as he is one of the creators of Markdown.

Code examples with Markdown

This is not a code reference, just some examples. For code reference please check the Markdown cheatsheet.

Writing bold

For formatting a word or line bold, just write:
 This is a **bold** word.  
Result:
“This is a bold word.”

Creating a table

Or if you want to create a table:
| the left column | the middle column | the right column |
| ----------------| :---------------: | ---------------: |
| left aligned | center aligned | right aligned | 
Result:
THE LEFT COLUMNTHE MIDDLE COLUMNTHE RIGHT COLUMN
left alignedcenter alignedright aligned

Lists and Headers

With ‘*’ the asterix symbol you can create lists and with ‘#’ headers: (whitespaces are marked with a ‘.’ for better understanding)
# The big topic
## A small topic
### A subtopic

* A birds needs 
....* wings
....* skills
....* air
Result:

The big topic

A small topic

A SUBTOPIC

  • A birds needs
    • wings
    • skills
    • air

Editors for Markdown

For Mac OS you can use iA writer or Byword 2 which I personally use atm. Last one also offers publishing to some blog-domains, like WordPress.
But in principal, you can use any texteditor to write down your Mardown code. You just have to compile it then, with a compiler that understands Markdown language :)
For that, see the section Exporting markdown-files in PDFs, tex, etc..

LaTeX formulas and Mardown

First thing that came into my mind when I heard about Mardown was:
OK, but can I also implement formulas? And how will they be rendered?
As a lot of scientists need to write down formulas to describe an algorithm or some equations, they really love LaTeX for that. Me too. But what if I tell you that is very simple to implement in Markdown

MathJax

MathJax is an open source JavaScript display engine for mathematics that works in all browsers.
(Source: http://www.mathjax.org)
And a powerful one, indeed.
You have two possibilities now:
  1. You have installed ByWord 2
    Then you just put in the beginning of your file the following code line
    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
  2. You write with another editor
    Just use pandoc as a powerful compiler and convert your Mardown-file into what ever, using following command line input:
    pandoc --mathjax yourFile.txt -o yourOutputFile.pdf
Then you can just type your formula like your are used to it in LaTeX:
 $N(n,m)=\sum_{r=0}^{min(n,m)}\binom{n}{r}\binom{m}{r}$
will result in:
N(n,m)=\sum_{r=0}^{min(n,m)}\binom{n}{r}\binom{m}{r}
or more complex multilined algorithms, like the Smith-Waterman algorithm.
$F(i,j)=\max\left\{
\begin{array}{lr}
0\\
F(i-1,j)-d,\\
F(i, j-1)-d,\\
F(i-1,j-1)+ s(x_{i},y_{j})
\end{array}
\right\}.$
F(i,j)=\max\left\{\begin{array}{lr}0\\F(i-1,j)-d,\\F(i, j-1)-d,\\F(i-1,j-1)+ s(x_{i},y_{j})\end{array}\right\}.

Exporting markdown-files in PDFs, tex, etc.

When you use a editor like ByWord, you can use the internal export functions for HTML, PDF or TEX. Exporting to tex-files, I would recommend the compiler pandoc.
You can download pandoc and have a look on the website for more information.
For exporting into tex-files, I really love this command line tool, because it creates very nice LaTeX-code, and you can easily adjust and extend your LaTeX document with your favourite editor and use the features of LaTeX if you want

Thesis and Markdown?

A question that troubled me:
Can I use Markown for writing my thesis?
Actually you can. For that I would advice you to get more information of using pandoc.
There is a command parameter ‘–toc’
pandoc --toc yourFile.txt -o output.html
you can use, for automatically creating a table ocontent. Or you do, what I prefer, converting your main thesis content into LaTeX (with pandoc) and build your own header(with table of content, style, etc.) and footer (i.e. bibliography) with extra LaTeX files. You can then create your thesis by concatenating:
 cat header.tex content.tex footer.tex > thesis.tex
to end up with your final thesis by using all of the powerful formatting options of LaTeX, if you want to.
I found a really cool blog from Will Styler, that describes this method.