module Verbatim:sig
..end
val verbatim : string -> Latex.t
symbol
command, all spaces by escaped spaces, and all new lines
by actual new lines.val regexps : (Str.regexp * (string -> Latex.t)) list ->
(string -> Latex.t) -> string -> Latex.t
regexps [r1, a1; r2, a2; ...] f s
: apply a1
on all matches of r1
in s
, then a2
on all matches of r2
, and so on.
Note that r2
is only tested on the parts of s
which do not match r1
.
f
is applied on the parts of s
which are not matched by any of the
regular expressions.val keywords : ?apply:(Latex.t -> Latex.t) -> string list -> string -> Latex.t
keywords k s
: apply verbatim
on s
but also apply ~apply
on all
keywords given in k
. The default value of ~apply
is textbf
(bold
font).
keywords ["let"; "in"]
is the same as
regexps [Str.regexp "let\\|in", fun x -> textbf (verbatim x)] verbatim
.
val pseudocode : ?trim:(string -> string) ->
?id_regexp:Str.regexp ->
?kw_apply:(Latex.t -> Latex.t) ->
?id_apply:(Latex.t -> Latex.t) ->
?rem_apply:(string -> Latex.t) ->
?keywords:string list ->
?symbols:(string * Latex.t) list ->
?keyword_symbols:(string * Latex.t) list ->
?underscore:Str.regexp -> string -> Latex.t
trim
: apply this function first (default is trim ['\n']
)id_regexp
: the regular expression used to parse identifiers,
including keywords (default is words starting with a letter or an underscore
followed by any number of letter or digit, followed by any number
of groups of underscore followed by at least one letter or digit:
Str.regexp "[_a-zA-Z][a-zA-Z0-9]*\\(_[a-zA-Z0-9]+\\)*"
)kw_apply
: applied to keywords (default is textbf
)id_apply
: applied to identifiers (default is mathit
)rem_apply
: applied to remaining parts (default is verbatim
)keywords
: keyword listsymbols
: symbol list and the way they are printedkeyword_symbols
: keyword list that should be printed in a special
way, as symbols, but parsed as identifiersunderscore
: delimiter used to split identifiers
(default is underscore ('_'
))
Keywords, keyword symbols and identifiers are split using
underscore
as delimiter.
The first part is replaced by the corresponding Latex.t
.
The other parts are displayed as indexes separated by commas (','
).
They are also treated as identifiers, potentiel keywords or keyword symbols.
val trim : char list -> string -> string
trim [' '; '\n'] s
will return a copy of s without spaces and
new lines at the beginning and at the end.val trim_begin : char list -> string -> string
trim [' '; '\n'] s
will return a copy of s without spaces and
new lines at the beginning.val trim_end : char list -> string -> string
trim [' '; '\n'] s
will return a copy of s without spaces and
new lines at the end.val split_lines : string -> string list
'\n'
delimiter, which is not kept.