Concat multiple md files in a tex file using XeLatex
Remove the -s
(standalone) option. By default the LaTeX output is not a complete document but only the contents of the document environment, ready to be included.
Alternatively, you can also complete documents (i.e., using -s
) and include them in a main document without manual modifications. There are several options here. Take a look to the packages standalone
, docmute
, import
and combine
and the questions about these packages in this site.
Pandoc allows passing multiple input files at once; it will concatenate the files, treating them as if they were one single large file:
pandoc -s -f markdown -t latex file1.md file2.md file3.md -o combined.tex
Note that you can also produce the output PDF directly via pandoc by passing --pdf-engine=xelatex
(or, for pandoc v1.x, --latex-engine=xelatex
). Pandoc will call XeLaTeX for you.
pandoc -s -f markdown --pdf-engine=xelatex file1.md file2.md \
-M documentclass=scrbook -o result.pdf
There are multiple options to modify the LaTeX output produced by pandoc, e.g. setting a classoptions
metavalue, or passing a LaTeX file to be included verbatim in the header via the --include-in-header
parameter.