listings-ocaml.tex 686 Bytes
Newer Older
1 2 3
% Configuring listings for OCaml.

% Comments in blue.
4
\newcommand{\ocamlcommentstyle}{\color{blue}}
5 6 7 8

\lstdefinelanguage{ocaml}[Objective]{Caml}{
  % Fix errors in the default definition of ocaml.
  deletekeywords={closed,ref},
9
  morekeywords={initializer},
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
  % General settings.
  flexiblecolumns=false,
  showstringspaces=false,
  framesep=5pt,
  commentstyle=\ocamlcommentstyle,
  % By default, we use a small font.
  basicstyle=\tt\small,
  numberstyle=\footnotesize,
  % LaTeX escape.
  escapeinside={$}{$},
}

% An abbreviation for \lstinline, with a normal font size.
% To be used in the text of the paper.
\def\oc{\lstinline[language=ocaml,basicstyle=\tt,flexiblecolumns=true]}