1 %% Do not edit unless you really know what you are doing.
2 \documentclass[a4paper,12pt]{article}
3 \usepackage[T1]{fontenc}
4 \usepackage[latin9]{inputenc}
11 \section{Minted Listings}
13 Inline: \mintinline[style=bw]{C++}!int a=5;!\\
14 Float (Listing~\ref{Example-Listing}):
17 \begin{minted}{Python}
18 # Example listing float
20 'this is a python function'
23 \caption{Example Listing float}
24 \label{Example-Listing}
27 Here is an example listing with left line numbering, language ``Python''
28 and ``Space~as~symbol'', range lines from 4 to end:
30 \begin{minted}[firstline=4,numbers=left,showspaces=true]{Python}
32 'this is a python function'
35 'This is a German word: Tschüß'
39 A floating one-liner with [h] placement and without caption:
41 \begin{minted}[fontfamily=tt,fontsize={\large},bgcolor=lightgray]{ABAP}
46 Another inline listing:
47 \mintinline{TeX}!\begin{centering} hello!
49 A non-floating listing with line frames and a top caption
50 (Listing~\ref{hello-world}):
51 \lyxmintcaption[t]{An example C program\label{hello-world}}
52 \begin{minted}[numbers=left,frame=lines]{C}
55 printf("Hello world!\n");
60 A non-floating listing with line frames and a bottom caption
62 \begin{minted}[numbers=left,frame=lines]{Fortran}
67 end subroutine function
69 \lyxmintcaption[b]{\label{func}A Fortran subroutine}
71 A framed floating listing with a caption and a label (Listing~\ref{python1}):
73 \begin{minted}[frame=single]{Python}
74 def boring(args = None):
77 \caption{A Python function.}
82 The same framed floating listing with a caption, a label and a stray math
83 equation (Listing~\ref{python2}):
86 \begin{minted}[frame=single]{Python}
87 def boring(args = None):
90 \caption{The previous Python function.}