phd_thesis_markdown
phd_thesis_markdown copied to clipboard
how to change font size & line spacing of code blocks?
Hi,
Is there a possibility to change the font size and line spacing of code blocks when generating them through markdown?
Thanks & best, Tobias
For the moment, one may also use LaTeX to generate code listings:
Add this to preamble.tex
:
% CODE BLOCKS
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage{color}
\lstdefinestyle{inText}{
language=c,
basicstyle=\small\ttfamily,
% basicstyle=\linespread{0.8}\small\ttfamily,
upquote=true,
stepnumber=1,
numbersep=8pt,
showstringspaces=false,
breaklines=true,
frame=top,
frame=bottom,
aboveskip=1.5em,
belowskip=1.5em,
captionpos=b
}
Generate your code block using:
\begin{lstlisting}[style=mystyle, caption=text]
printf("hello, world");
\end{lstlisting}
Add all code listings to Table of Listings
- create a new file called
listings.md
with the following code:
\addcontentsline{toc}{chapter}{Listings}
\lstlistoflistings
\newpage