Last weekend I exported my Jupyter Notebook records into a PDF format file. Surprisingly, the PDF file looks so good that I begin to think about using Jupyter Notebook or Markdown instead of LaTex to write technical papers because LaTex is an extremely powerful but inconvenient tool for writing. Then I created a file named ‘hello.md’:
# Head1 ## First There is a fox on the bank. ## Second Hello
Then using a command line to convert the Markdown file to PDF (if you meet problems like ‘Can’t find *.sty’, just use ‘sudo tlmgr install xxx’):
pandoc -s -f markdown -t latex -o hello.pdf hello.md
The PDF file looks like:
It does works, but the appearance looks too rigid. Then I found the ‘pandoc-latex-template‘. By downloading and installing the ‘eisvogel.tex’, I can generate PDF by:
pandoc --template Downloads/eisvogel.tex -s -f markdown -t latex -o hello.pdf hello.md
And the new style looks as below:
Actually, we can use this template more heavily. Change ‘hello.md’ to:
--- title: "How to write technical papers" author: [Robin Dong] date: "2019-04-19" keywords: [Markdown, pandoc] lang: "en" ... # How to write technical papers ## Install pandoc Visit pandoc website ## Download template Visit [pandoc-latex-template](github https://raw.githubusercontent.com/Wandmalfarbe/pandoc-latex-template/master/examples/basic-example/basic-example.md) ## Equation \begin{equation} E = m c^2 \end{equation} ## Source code ```python import torch a = torch.zeros([2, 3]) print(a) # This is not java ```
Add a file ‘metadata.yaml’ for font:
--- fontsize: 13pt ---
Then the command line:
pandoc --template Downloads/eisvogel.tex -s -f markdown -t latex -o hello.pdf hello.md metadata.yaml --highlight-style tango
The final document looks much more formal: