Skip to content

Instantly share code, notes, and snippets.

@y-yu
Created December 4, 2013 05:16
Show Gist options
  • Save y-yu/7782707 to your computer and use it in GitHub Desktop.
Save y-yu/7782707 to your computer and use it in GitHub Desktop.
code inside section
\makeatletter
\def\code{%
\@ifnextchar{|}%
{\code@sect}%
{\code@inline}%
}
\def\code@inline#1{%
\lstinline[style=ocaml, basicstyle=\small\tt, keywordstyle=\small\sl, columns={fullflexible,keepspaces}, mathescape]|#1| }
\def\code@sect|#1|{%
\lstinline[style=ocaml, basicstyle=\tt, keywordstyle=\sl, columns={fullflexible,keepspaces}, mathescape]|#1| }
\makeatother
\code{if e1 then e2 else e3}
\code|if e1 then e2 else e3|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment