# Markdown vs latex for thesis

I have to face the decision what markup I use for my thesis (mostly mathematical formulas). I dont want to start learning the chosen language while I should focus on my thesis. I dont know much latex, and I feel that I dont really need to touch it. Because, over the time I got plenty exposure to markdown here on math.stackexchange. And from what I have seen, it seems like a sufficient tool, to do the job.

But since I dont want to run into unpleasant surprises during that potentially stressful time, I want to know better beforehand.

Thanks!

• Read the "Not so short guide to LaTeX": ctan.org/tex-archive/info/lshort/english. If you find it difficult, choose another tool. – CarLaTeX Mar 7 '18 at 18:44
• You can use LaTeX for high level document structure (TOC, abstract, dedication page, bibliography, etc.) and Markdown for basic formatting like sections and lists. It is possible to mix the two in the one document thanks to the Markdown package. I don't think Markdown on it's own is sufficient tool for anything larger than mail or forum post. – michal.h21 Mar 7 '18 at 18:52
• I think you can write a thesis in markdown, if you use the right tools, like pandoc and a nice template. Here is a list, to start with: github.com/jgm/pandoc/wiki/… – DG' Mar 7 '18 at 19:14

Any markdown flavor is indeed a better option than LaTeX to focus on contents and format a document easily with a decent format, no doubt. But the paradise vanishes when you need more than standards sections and bulleted list. Simple formatting options such as centering an image or making two columns are not available.

This is not a criticism of markdown: the purpose of the markdown is to be a very lightweight markup language and perforce should be simple code to make a simple format. This is enough in many cases but not all, and this explain the why there are so many markdown flavors, adding this or that feature, with the result that it is no longer so easy to use (especially when you will need aware of the differences among markdown flavors).

Admittedly, even the most complex flavor is still far easier than LaTeX, but still is rather limited. With LaTeX you have a longer learning curve and it is not so handy, but you can make almost anything you can imagine with respect to document formatting, including drawing (diagrams, statistical graphs, chemical formulas, etc.) and there are are no LaTeX flavors (Plain TeX or ContTeXt are distinct enough not to cause any confusion). Macros, which allow to express complex formulas using readable LaTeX code entities, and modify them seamlessly if needed, are a game changer as well.

So the right decision depends on what you expect of each markup language. A Swiss knife is not the best knife to cut the steak but is better (safer) than a table knife for removing screws, cutting paper, and almost any other purpose.

That said, the good news is that you can use the two knifes at the same time, i.e., you could mix LaTeX with Markdown or Markdown with LaTeX even in the same plain text file.

As suggested in the comments, you can make a LaTeX document using the markdown package (see also the CTAN topic Markup) to simplify some parts as nested lists.

Or you can use one or the more powerful markdown flavors, as Rmarkdown, but write some LateX code inside when this is not enough, for instance, to include a minipage or a complex table that cannot be made in markdown. Pandoc will pass this LaTeX parts as unchanged code when producing the PDF (via LaTeX) or ignore it in another outputs as HTML.

Another part of this integration could be a custom LaTeX template for pandoc (for which you would need a basic knowledge of LaTeX ) and/or YAML headers in the markdown file to have the control over the LaTeX preamble (pass macro definitions and packages to load).

Especially for theses or books, another interesting possibility using Rmarkdown (files with .Rmd extension) is the LaTeX and R integration (R is a statistical language) in a R-noweb document (files with .Rnw extension) via knitr (a R package) with child .Rmd files. The main .Rnw document could be basically a typical LaTeX document that includes, via \include, \input or another LaTeX method LaTeX (.tex, not .Rmd) subdocuments. The trick is that there is also an R chunk in the preamble that allows knitr to call to pandoc during the compilation, and this would make the markdown-LaTeX conversion of child files, so you only have to work with the .Rmd files and compile the .Rnw main file, without the risk of forgetting to update the .tex files

Example:

Chapter1.Rmd:

# My first Chapter
This is a {\huge first} chapter $E=mc^2$

Thesis.Rnw:

\documentclass{book}
<<calltopandoc, echo=F,include=F, engine='sh'>>=
pandoc Chapter1.Rmd --chapters -f markdown -t latex -o Chapter1.tex
@
\begin{document}
\include{Chapter1}
\end{document}

Being a mathematician, for sure you will appreciate also that this allows you to include R outputs (as plots or results of a linear regression) inserting another R chunks (now with the default R engine) in the .Rmd files:

{r test, echo=FALSE}
2+3


as well as in the .tex parts:

<<test,  echo=FALSE>>=
2+3
@

@Fran's response is excellent. I'm in the position of writing my thesis right now, and I've decided to use the Bookdown package, which allows you to stitch together multiple .Rmd files into a final PDF document using pandoc.

https://bookdown.org/yihui/bookdown/

There are also some dedicated R packages such as thesisdown that is specifically designed to facilitate this exact process.

https://github.com/ismayc/thesisdown

I wrote my PhD thesis in the field of software engineering. So my comments are influenced by the requirements of that field.

The learning curve for LaTeX is steep and the payback is terrific. It is worth making the effort.

For a start, you should locate and start with an existing thesis .tex file. There are many available. Check within your own faculty and with peer institutions. It is always easier to start with something that almost works.

You will probably be required to write and submit several papers during your candidature. Most journals provide templates to suit their publications. Typically you only need to change a line or two in your files to re-generate your paper for a different publication.

When you hit stumbling blocks, check this site. Most problems have been encountered by others before you and have already been solved. No need to struggle alone.

Having said the above, I use markdown to generate documentation and other material that I publish on the web. LaTeX is too heavy duty for that purpose. The key takeaway is that when writing a thesis, the bulk of the effort is in thinking and rewriting, not in futzing with formatting issues.

I was wondering the same thing, read Fran's Answer and decided to give RMarkdown a go, in order to do the simple things in Markdown and embed LaTex whenever neccessary.

After 4 hours until finally installing RStudio and friends correctly and another 30mins trying to find out how to reference figures in RMarkdown only to find that it seems to be not possible for code blocks (not even with injecting latex), I'll definitely use LaTex for my thesis. It took me 30 mins there to get three different, customizable versions instead.
Note that maybe it is possible, but as an RMarkdown beginner, I didn't figure that out within reasonable time.

Of course, LaTex took me probably the same time initially to get it to run, so here's how I see the decision: Markdown makes it very easy to do very easy things, but getting something more complicated done (like referencing code blocks) can be frustrating and seem impossible. On the other hand, LaTex takes more getting used to until the easy stuff works, but anything is possible with it.

Personally, I prefer taking 30 minutes to find out so many ways that I cannot decide in which way I want to do it over spending 30 minutes to be 90% sure I won't find out how to do it, but that it partly because I usually want to do somewhat uncommon things.

It may be worth finding out whether there's somebody at your university which you can ask when you stumble upon an issue with LaTex. At my university, there was an optional course on LaTex, and the teacher clearly stated that if we ever have an issue that takes longer than half an hour to solve, we should send him an e-mail.

• Without any clue (mwe) I cannot guess your problem, but remember that markdown parts simply will produce a LaTeX document according a template and the LaTeX parts like \emph{text} will be added unchanged if they can be recognized as LaTeX code, i.e., they are complete commands and complete environments (e.g. \begin{centre} alone will be not regarded as LaTeX code). So, at the end you will have only LaTeX+LaTeX. If that mix does not work well for some reason, you have the option to save the generated .tex file and discover what is wrong in your source. – Fran Nov 20 '18 at 11:05