tmaric - 9 months ago 157
LaTeX Question

# How to set the font size for code blocks in pandoc markdown?

this small example:

An example code snippet:

~~~{.cpp}
class A
{
public:
static void f1 () {};

virtual void f2 () = override;
};
~~~


can be used to generate a PDF output with:

pandoc -o block-code.pdf block-code.txt


resulting in

The font sizes of both the code and the text that are equal. How can I change the font size of the code snippets for the pdf (LaTex) pandoc output?

I solved this problem for me by writing several LaTeX snippets into extra files I keep around:

 cat make-code-footnotesize.tex


I have such snippets for all different sizes: huge, LARGE, Large, large, normalsize, small, footnotesize, scriptsize, tiny.
To apply them when running pandoc, just include the respective LaTeX snippet with the -H parameter:
 pandoc -o block-code.pdf block-code.txt \