module Latex:sig..end
LaTeX output.
type t
LaTeX expressions.
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 ]
The type of LaTeX sizes.
`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 -> tLow level function to be used to make new bindings.
typedocumentclass =[ `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 -> tThe ~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.
Variables are similar to LaTeX counters, except that they are computed when pretty-printing the LaTeX AST.
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 variableDeclare a new variable. The last argument is the default value of the 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) -> tChange the value of a variable in the rest of the document.
val 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
The type of positions in documents.
val position : ?name:string -> unit -> positionDeclare a new position.
name is used to print information when the fixpoint computation
diverged.
val place : position -> tPlace a position in the document.
val get : ?position:position -> 'a variable -> ('a -> t) -> tUse the contents of a variable to compute part of the document.
If get has no parameter position then the current value of the
variable is taken. Otherwise it is the value at position.
All these functions are defined using the above constructors.
val set : 'a variable -> 'a -> tChange the value of a variable.
set x v: return a node which, when evaluated, changes the contents
of variable x to value v.
val final : 'a variable -> ('a -> t) -> tLike get, but the value of the variable is taken at the end of
the document.
val incr_var : int variable -> tIncrement an integer variable.
incr_var x is equivalent to setf x (fun x -> x + 1).
val decr_var : int variable -> tDecrement an integer variable.
decr_var x is equivalent to setf x (fun x -> x - 1).
val vari : int variable -> tPrint an integer variable.
vari x is equivalent to get x (fun x -> text (string_of_int x)).
val varf : float variable -> tPrint a float variable.
varf x is equivalent to get x (fun x -> text (string_of_float x)).
val varb : bool variable -> tPrint a boolean variable.
varb x is equivalent to get x (fun x -> text (string_of_bool x)).
val vars : string variable -> tPrint a string variable.
vars x is equivalent to get x text.
val vart : t variable -> tPrint a variable containing a LaTeX AST.
vart x is equivalent to get x (fun x -> x).
val finali : int variable -> tPrint the last value of an integer variable.
finali x is equivalent to final x (fun x -> text (string_of_int x)).
val finalf : float variable -> tPrint the last value of a float variable.
finalf x is equivalent to final x (fun x -> text (string_of_float x)).
val finalb : bool variable -> tPrint the last value of a boolean variable.
finalb x is equivalent to final x (fun x -> text (string_of_bool x)).
val finals : string variable -> tPrint the last value of a string variable.
finals x is equivalent to final x text.
val finalt : t variable -> tPrint the last value of a variable containing a LaTeX AST.
finalt x is equivalent to final x (fun x -> x).
Example (using the Melt pre-processor):
let lbl_intro = label ()
let intro = section ~label: lbl_intro "This is Section~{ref_ lbl_intro}."
type label
val label : ?name:string -> unit -> labelDeclare a new 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 -> tMake a reference to the label.
typefloat_position =[ `B | `Force | `H | `P | `T ]
Floating element (figure, ...) positions.
`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 -> tFloating figure.
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 ]
Figure positions for package 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 -> tFloating figure which makes text wrap around it.
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 ]
Figure positions for package 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 -> tFloating figure which makes text wrap around it.
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 -> tSub-figure.
Uses package subfig.
Use it inside a figure to insert sub-figures.
val hyphen : tTell LaTeX where to cut words at the end of lines.
val 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 : tYou should not need maketitle if you use Latex.document.
val part : ?label:label -> t -> tFor the report style.
val 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 -> tSame as chapter but with no numbering.
val section' : ?label:label -> ?short:t -> t -> tSame as section but with no numbering.
val subsection' : ?label:label -> ?short:t -> t -> tSame as subsection but with no numbering.
val subsubsection' : ?label:label -> ?short:t -> t -> tSame as subsubsection 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 : tStart a new line.
val newline_size : size -> tA newline followed by a vertical space.
val newpage : tStart a new page.
val clearpage : tSame as newpage, but also force figures and tables floating in the
current page to be printed.
val noindent : t
val space : tForces a space, same as "\ " in LaTeX
val quad : t
val qquad : t
val includegraphics : t -> t
val symbol : int -> t
val symbolc : char -> tConvert a char 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 -> tA vertical space.
val hspace : size -> tAn horizontal, possibly negative space.
val addvspace : size -> tSimilar to vspace, but an addvspace x followed by an addvspace y
will produce an addvspace of max x y.
val ignorespaces : tTells LaTeX to ignore following spaces and new lines. Useful at the end of a display environment, for instance.
val smallskip : tA small vspace.
val medskip : tA medium vspace.
val bigskip : tA big vspace.
val nointerlineskip : tDelete the interline vertical space.
val phantom : t -> tTake the space of the argument without actually drawing it
val vphantom : t -> tVertical-only phantom
val hphantom : t -> tHorizontal-only phantom
val 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 ]
(`T)op, (`C)enter, (`B)ottom.
val parbox : size -> ?valign:valignment -> t -> tA box in which new lines and paragraphs may be used. Useful to display
code listings, for instance.
The valign optional argument controls the vertical alignment of
the box with respect to the surrounding text.
val minipage : size -> ?valign:valignment -> t -> tA box in which almost all command may be used. A more robust kind of
parbox.
typehalignment =[ `C | `L | `R | `S ]
(`C)enter, flush (`L)eft, flush (`R)ight or (`S)pread.
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 ]
Horizontal box commands (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 `Depth
val makebox : xsize -> ?halign:halignment -> t -> tA box which only deals with horizontaly aligned material.
val framebox : xsize -> ?halign:halignment -> t -> tSame as makebox 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_lineExtra alignment `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 -> tEmphasize
val texttt : t -> tMonospace
val textsc : t -> tSmall caps
val textit : t -> tItalic
val textbf : t -> tBold
val textrm : t -> tRoman
val textsf : t -> tSans serif
val mathit : t -> tItalic (for math mode)
val mathbf : t -> tBold (for math mode)
val mathrm : t -> tRoman (for math mode)
val mathsf : t -> tSans serif (for math mode)
val mathcal : t -> tCaligraphic
From the smallest to the largest.
val 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 -> tA wide hat which spreads over the whole argument.
val widetilde : t -> tA wide tilde which spreads over the whole argument.
val overline : t -> tA wide bar 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 : tless or equal
val leq : tless or equal (same as Latex.le)
val leqslant : tless or equal (with equal bar parallel to the 'less than' sign
val ge : tgreater or equal
val geq : tgreater or equal (same as Latex.ge)
val geqslant : tgreater or equal (with equal bar parallel to the 'less than' sign
val equiv : t= with 3 bars
val ll : t<<
val gg : t>>
val doteq : t= with . on top
val prec : ttrumpet <
val succ : ttrumpet >
val sim : t~
val preceq : ttrumpet < or equal
val succeq : ttrumpet > or equal
val simeq : t~ or equal
val subset : t
val supset : t
val approx : tdouble ~
val subseteq : t
val supseteq : t
val cong : t= with ~ on top
val sqsubset : tsquare strict subset (latexsym package)
val sqsupset : tsquare strict superset (latexsym package)
val join_ : tsmall bowtie (latexsym package)
val sqsubseteq : tsquare subset or equal
val sqsupseteq : tsquare superset or equal
val bowtie : t
val in_ : tin set
val owns : tinverted in set
val propto : tinfinite with open right buckle
val vdash : t|-
val dashv : t-|
val models : t|=
val mid : t|
val parallel : t||
val perp : t_|_
val smile : t
val frown : t
val asymp : tfrown with smile on top
val not_ : t -> tgeneric negation of binary symbol. not_ in_ will print as ∉
val notin : tnot in set (∉)
val ne : tnot equal (≠)
val neq : tnot equal (same as Latex.ne)
val pm : t- with + on top (∓)
val mp : t+ with - on top (±)
val triangleleft : t◃
val cdot : tcentered .
val div : t- with . on top and . on the bottom (÷)
val triangleright : t▹
val times : t×
val setminus : tbackslash
val star : t5-branches star
val cup : tset union
val cap : tset intersection
val ast : tasterisk * (6-branches star)
val sqcup : tsquare cup
val sqcap : tsquare cap
val circ : ta small circle
val lor_ : t\/
val land_ : t/\
val bullet : ta small filled circle
val oplus : ta circle with a + inside
val ominus : ta circle with a - inside
val diamond : ta small square rotated 45 degrees
val odot : ta circle with a centered . inside
val oslash : ta slashed circle
val uplus : ta cup with a + inside
val otimes : ta crossed circle
val bigcirc : t
val amalg : t
val bigtriangleup : t
val bigtriangledown : t
val dagger : t
val lhd : tbigger triangleleft (latexsym package)
val rhd : tbigger triangleright (latexsym package)
val ddagger : tdouble dagger (dagger with one more cross on the bottom)
val unlhd : tbigger, underlined triangleleft (latexsym package)
val unrhd : tbigger, underlined triangleright (latexsym package)
val wr : ta vertical ~
val 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 : t<-
val rightarrow : t->
val to_ : t-> (same as Latex.rightarrow)
val leftrightarrow : t<->
val leftarrow_ : t<=
val rightarrow_ : t=>
val leftrightarrow_ : t<=>
val longleftarrow : t<--
val longrightarrow : t-->
val longleftrightarrow : t<-->
val longleftarrow_ : t<==
val longrightarrow_ : t==>
val longleftrightarrow_ : t<==>
val iff : t<==> (bigger spaces)
val 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_ : tdouble uparrow
val downarrow_ : tdouble downarrow
val updownarrow_ : tdouble updownarrow
val nearrow : tNorth-East arrow
val searrow : tSouth-East arrow
val swarrow : tSouth-West arrow
val nwarrow : tNorth-West arrow
val leadsto : t~> (latexsym package)
val box_ : tA square box, for instance to end proofs (QED).
Adds package latexsym.
val langle : t⟨
val rangle : t⟩
val lceil : t⌈
val rceil : t⌉
val frac : t -> t -> t
val land_ : t/\
val lor_ : t\/
val lnot : t¬
val neg : t¬ (like Latex.lnot)
val forall : t∀
val exists : t∃
val top : t⊤
val bot : t⊥
val sharp : t
val dots : t
val cdots : tCentered dots ...
val ldots : telipsis, works in math and text mode
val 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 : tFrench e in o as in "coeur", "noeud"...
val mathbb : t -> t
val mathfrak : t -> t
val align : t -> tthe AMS align environment to align equations using &
val align_ : t -> tsame as align, but without numbering
val gather : t -> t
val gather_ : t -> t
val split : t -> t
val proof : ?opt:t -> t -> t
val twoheadrightarrow : t->>
val square : t
val par_ : tThe paragraph symbol.
val black_triangle_left : t
val black_triangle_right : tval mathpar : t list -> tMath paragraph.
This function inserts and 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 -> tInference rule.
inferrule 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-skipsThe package "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 |
LaTeX mode: math, text or any.
val empty : tThe empty LaTeX tree.
Equivalent to concat [] or text "".
val is_empty : t -> boolTest whether a LaTeX tree is empty.
A 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 -> tRaw LaTeX.
val concat : t list -> tConcatenation.
val (^^) : t -> t -> tInfix Concatenation.
val command : ?packages:(string * string) list ->
string ->
?opt:mode * t ->
(mode * t) list -> mode -> tLaTeX Command.
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 -> tLaTeX Environment.
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 -> tEnsure text or math mode.
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 -> tAll document must start with a single document class declaration,
optionnally with arguments. documentclass 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 : tYour prelude must contain the list of packages required by your
document. That is a single occurence of required_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 : t"LaTeX" written in a fancy but official way.
val usepackage : ?opt:t -> t -> tYou can use this in the ~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 -> tInclude a LaTeX file. Usually you'd prefer to open an OCaml module,
but this can be useful if you have a .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 -> tSame as newcommand 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 name
val pagestyle : t -> t
val thispagestyle : t -> t
val list_insert : 'a -> 'a list -> 'a listInserts an element between each elements of a list.
Examples:
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 -> 'aAll printing functions take the expected mode as a parameter (default is text). The printed expression will be coerced if its mode differs.
val to_buffer : ?mode:mode -> ?env:env -> Stdlib.Buffer.t -> t -> env
val to_channel : ?mode:mode ->
?env:env -> Stdlib.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