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?
You can simply add \small
before the beginning of the code snippet and \normalsize
after (to return to normal).
You can also add other similar commands. For instance, if your document is doublespaced, you can add \singlespace
before the code snippet and \doublespacing
after.
For this to work you need to add in the yaml at the beginning of your document the following:
---
header-includes:
- \usepackage{setspace}
---