Debian Codegraph @

texmf-dist/doc/latex/checklistings/example.tex

raw
1 \documentclass[a4paper]{article}
2
3 \usepackage[T1]{fontenc}
4 \usepackage[prompt=,prefix=example]{checklistings}
5 \usepackage{listings}
6
7 \lstdefinestyle{camlstyle}{%
8 language=caml,
9 basicstyle=\sffamily,
10 keywordstyle=\bf,
11 literate={"}{\textquotedbl}1,
12 }
13 %BEGIN LATEX
14 \checklistings{codelst={style=camlstyle}}
15 %END LATEX
16 %HEVEA \newstyle{.chklistingerr}{font-style: italic; color: red;}
17 %HEVEA \newstyle{.chklistingmsg}{font-style: italic;}
18 %HEVEA \checklistings{codelst=\{style=camlstyle\}}
19
20 \begin{document}
21
22 \noindent
23 Two simple declarations:
24 \begin{chklisting}
25 let x = 3
26 let f x = x + 1
27 \end{chklisting}
28
29 \noindent
30 and, after compilation with \chklistingcmd, their types:
31 \chklistingmsg{}
32
33 \noindent
34 Then, building on these definitions:
35 \begin{chklisting}[continue,withresult,label=early]
36 let y = f 3
37 \end{chklisting}
38
39 \noindent
40 What about compiler error messages?:
41 \begin{chklisting}[fail]
42 let z = 3 + "four"
43 \end{chklisting}
44
45 \noindent
46 They are also detected:
47 \chklistingerr{}
48
49 \noindent
50 We can continue on from earlier examples:
51
52 \begin{chklisting}[withresult,include=early]
53 let z = f y
54 \end{chklisting}
55
56 \end{document}