module Latex:sig..end
type t
typesize =[ `Baselineskip of float
| `Baselinestretch of float
| `Bp of float
| `Cc of float
| `Cm of float
| `Dd of float
| `Em of float
| `Ex of float
| `Fill
| `In of float
| `Linewidth of float
| `Mm of float
| `Parindent of float
| `Parskip of float
| `Pc of float
| `Pt of float
| `Sp of float
| `Stretch of int
| `Textheight of float
| `Textwidth of float
| `Unitlength of float ]
`In: inches`Mm: millimeters`Cm: centimeters`Pt: points (about 1/72 inch)`Em: approximately the width of an "M" in the current font`Ex: approximately the width of an "x" in the current font`Pc: pica (12pt/pc)`Bp: big pt (72bp/in)`Dd: didot (1157dd=1238pt)`Cc: cicero (12dd/cc)`Sp: scaled point (65536sp/pt)`Parindent: normal paragraph indentation`Baselineskip: normal vertical distance between lines in a paragraph`Baselinestretch: multiplies `Baselineskip`Parskip: the extra vertical space between paragraphs`Textwidth: the width of text on the page`Linewidth: width of a line in the local environment`Textheight: the height of text on the page`Unitlength: units of length in picture environment`Fill: rubber length; takes as much space as possible`Stretch: rubber length; if multiple `Stretch-sized commands are issued
on the same line (or vertical box) they stretch in proportion of their respective
factor.val latex_of_size : size -> ttypedocumentclass =[ `Article
| `Beamer
| `Book
| `Custom of string
| `Letter
| `Report
| `Slides ]
typedocumentoptions =[ `A4paper | `Landscape | `Pt of int | `TwoColumn ]
val document : ?documentclass:documentclass ->
?options:documentoptions list ->
?title:t ->
?author:t ->
?date:t ->
?prelude:t -> ?packages:(t * t) list -> t -> t~packages argument takes a list of (name, opt) where name is the
name of the package and opt is its option. This is equivalent to
using several calls to usepackage in the ~prelude.
The two basic operations on variables are get and setf.
get outputs an ast depending on the current contents of a
variable.
setf updates the contents of a variable.
get can also use the contents of a variable at a different
position in the document.
To use a position, you need to declare one first with
position. then you can place that position in you document with
place. You must not place a position more than one time.
If a position isn't placed, the contents of the variables at that
position will be the default one.
The final contents of variables is obtained by a fixpoint
computation wich is performed by the printing functions
Latex.to_buffer, Latex.to_channel, Latex.to_file, Latex.to_string. That
fixpoint may not terminate. In that case, the log will tell you which
variable did not converge.
type 'a variable
val variable : ?eq:('a -> 'a -> bool) ->
?name:string -> ?printer:('a -> string) -> 'a -> 'a variable
eq is the equality function on the type of the variable. Default is =.
name and printer are used to print information when the
fixpoint calculation diverged.
val setf : 'a variable -> ('a -> 'a) -> tval setf2 : 'a variable -> 'b variable -> ('a -> 'b -> 'b) -> tsetf var_in var_out f
Change the value of the variable var_out in the rest of the document
using the contents of var_in.type position
val position : ?name:string -> unit -> positionname is used to print information when the fixpoint computation
diverged.val place : position -> tval get : ?position:position -> 'a variable -> ('a -> t) -> tget has no parameter position then the current value of the
variable is taken. Otherwise it is the value at position.val set : 'a variable -> 'a -> t
set x v: return a node which, when evaluated, changes the contents
of variable x to value v.
val final : 'a variable -> ('a -> t) -> tget, but the value of the variable is taken at the end of
the document.val incr_var : int variable -> t
incr_var x is equivalent to setf x (fun x -> x + 1).
val decr_var : int variable -> t
decr_var x is equivalent to setf x (fun x -> x - 1).
val vari : int variable -> t
vari x is equivalent to get x (fun x -> text (string_of_int x)).
val varf : float variable -> t
varf x is equivalent to get x (fun x -> text (string_of_float x)).
val varb : bool variable -> t
varb x is equivalent to get x (fun x -> text (string_of_bool x)).
val vars : string variable -> t
vars x is equivalent to get x text.
val vart : t variable -> t
vart x is equivalent to get x (fun x -> x).
val finali : int variable -> t
finali x is equivalent to final x (fun x -> text (string_of_int x)).
val finalf : float variable -> t
finalf x is equivalent to final x (fun x -> text (string_of_float x)).
val finalb : bool variable -> t
finalb x is equivalent to final x (fun x -> text (string_of_bool x)).
val finals : string variable -> t
finals x is equivalent to final x text.
val finalt : t variable -> t
finalt x is equivalent to final x (fun x -> x).
let lbl_intro = label ()
let intro = section ~label: lbl_intro "This is Section~{ref_ lbl_intro}."
type label
val label : ?name:string -> unit -> label
Argument name can be used to force the name of the label in the
LaTeX file. This can be useful if you need to refer to this label in
an external LaTeX file or if the label itself is declared in another
LaTeX file. The default value of name is "latex_lib_label_n" where
n is a counter.
val ref_ : label -> ttypefloat_position =[ `B | `Force | `H | `P | `T ]
`H: here`T: top of page`B: bottom of page`P: put on a special page for floats only`Force: override internal LaTeX parametersval float_all : float_position list[ `H; `T; `B; `P ]val figure : ?label:label ->
?pos:float_position list ->
?center:bool ->
?side_caption:bool -> ?caption:t -> ?wide:bool -> t -> t
Default value for center is false.
If side_caption is true, the caption will be placed at the side of
the figure instead of at the bottom. This uses package sidecap.
Default value is false.
Argument ~wide: true must be used for multi-columns documents if you
want the figure to use the full width of the page. In this case,
positions `H has no effect, and position `B adds package
stfloats.
To prevent wide figures from being placed out-of-order with respect to
their "non-wide" counterparts, use package fixltx2e.
typewrapfigure_position =[ `Force of [ `I | `L | `O | `R ] | `I | `L | `O | `R ]
wrapfig.`L: left`R: right`I: inside (if document is twosided)`O: outside (if document is twosided)`Force _: force the figure to start precisely where specified
(may cause it to run over page breaks)val wrapfigure : ?label:label ->
?pos:wrapfigure_position ->
?lines:int ->
?width:size -> ?center:bool -> ?caption:t -> t -> t
Uses package wrapfig.
Argument lines specifies the height of the figure in number of lines.
It can be useful if LaTeX fails to compute it correctly.
Default value for width is half the text width.
Default value for center is false.
If there is too much space on top and below the figure, and lines does
not do what you want, you can add
some negative vspaces. In general it is better to let
LaTeX place the figure for you, though.
typefloatingfigure_position =[ `L | `P | `R ]
floatflt.`L: left`R: right`P: right if the pagenumber is odd, left if evenval floatingfigure : ?label:label ->
?pos:floatingfigure_position ->
?width:size -> ?center:bool -> ?caption:t -> t -> t
Uses package floatflt.
Default value for width is half the text width.
Default value for center is false.
val subfloat : ?label:label -> ?caption:t -> t -> t
Uses package subfig.
Use it inside a figure to insert sub-figures.
val hyphen : tval index : t -> t -> tindex x y produces {x}_{y}val exponent : t -> t -> texponent x y produces {x}^{y}val index_exponent : t -> t -> t -> tindex_exponent x y z produces {x}_{y}^{z}.
This is NOT equivalent to exponent (index x y) z as this would
produce {{x}_{y}}^{z}. The former allows the exponent to be printed
above the index, while the latter does not.
val tableofcontents : t
val listoffigures : t
val listoftables : t
val appendix : t
val place_index : t -> tprintindex output an index listing the various point which have
been referenced by place_index key. key can be a phrase
in which case it appears as-is in the index, or some more complex
instruction (documentation for index
keys can be found in the Not So Short Introduction to Latex (available
online) or the Latex Companion).
If you use at least one of place_index or printindex, a file .idx
will be produced at the same time as the .aux. It needs to be processed
by the program makeindex (makeindex file.idx). Then (pdf)latex
needs to be run again.
val printindex : t
val today : t
val maketitle : t
val part : ?label:label -> t -> tval chapter : ?label:label -> ?short:t -> t -> t
val section : ?label:label -> ?short:t -> t -> t
val subsection : ?label:label -> ?short:t -> t -> t
val subsubsection : ?label:label -> ?short:t -> t -> t
val paragraph : t -> t
val chapter' : ?label:label -> ?short:t -> t -> tchapter but with no numbering.val section' : ?label:label -> ?short:t -> t -> tsection but with no numbering.val subsection' : ?label:label -> ?short:t -> t -> tsubsection but with no numbering.val subsubsection' : ?label:label -> ?short:t -> t -> tsubsubsection but with no numbering.val par : t
val displaymath : t -> t
val equation : ?label:label -> t -> t
val hfill : t
val vfill : t
val vfil : t
val footnote : t -> t
val latex_of_int : int -> t
val latex_of_float : float -> t
val itemize : t list -> t
val enumerate : t list -> t
val newline : tval newline_size : size -> tval newpage : tval clearpage : tnewpage, but also force figures and tables floating in the
current page to be printed.val noindent : t
val space : tval quad : t
val qquad : t
val includegraphics : t -> t
val symbol : int -> t
val symbolc : char -> tchar into an int and apply symbol.val center : t -> t
val flushleft : t -> t
val flushright : t -> t
val quote : t -> t
val quotation : t -> t
val stackrel : t -> t -> t
val vspace : size -> tval hspace : size -> tval addvspace : size -> tvspace, but an addvspace x followed by an addvspace y
will produce an addvspace of max x y.val ignorespaces : tval smallskip : tvspace.val medskip : tvspace.val bigskip : tvspace.val nointerlineskip : tval phantom : t -> tval vphantom : t -> tval hphantom : t -> tval rule_ : ?lift:size -> size -> size -> trule_ width height draws a rule (i.e. a black box) of width width
and height height (for instance a horizontal or vertical line).
The optional argument lift moves the rule up if positive and down
if negative.
A special case is when width is null. In this case the rule,
called a strut, does not display, it only makes sure that the
surrounding box has at least its height.typevalignment =[ `B | `C | `T ]
val parbox : size -> ?valign:valignment -> t -> tvalign optional argument controls the vertical alignment of
the box with respect to the surrounding text.val minipage : size -> ?valign:valignment -> t -> tparbox.typehalignment =[ `C | `L | `R | `S ]
typexsize =[ `Baselineskip of float
| `Baselinestretch of float
| `Bp of float
| `Cc of float
| `Cm of float
| `Dd of float
| `Depth of float
| `Em of float
| `Ex of float
| `Fill
| `Height of float
| `In of float
| `Linewidth of float
| `Mm of float
| `Parindent of float
| `Parskip of float
| `Pc of float
| `Pt of float
| `Sp of float
| `Stretch of int
| `Textheight of float
| `Textwidth of float
| `Totalheight of float
| `Unitlength of float
| `Width of float ]
Latex.makebox, Latex.framebox and Latex.raisebox)
can use extra size information in their definition. These are computed
from their content:
`Width is the width of the content
`Height is the height above the baseline
`Depth is the height below the baseline
`Totalheight is the sum of `Height and `Depthval makebox : xsize -> ?halign:halignment -> t -> tval framebox : xsize -> ?halign:halignment -> t -> tmakebox but draws a frame around the box.val raisebox : shift:xsize ->
?fakeheight:xsize * xsize -> t -> traisebox ~shift x displays x vertically displaced by shift.
If ~fakeheight is not specified, then the line is built as if
x had not been moved.
If ~fakeheight:(h,d) then the line building algorithm sees a box
which extends h above the baseline (height) and d below the
baseline (depth).typealignment =[ `C | `L | `R ]
typearray_column =[ `C | `L | `R | `Sep of t | `Vert ]
type array_line
val array : ?valign:valignment ->
array_column list -> array_line list -> t
val array_line : ?sep:size ->
?layout:(int * [ `C | `I | `L | `R ]) list ->
t list -> array_line`I in layout means that the column inherits the alignment
of the first corresponding column in the array layout.
The integers in the layout correspond to over how many of the array's column
will the cell will span.val array_command : t -> array_linearray_command x is a low level command. It gives x as an array line to Latex.
Meant to define alternative commands to draw horizontal lines in arrays.val frontmatter : t
val backmatter : t
val mainmatter : t
val underbrace : t -> t -> t
val overbrace : t -> t -> tval emph : t -> tval texttt : t -> tval textsc : t -> tval textit : t -> tval textbf : t -> tval textrm : t -> tval textsf : t -> tval mathit : t -> tval mathbf : t -> tval mathrm : t -> tval mathsf : t -> tval mathcal : t -> tval tiny : t -> t
val scriptsize : t -> t
val footnotesize : t -> t
val small : t -> t
val normalsize : t -> t
val large : t -> t
val large2 : t -> t
val large3 : t -> t
val huge : t -> t
val huge2 : t -> tval hat : t -> t
val grave : t -> t
val bar : t -> t
val acute : t -> t
val mathring : t -> t
val check : t -> t
val dot : t -> t
val vec : t -> t
val breve : t -> t
val tilde : t -> t
val ddot : t -> t
val widehat : t -> that which spreads over the whole argument.val widetilde : t -> ttilde which spreads over the whole argument.val overline : t -> tbar which spreads over the whole argument.val alpha : t
val beta : t
val gamma : t
val delta : t
val epsilon : t
val varepsilon : t
val zeta : t
val eta : t
val theta : t
val vartheta : t
val iota : t
val kappa : t
val varkappa : t
val lambda : t
val mu : t
val nu : t
val xi : t
val pi : t
val varpi : t
val rho : t
val varrho : t
val sigma : t
val varsigma : t
val tau : t
val upsilon : t
val phi : t
val varphi : t
val chi : t
val psi : t
val omega : t
val digamma : tval gamma_ : t
val delta_ : t
val theta_ : t
val lambda_ : t
val xi_ : t
val pi_ : t
val sigma_ : t
val upsilon_ : t
val phi_ : t
val psi_ : t
val omega_ : tval aleph : t
val beth : t
val gimel : t
val daleth : tval le : tval leq : tLatex.le)val leqslant : tval ge : tval geq : tLatex.ge)val geqslant : tval equiv : tval ll : tval gg : tval doteq : tval prec : tval succ : tval sim : tval preceq : tval succeq : tval simeq : tval subset : t
val supset : t
val approx : tval subseteq : t
val supseteq : t
val cong : tval sqsubset : tval sqsupset : tval join_ : tval sqsubseteq : tval sqsupseteq : tval bowtie : t
val in_ : tval owns : tval propto : tval vdash : tval dashv : tval models : tval mid : tval parallel : tval perp : tval smile : t
val frown : t
val asymp : tval not_ : t -> tnot_ in_ will print as ∉val notin : tval ne : tval neq : tLatex.ne)val pm : tval mp : tval triangleleft : tval cdot : tval div : tval triangleright : tval times : tval setminus : tval star : tval cup : tval cap : tval ast : tval sqcup : tval sqcap : tval circ : tval lor_ : tval land_ : tval bullet : tval oplus : tval ominus : tval diamond : tval odot : tval oslash : tval uplus : tval otimes : tval bigcirc : t
val amalg : t
val bigtriangleup : t
val bigtriangledown : t
val dagger : t
val lhd : ttriangleleft (latexsym package)val rhd : ttriangleright (latexsym package)val ddagger : tdagger with one more cross on the bottom)val unlhd : ttriangleleft (latexsym package)val unrhd : ttriangleright (latexsym package)val wr : tval sum : t
val prod : t
val coprod : t
val bigcup : t
val bigcap : t
val bigvee : t
val bigwedge : t
val bigsqcup : t
val biguplus : t
val int : t
val oint : t
val bigodot : t
val bigoplus : t
val bigotimes : tval leftarrow : tval rightarrow : tval to_ : tLatex.rightarrow)val leftrightarrow : tval leftarrow_ : tval rightarrow_ : tval leftrightarrow_ : tval longleftarrow : tval longrightarrow : tval longleftrightarrow : tval longleftarrow_ : tval longrightarrow_ : tval longleftrightarrow_ : tval iff : tval mapsto : t
val longmapsto : t
val hookleftarrow : t
val hookrightarrow : t
val leftharpoonup : t
val rightharpoonup : t
val leftharpoondown : t
val rightharpoondown : t
val rightleftharpoons : t
val uparrow : t
val downarrow : t
val updownarrow : t
val uparrow_ : tuparrowval downarrow_ : tdownarrowval updownarrow_ : tupdownarrowval nearrow : tval searrow : tval swarrow : tval nwarrow : tval leadsto : tval box_ : tlatexsym.val langle : tval rangle : tval lceil : tval rceil : tval frac : t -> t -> t
val land_ : tval lor_ : tval lnot : tval neg : tLatex.lnot)val forall : tval exists : tval top : tval bot : tval sharp : t
val dots : t
val cdots : t...val ldots : tval emptyset : t
typedoublable_delimiter =[ `Down | `Up | `Up_down | `Vert ]
typedelimiter =[ `Angle
| `Brace
| `Bracket
| `Ceil
| `Double of doublable_delimiter
| `Down
| `Floor
| `None
| `Paren
| `Slash
| `Up
| `Up_down
| `Vert ]
val left : delimiter -> t
val right : delimiter -> t
val just_left : delimiter -> t -> tjust_left d x: concatenation of left d, x and right `None.val just_right : delimiter -> t -> tjust_right d x: concatenation of left `None, x and right d.val between : delimiter -> t -> tbetween d x: concatenation of left d, x and right d.val oe : tval mathbb : t -> t
val mathfrak : t -> t
val align : t -> tval align_ : t -> talign, but without numberingval gather : t -> t
val gather_ : t -> t
val split : t -> t
val proof : ?opt:t -> t -> t
val twoheadrightarrow : tval square : t
val par_ : tval black_triangle_left : t
val black_triangle_right : tval mathpar : t list -> tand commands between each item to split them.val inferrule : ?lab:t ->
?left:t ->
?right:t ->
?vdots:size ->
?width:size ->
?leftskip:size ->
?rightskip:size -> t list -> t list -> tinferrule pre post builds an inference rule with pre at the top and post
at the bottom. If pre or post is empty, the bar is not drawn.lab : label to put above the ruleleft : label to put on the left of the ruleright : label to put on the right of the rulevdots : raise the rule and draw vertical dots ; the length argument
is translated to a number of line-skips"stmaryrd" is automatically added by these commands.val llbracket : t[|val rrbracket : t|]val llparenthesis : t(|val rrparenthesis : t|)val slide : t -> tmodule type BEAMER =sig..end
module Beamer:BEAMER
module Verbatim:sig..end
type mode =
| |
M |
| |
T |
| |
A |
val empty : t
Equivalent to concat [] or text "".
val is_empty : t -> boolA concatenation of empty trees is also empty.
A tree containing a Latex.set node is not empty.
A tree containing Latex.get or Latex.final nodes is
not empty, even if the call will produce an empty tree when
evaluating variables.
val text : string -> tval concat : t list -> tval (^^) : t -> t -> tval command : ?packages:(string * string) list ->
string ->
?opt:mode * t ->
(mode * t) list -> mode -> t
command name args mode produces the LaTeX command name applied to
arguments args.
The command should be used in mode mode. For exemple,
the ensuremath LaTeX command should be used in math mode. The command will
be coerced using mbox or $ ... $ if mode differs from the mode it is
used in.
The opt optional parameter may be used to provide an optional parameter
(in brackets []) to the LaTeX command.
Arguments opt and args must be given with their expected mode and will
be coerced if needed. For example, the mbox command expect an argument in
text mode (the argument must be coerced using $ ... $ if it is math).
The ensuremath command expects an argument in any mode.
All packages (name, opt) given using packages will automatically be used by
document.
type arg_kind
val bracket : arg_kind
val brace : arg_kind
val nobr : arg_kind
val unusual_command : ?packages:(string * string) list ->
string ->
(mode * arg_kind * t) list -> mode -> tunusual_command does the same as command, but is more low level.
Instead of having a single optional argument and a list of mandatory
arguments, it only has a list of arguments.
Each argument comes not only with its content and mode, but with an
"argument kind" (type arg_kind) specifying whether it is a brace
argument (corresponding to mandatory arguments in command) or a bracket
argument (corresponding, in turn, to the option argument of command).
This allows to handle commands which have several optional arguments,
or where optional and mandatory arguments are interleaved.
val within_braces : t -> twithin_braces x produces {x}.
Typically meant to be used together with unusual_command.val environment : ?packages:(string * string) list ->
string ->
?opt:mode * t ->
?args:(mode * t) list ->
mode * t -> mode -> t
Same as function command, except that it only takes one argument
(the environment body) and produces an environment, i.e. using the
begin and end commands. The args parameters may be used to give
additional arguments, such as the columns of an array.
All packages (name, opt) given using packages will automatically be used by
document.
val mode : mode -> t -> t
mode m x returns x if its mode is already m. If its mode is not m,
the result is x coerced using mbox or $ ... $.
document functionsval documentclass : ?opt:mode * t -> t -> tdocumentclass cls means that cls
(represented as a Latex.t) is the class of the document. The optional
argument is given as a Latex.t as well, for generality.val required_packages : trequired_packages. Note that
it does not make sense out of the document's prelude.val require_packages : (t * t) list -> trequire_packages takes as argument a list of pairs
package,option. Each package is required (see packages) with
option option. The argument ~packages of Latex.document is implemented
as a require_package. This command can be used anywhere in a document,
if needed.val documentmatter : t -> tdocumentmatter body renders your actual document, body,
according to the rules specified in the prelude. It is simply
LaTeX's document command.val latex : tval usepackage : ?opt:t -> t -> t~prelude of your document, but it is better
to use the ~packages argument of document. Note that some commandes
add their own packages to the document automatically.val input : t -> t.tex file with macros that you want
to reuse.val newcommand : int -> t -> t -> tnewcommand parameter_count name body defines a new command with
parameter_count arguments, where you can use the ith argument by writing
#i in the body, just as in Latex. Normally you'd prefer to just define
an OCaml value with let.val renewcommand : int -> t -> t -> tnewcommand except that it can redefine existing LaTeX commands.val block : t -> tblock x produces {x}. Should only be used in some rare cases when
you want to be very precise about what LaTeX should do.
If x is empty, the braces are not added. If you need braces even if
x is empty, use Latex.within_braces.val place_label : label -> tplace_label lbl places label lbl. Normally you would prefer using
the various ~label optional arguments available, and only use place_label
for unimplemented features or if you are feeling hackish.val atbegindocument : t -> t
val addcontentsline : t -> t -> t -> taddcontentsline toc section nameval pagestyle : t -> t
val thispagestyle : t -> t
val list_insert : 'a -> 'a list -> 'a listExamples:
list_insert 1 [] = []list_insert 1 [2] = [2]list_insert 1 [2; 3; 4] = [2; 1; 3; 1; 4]type env
val get_in_env : ?position:position -> 'a variable -> env -> 'aval to_buffer : ?mode:mode -> ?env:env -> Buffer.t -> t -> env
val to_channel : ?mode:mode ->
?env:env -> Pervasives.out_channel -> t -> env
val to_file : ?mode:mode -> ?env:env -> string -> t -> env
val to_string : ?mode:mode -> t -> string
val to_string_with_env : ?mode:mode -> ?env:env -> t -> string * env