Set double spacing and line numbers when converting from Markdown to PDF with pandoc

latex, markdown, pandoc

Solution

There is maybe an easy way: generate a file with the packages we need

 \usepackage{setspace}
 \doublespacing
 \usepackage[vmargin=1in,hmargin=1in]{geometry}
 \usepackage{lineno}
 \linenumbers

I named it options.sty. And use the -H FILE option that includes the content of the FILE at the end of the preamble. (as used in https://github.com/karthikram/smb_git)

 pandoc -H options.sty --bibliography mypaper.bib mypaper.md -o mypaper.pdf 

The advantage is that we don't need to edit the template. To add linenumbers, change margins, and set spacing it works.

Problem

I am using markdown & pandoc for scientific writing, I know I can change margins of the final pdf using Set margin size when converting from Markdown to PDF with pandoc but very often the journals require double lines and line numbers in submitted manuscripts, the question is how to change these, I don't know much about LaTex so I am lost in that jungle. Thanks!

Original source

Related problems