I've already used extsizes to change my base font to 8pt and geometry to set my pdf output to 3.5 x 5 from markdown.

I cannot find how to override chapter title alignment (which is set to justify) or chapter title size (which is too large).


I'm passing overrides through command line

pandoc source.md -o output.pdf --toc --toc-depth=2 -V geometry:paperheight=5in -V geometry:paperwidth=3.5in -V geometry:margin=0.25in -V geometry:bottom=0.5in -V documentclass:extarticle -V fontsize:8pt -V include-before:'\newpage' -V setlength:parskip=0pt
  • You can edit the template and use titlesec to format the section commands – DG' Nov 13 '20 at 23:29
  • Thanks @DG'. I'm a developer and have dug through the Latex template from github.com/jgm/pandoc-templates/blob/master/default.latex but cannot determine where to change it. If you have the time, a more detailed answer might get you an accepted click. – mike Nov 14 '20 at 2:33
  • 4
    Solution partially depends on documentsclass, I think also on your main fontsize settings, so for anybody to give you specific solution you should provide manimal example, or working material, MWE, that can be used for testing. If you want to get the job done as soon as possible, without digging deep into latex, look at titlesec doc just as DG already pointed you. If you use standard book documentclass, it should be OK. – Tomáš Kruliš Nov 14 '20 at 8:32

Create a new file with the titlesec settings where you can load titlesec with the desired options, like center, tiny and bf:

% titlesec-conf.tex

enter image description here

Or you can specify each sectioning level with \titleformat:

% titlesec-conf.tex
  {\thechapter} {} {} 

enter image description here

You need to load titlesec-conf.tex with --include-in-header:

$ pandoc in.md --include-in-header=titlesec-conf.tex -o out.pdf

Or you can get pandoc's latex template with pandoc -D latex > mytemplate.latex and add the code form above in the preamble and call pandoc with:

$ pandoc in.md --template=mytemplate.latex -o out.pdf
  • Just a comment from the practical side: While it works the way you suggest, outputting and tweaking the template (-D), or including the generated part (without headers) into a "framing" LaTeX document might be easier. It is also the way to go to use csquotes in pandoc-generated code without going insane. My suggestion: main.tex for the main document, separate prelude.tex for LaTeX header adjustments, generated.tex with contents, auto-generated from pandoc, and a Makefile to rule them all. – Oleg Lobachev Nov 15 '20 at 2:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.