# class TLatex: public TText, public TAttLine

## TLatex : to draw Mathematical Formula

TLatex's purpose is to write mathematical equations. The syntax is very similar to the Latex one. It provides several functionalities: When the font precision (see TAttText) is low (ie 0), TLatex is painted as a normal TText, the control characters are not interpreted.

### Subscripts and Superscripts

Subscripts and superscripts are made with the _ and ^ commands. These commands can be combined to make complicated subscript and superscript expressions. You may choose how to display subscripts and superscripts using the 2 functions SetIndiceSize(Double_t) and SetLimitIndiceSize(Int_t).

Examples:

x^{2y} :    $x^{2y}$ x_{2y} :    $x^{2y}$
x^{y^{2}} : $x^{y^{2}}$ x^{y_{1}} : $x^{y_{1}}$
x^{y}_{1} : $x^{y}_{1}$ x_{1}^{y} : $x_{1}^{y}$

### Fractions

Fractions denoted by the / symbol are made in the obvious way. The #frac command is used for large fractions in displayed formula; it has two arguments: the numerator and the denominator.

Examples:

x = #frac{y+z/2}{y^{2}+1} : $x = #frac{y+z/2}{y^{2}+1}$

### Splitting Lines

A text can be split in two lines via the command #splitline.

Examples:

#splitline{21 April 2003}{14:02:30} : $#splitline{21 April 2003}{14:02:30}$

### Roots

The #sqrt command produces the square root of its argument; it has an optional first argument for other roots.

Examples:

#sqrt{10} : $#sqrt{10}$ #sqrt[3]{10} : $#sqrt[3]{10}$

### Mathematical Symbols

TLatex can display dozens of special mathematical symbols. A few of them, such as + and > , are produced by typing the corresponding keyboard character. Others are obtained with the commands in the following table:
{
TCanvas *Ms = new TCanvas("mathsymb","Mathematical Symbols",500,600);

TLatex Tl;
Tl.SetTextSize(0.03);

// Draw First Column
Tl.SetTextAlign(12);
float y, step, x1, x2;
y = 0.96; step = 0.0465; x1 = 0.02; x2 = x1+0.04;
Tl.DrawLatex(x1, y, "#club")           ; Tl.DrawText(x2, y, "#club");
y -= step ; Tl.DrawLatex(x1, y, "#voidn")          ; Tl.DrawText(x2, y, "#voidn");
y -= step ; Tl.DrawLatex(x1, y, "#leq")            ; Tl.DrawText(x2, y, "#leq");
y -= step ; Tl.DrawLatex(x1, y, "#approx")         ; Tl.DrawText(x2, y, "#approx");
y -= step ; Tl.DrawLatex(x1, y, "#in")             ; Tl.DrawText(x2, y, "#in");
y -= step ; Tl.DrawLatex(x1, y, "#supset")         ; Tl.DrawText(x2, y, "#supset");
y -= step ; Tl.DrawLatex(x1, y, "#cap")            ; Tl.DrawText(x2, y, "#cap");
y -= step ; Tl.DrawLatex(x1, y, "#times")          ; Tl.DrawText(x2, y, "#times");
y -= step ; Tl.DrawLatex(x1, y, "#bullet")         ; Tl.DrawText(x2, y, "#bullet");
y -= step ; Tl.DrawLatex(x1, y, "#voidb")          ; Tl.DrawText(x2, y, "#voidb");
y -= step ; Tl.DrawLatex(x1, y, "#doublequote")    ; Tl.DrawText(x2, y, "#doublequote");
y -= step ; Tl.DrawLatex(x1, y, "#lbar")           ; Tl.DrawText(x2, y, "#lbar");
y -= step ; Tl.DrawLatex(x1, y, "#arcbottom")      ; Tl.DrawText(x2, y, "#arcbottom");
y -= step ; Tl.DrawLatex(x1, y, "#downarrow")      ; Tl.DrawText(x2, y, "#downarrow");
y -= step ; Tl.DrawLatex(x1, y, "#leftrightarrow") ; Tl.DrawText(x2, y, "#leftrightarrow");
y -= step ; Tl.DrawLatex(x1, y, "#Downarrow")      ; Tl.DrawText(x2, y, "#Downarrow");
y -= step ; Tl.DrawLatex(x1, y, "#Leftrightarrow") ; Tl.DrawText(x2, y, "#Leftrightarrow");
y -= step ; Tl.DrawLatex(x1, y, "#void8")          ; Tl.DrawText(x2, y, "#void8");
y -= step ; Tl.DrawLatex(x1, y, "#hbar")           ; Tl.DrawText(x2, y, "#hbar");

// Draw Second Column
y = 0.96; step = 0.0465; x1 = 0.27; x2 = x1+0.04;
Tl.DrawLatex(x1, y, "#diamond")        ; Tl.DrawText(x2, y, "#diamond");
y -= step ; Tl.DrawLatex(x1, y, "#aleph")          ; Tl.DrawText(x2, y, "#aleph");
y -= step ; Tl.DrawLatex(x1, y, "#geq")            ; Tl.DrawText(x2, y, "#geq");
y -= step ; Tl.DrawLatex(x1, y, "#neq")            ; Tl.DrawText(x2, y, "#neq");
y -= step ; Tl.DrawLatex(x1, y, "#notin")          ; Tl.DrawText(x2, y, "#notin");
y -= step ; Tl.DrawLatex(x1, y, "#subseteq")       ; Tl.DrawText(x2, y, "#subseteq");
y -= step ; Tl.DrawLatex(x1, y, "#cup")            ; Tl.DrawText(x2, y, "#cup");
y -= step ; Tl.DrawLatex(x1, y, "#void3")          ; Tl.DrawText(x2, y, "#void3");
y -= step ; Tl.DrawLatex(x1, y, "#divide")         ; Tl.DrawText(x2, y, "#divide");
y -= step ; Tl.DrawLatex(x1, y, "#circ")           ; Tl.DrawText(x2, y, "#circ");
y -= step ; Tl.DrawLatex(x1, y, "#infty")          ; Tl.DrawText(x2, y, "#infty");
y -= step ; Tl.DrawLatex(x1, y, "#angle")          ; Tl.DrawText(x2, y, "#angle");
y -= step ; Tl.DrawLatex(x1, y, "#cbar")           ; Tl.DrawText(x2, y, "#cbar");
y -= step ; Tl.DrawLatex(x1, y, "#arctop")         ; Tl.DrawText(x2, y, "#arctop");
y -= step ; Tl.DrawLatex(x1, y, "#leftarrow")      ; Tl.DrawText(x2, y, "#leftarrow");
y -= step ; Tl.DrawLatex(x1, y, "#otimes")         ; Tl.DrawText(x2, y, "#otimes");
y -= step ; Tl.DrawLatex(x1, y, "#Leftarrow")      ; Tl.DrawText(x2, y, "#Leftarrow");
y -= step ; Tl.DrawLatex(x1, y, "#prod")           ; Tl.DrawText(x2, y, "#prod");
y -= step ; Tl.DrawLatex(x1, y, "#Box")            ; Tl.DrawText(x2, y, "#Box");
y -= step ; Tl.DrawLatex(x1, y, "#parallel")       ; Tl.DrawText(x2, y, "#parallel");

// Draw Third Column
y = 0.96; step = 0.0465; x1 = 0.52; x2 = x1+0.04;
Tl.DrawLatex(x1, y, "#heart")          ; Tl.DrawText(x2, y, "#heart");
y -= step ; Tl.DrawLatex(x1, y, "#Jgothic")        ; Tl.DrawText(x2, y, "#Jgothic");
y -= step ; Tl.DrawLatex(x1, y, "#LT")             ; Tl.DrawText(x2, y, "#LT");
y -= step ; Tl.DrawLatex(x1, y, "#equiv")          ; Tl.DrawText(x2, y, "#equiv");
y -= step ; Tl.DrawLatex(x1, y, "#subset")         ; Tl.DrawText(x2, y, "#subset");
y -= step ; Tl.DrawLatex(x1, y, "#supseteq")       ; Tl.DrawText(x2, y, "#supseteq");
y -= step ; Tl.DrawLatex(x1, y, "#wedge")          ; Tl.DrawText(x2, y, "#wedge");
y -= step ; Tl.DrawLatex(x1, y, "#oright")         ; Tl.DrawText(x2, y, "#oright");
y -= step ; Tl.DrawLatex(x1, y, "#AA")             ; Tl.DrawText(x2, y, "#AA");
y -= step ; Tl.DrawLatex(x1, y, "#pm")             ; Tl.DrawText(x2, y, "#pm");
y -= step ; Tl.DrawLatex(x1, y, "#3dots")          ; Tl.DrawText(x2, y, "#3dots");
y -= step ; Tl.DrawLatex(x1, y, "#nabla")          ; Tl.DrawText(x2, y, "#nabla");
y -= step ; Tl.DrawLatex(x1, y, "#downleftarrow")  ; Tl.DrawText(x2, y, "#downleftarrow");
y -= step ; Tl.DrawLatex(x1, y, "#topbar")         ; Tl.DrawText(x2, y, "#topbar");
y -= step ; Tl.DrawLatex(x1, y, "#arcbar")         ; Tl.DrawText(x2, y, "#arcbar");
y -= step ; Tl.DrawLatex(x1, y, "#uparrow")        ; Tl.DrawText(x2, y, "#uparrow");
y -= step ; Tl.DrawLatex(x1, y, "#oplus")          ; Tl.DrawText(x2, y, "#oplus");
y -= step ; Tl.DrawLatex(x1, y, "#Uparrow")        ; Tl.DrawText(x2, y, "#Uparrow");
y -= step ; Tl.DrawLatex(x1, y-0.01, "#sum")       ; Tl.DrawText(x2, y, "#sum");
y -= step ; Tl.DrawLatex(x1, y, "#perp")           ; Tl.DrawText(x2, y, "#perp");

// Draw Fourth Column
y = 0.96; step = 0.0465; x1 = 0.77; x2 = x1+0.04;
y -= step ; Tl.DrawLatex(x1, y, "#Rgothic")        ; Tl.DrawText(x2, y, "#Rgothic");
y -= step ; Tl.DrawLatex(x1, y, "#GT")             ; Tl.DrawText(x2, y, "#GT");
y -= step ; Tl.DrawLatex(x1, y, "#propto")         ; Tl.DrawText(x2, y, "#propto");
y -= step ; Tl.DrawLatex(x1, y, "#notsubset")      ; Tl.DrawText(x2, y, "#notsubset");
y -= step ; Tl.DrawLatex(x1, y, "#oslash")         ; Tl.DrawText(x2, y, "#oslash");
y -= step ; Tl.DrawLatex(x1, y, "#vee")            ; Tl.DrawText(x2, y, "#vee");
y -= step ; Tl.DrawLatex(x1, y, "#void1")          ; Tl.DrawText(x2, y, "#void1");
y -= step ; Tl.DrawLatex(x1, y, "#aa")             ; Tl.DrawText(x2, y, "#aa");
y -= step ; Tl.DrawLatex(x1, y, "#/")              ; Tl.DrawText(x2, y, "#/");
y -= step ; Tl.DrawLatex(x1, y, "#upoint")         ; Tl.DrawText(x2, y, "#upoint");
y -= step ; Tl.DrawLatex(x1, y, "#partial")        ; Tl.DrawText(x2, y, "#partial");
y -= step ; Tl.DrawLatex(x1, y, "#corner")         ; Tl.DrawText(x2, y, "#corner");
y -= step ; Tl.DrawLatex(x1, y, "#ltbar")          ; Tl.DrawText(x2, y, "#ltbar");
y -= step ; Tl.DrawLatex(x1, y, "#bottombar")      ; Tl.DrawText(x2, y, "#bottombar");
y -= step ; Tl.DrawLatex(x1, y, "#rightarrow")     ; Tl.DrawText(x2, y, "#rightarrow");
y -= step ; Tl.DrawLatex(x1, y, "#surd")           ; Tl.DrawText(x2, y, "#surd");
y -= step ; Tl.DrawLatex(x1, y, "#Rightarrow")     ; Tl.DrawText(x2, y, "#Rightarrow");
y -= step ; Tl.DrawLatex(x1, y-0.015, "#int")      ; Tl.DrawText(x2, y, "#int");
y -= step ; Tl.DrawLatex(x1, y, "#odot")           ; Tl.DrawText(x2, y, "#odot");

return Ms;
}

### Delimiters

TLatex provides 4 kinds of proportional delimiters:
#[]{....} or "a la" Latex #left[.....#right] : big square brackets
#{}{....} or              #left{.....#right} : big curly brackets
#||{....} or              #left|.....#right| : big absolute value symbol
#(){....} or              #left(.....#right) : big parenthesis

### Greek Letters

The command to produce a lowercase Greek letter is obtained by adding a # to the name of the letter. For an uppercase Greek letter, just capitalize the first letter of the command name. Some letter have two representations. The name of the second one (the "variation") starts with "var". The following table gives the complete list:
{
TCanvas *Gl = new TCanvas("greek","greek",500,700);

TLatex Tl;
Tl.SetTextSize(0.03);

// Draw the columns titles
Tl.SetTextAlign(22);
Tl.DrawLatex(0.165, 0.95, "Lower case");
Tl.DrawLatex(0.495, 0.95, "Upper case");
Tl.DrawLatex(0.825, 0.95, "Variations");

// Draw the lower case letters
Tl.SetTextAlign(12);
float y, x1, x2;
y = 0.90; x1 = 0.07; x2 = x1+0.2;
Tl.DrawLatex(x1, y, "alpha : ")   ; Tl.DrawLatex(x2, y, "#alpha");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "beta : ")    ; Tl.DrawLatex(x2, y, "#beta");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "gamma : ")   ; Tl.DrawLatex(x2, y, "#gamma");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "delta : ")   ; Tl.DrawLatex(x2, y, "#delta");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "epsilon : ") ; Tl.DrawLatex(x2, y, "#epsilon");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "zeta : ")    ; Tl.DrawLatex(x2, y, "#zeta");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "eta : ")     ; Tl.DrawLatex(x2, y, "#eta");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "theta : ")   ; Tl.DrawLatex(x2, y, "#theta");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "iota : ")    ; Tl.DrawLatex(x2, y, "#iota");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "kappa : ")   ; Tl.DrawLatex(x2, y, "#kappa");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "lambda : ")  ; Tl.DrawLatex(x2, y, "#lambda");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "mu : ")      ; Tl.DrawLatex(x2, y, "#mu");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "nu : ")      ; Tl.DrawLatex(x2, y, "#nu");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "xi : ")      ; Tl.DrawLatex(x2, y, "#xi");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "omicron : ") ; Tl.DrawLatex(x2, y, "#omicron");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "pi : ")      ; Tl.DrawLatex(x2, y, "#pi");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "rho : ")     ; Tl.DrawLatex(x2, y, "#rho");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "sigma : ")   ; Tl.DrawLatex(x2, y, "#sigma");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "tau : ")     ; Tl.DrawLatex(x2, y, "#tau");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "upsilon : ") ; Tl.DrawLatex(x2, y, "#upsilon");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "phi : ")     ; Tl.DrawLatex(x2, y, "#phi");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "chi : ")     ; Tl.DrawLatex(x2, y, "#chi");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "psi : ")     ; Tl.DrawLatex(x2, y, "#psi");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "omega : ")   ; Tl.DrawLatex(x2, y, "#omega");

// Draw the upper case letters
y = 0.90; x1 = 0.40; x2 = x1+0.2;
Tl.DrawLatex(x1, y, "Alpha : ")   ; Tl.DrawLatex(x2, y, "#Alpha");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Beta : ")    ; Tl.DrawLatex(x2, y, "#Beta");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Gamma : ")   ; Tl.DrawLatex(x2, y, "#Gamma");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Delta : ")   ; Tl.DrawLatex(x2, y, "#Delta");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Epsilon : ") ; Tl.DrawLatex(x2, y, "#Epsilon");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Zeta : ")    ; Tl.DrawLatex(x2, y, "#Zeta");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Eta : ")     ; Tl.DrawLatex(x2, y, "#Eta");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Theta : ")   ; Tl.DrawLatex(x2, y, "#Theta");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Iota : ")    ; Tl.DrawLatex(x2, y, "#Iota");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Kappa : ")   ; Tl.DrawLatex(x2, y, "#Kappa");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Lambda : ")  ; Tl.DrawLatex(x2, y, "#Lambda");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Mu : ")      ; Tl.DrawLatex(x2, y, "#Mu");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Nu : ")      ; Tl.DrawLatex(x2, y, "#Nu");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Xi : ")      ; Tl.DrawLatex(x2, y, "#Xi");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Omicron : ") ; Tl.DrawLatex(x2, y, "#Omicron");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Pi : ")      ; Tl.DrawLatex(x2, y, "#Pi");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Rho : ")     ; Tl.DrawLatex(x2, y, "#Rho");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Sigma : ")   ; Tl.DrawLatex(x2, y, "#Sigma");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Tau : ")     ; Tl.DrawLatex(x2, y, "#Tau");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Upsilon : ") ; Tl.DrawLatex(x2, y, "#Upsilon");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Phi : ")     ; Tl.DrawLatex(x2, y, "#Phi");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Chi : ")     ; Tl.DrawLatex(x2, y, "#Chi");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Psi : ")     ; Tl.DrawLatex(x2, y, "#Psi");
y -= 0.0375 ; Tl.DrawLatex(x1, y, "Omega : ")   ; Tl.DrawLatex(x2, y, "#Omega");

// Draw the variations
x1 = 0.73; x2 = x1+0.2;
y = 0.7500 ; Tl.DrawLatex(x1, y, "varepsilon : ") ; Tl.DrawLatex(x2, y, "#varepsilon");
y = 0.6375 ; Tl.DrawLatex(x1, y, "vartheta : ")   ; Tl.DrawLatex(x2, y, "#vartheta");
y = 0.2625 ; Tl.DrawLatex(x1, y, "varsigma : ")   ; Tl.DrawLatex(x2, y, "#varsigma");
y = 0.1875 ; Tl.DrawLatex(x1, y, "varUpsilon : ") ; Tl.DrawLatex(x2, y, "#varUpsilon");
y = 0.1500 ; Tl.DrawLatex(x1, y, "varphi : ")     ; Tl.DrawLatex(x2, y, "#varphi");
y = 0.0375 ; Tl.DrawLatex(x1, y, "varomega : ")   ; Tl.DrawLatex(x2, y, "#varomega");

return Gl;
}

### Accents

Several kind of accents are available:
#hat    = $#hat{a}$
#check  = $#check{a}$
#acute  = $#acute{a}$
#grave  = $#grave{a}$
#dot    = $#dot{a}$
#ddot   = $#ddot{a}$
#tilde  = $#tilde{a}$

The special sign: #slash draws a slash on top of the text between brackets:
#slash{E}_{T} : $#slash{E}_{T}$

Bar and vectors sign are done the following way:
#bar{a}: $#bar{a}$
#vec{a}: $#vec{a}$

### Changing Style

One can change the font, the text color, or the text size at any time using : #font[font-number]{...}, #color[color-number]{...} and #scale[scale-factor]{...}

Examples:

#font[12]{Times Italic} and #font[22]{Times bold} : $#font[12]{Times Italic} and #font[22]{Times bold}$
#color[2]{Red} and #color[4]{Blue} : $#color[2]{Red} and #color[4]{Blue}$
#scale[1.2]{Bigger} and #scale[0.8]{Smaller} : $#scale[1.2]{Bigger} and #scale[0.8]{Smaller}$

### Alignment Rules

The TText alignment rules apply to the TLatex objects with one exception concerning the vertical alignment:
• if the vertical alignment = 1 , subscripts are not taken into account
• if the vertical alignment = 0 , the text is aligned to the box surrounding the full text with sub and superscripts
This is illustrated by the following example:
{
TCanvas Tlva("Tlva","Tlva",500,500);
Tlva.SetGrid();
Tlva.DrawFrame(0,0,1,1);
const char *longstring = "K_{S}... K^{*0}... #frac{2s}{#pi#alpha^{2}}
#frac{d#sigma}{dcos#theta} (e^{+}e^{-} #rightarrow f#bar{f} ) =
#left| #frac{1}{1 - #Delta#alpha} #right|^{2} (1+cos^{2}#theta)";

TLatex latex;
latex.SetTextSize(0.025);
latex.SetTextAlign(13);  //align at top
latex.DrawLatex(.2,.9,"K_{S}");
latex.DrawLatex(.3,.9,"K^{*0}");
latex.DrawLatex(.2,.8,longstring);

latex.SetTextAlign(12);  //centered
latex.DrawLatex(.2,.6,"K_{S}");
latex.DrawLatex(.3,.6,"K^{*0}");
latex.DrawLatex(.2,.5,longstring);

latex.SetTextAlign(11);  //default bottom alignment
latex.DrawLatex(.2,.4,"K_{S}");
latex.DrawLatex(.3,.4,"K^{*0}");
latex.DrawLatex(.2,.3,longstring);

latex.SetTextAlign(10);  //special bottom alignment
latex.DrawLatex(.2,.2,"K_{S}");
latex.DrawLatex(.3,.2,"K^{*0}");
latex.DrawLatex(.2,.1,longstring);

latex.SetTextAlign(12);
latex->SetTextFont(72);
latex->DrawLatex(.1,.80,"13");
latex->DrawLatex(.1,.55,"12");
latex->DrawLatex(.1,.35,"11");
latex->DrawLatex(.1,.18,"10");
return Tlva;
}

### Examples

{
TCanvas ex1("ex1","Latex",500,600);
TLatex Tl;
Tl.SetTextAlign(12);
Tl.SetTextSize(0.04);
Tl.DrawLatex(0.1,0.8,"1)   C(x) = d #sqrt{#frac{2}{#lambdaD}}  #int^{x}_{0}cos(#frac{#pi}{2}t^{2})dt");
Tl.DrawLatex(0.1,0.6,"2)   C(x) = d #sqrt{#frac{2}{#lambdaD}}  #int^{x}cos(#frac{#pi}{2}t^{2})dt");
Tl.DrawLatex(0.1,0.4,"3)   R = |A|^{2} = #frac{1}{2}(#[]{#frac{1}{2}+C(V)}^{2}+#[]{#frac{1}{2}+S(V)}^{2})");
Tl.DrawLatex(0.1,0.2,"4)   F(t) = #sum_{i=-#infty}^{#infty}A(i)cos#[]{#frac{i}{t+i}}");
return ex1;
}
{
TCanvas ex2("ex2","Latex",500,300);
TLatex Tl;
Tl.SetTextAlign(23);
Tl.SetTextSize(0.08);
Tl.DrawLatex(0.5,0.95,"e^{+}e^{-}#rightarrowZ^{0}#rightarrowI#bar{I}, q#bar{q}");
Tl.DrawLatex(0.5,0.75,"|#vec{a}#bullet#vec{b}|=#Sigmaa^{i}_{jk}+b^{bj}_{i}");
Tl.DrawLatex(0.5,0.5,"i(#partial_{#mu}#bar{#psi}#gamma^{#mu}+m#bar{#psi}=0#Leftrightarrow(#Box+m^{2})#psi=0");
Tl.DrawLatex(0.5,0.3,"L_{em}=eJ^{#mu}_{em}A_{#mu} , J^{#mu}_{em}=#bar{I}#gamma_{#mu}I , M^{j}_{i}=#SigmaA_{#alpha}#tau^{#alphaj}_{i}");
return ex2;
}
{
TCanvas ex3("ex3","Latex",500,300);
TPaveText pt(.1,.1,.9,.9);
pt.AddText("#frac{2s}{#pi#alpha^{2}}  #frac{d#sigma}{dcos#theta} (e^{+}e^{-} #rightarrow f#bar{f} ) = ");
pt.AddText("#left| #frac{1}{1 - #Delta#alpha} #right|^{2} (1+cos^{2}#theta");
pt.AddText("+ 4 Re #left{ #frac{2}{1 - #Delta#alpha} #chi(s) #[]{#hat{g}_{#nu}^{e}#hat{g}_{#nu}^{f}
(1 + cos^{2}#theta) + 2 #hat{g}_{a}^{e}#hat{g}_{a}^{f} cos#theta) } #right}");
pt.SetLabel("Born equation");
pt.Draw();
return ex3;
}

## Function Members (Methods)

public:
protected:
 TLatexFormSize Anal1(TextSpec_t spec, const Char_t* t, Int_t length) TLatexFormSize Analyse(Double_t x, Double_t y, TextSpec_t spec, const Char_t* t, Int_t length) Int_t CheckLatexSyntax(TString& text) virtual void TObject::DoError(int level, const char* location, const char* fmt, va_list va) const void DrawCircle(Double_t x1, Double_t y1, Double_t r, TextSpec_t spec) void DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2, TextSpec_t spec) void DrawParenthesis(Double_t x1, Double_t y1, Double_t r1, Double_t r2, Double_t phimin, Double_t phimax, TextSpec_t spec) TLatexFormSize FirstParse(Double_t angle, Double_t size, const Char_t* text) void TObject::MakeZombie() TLatex& operator=(const TLatex&) TLatexFormSize Readfs() void Savefs(TLatexFormSize* fs)

## Data Members

public:
 enum { kTextNDC }; enum TText::[unnamed] { kTextNDC }; enum TObject::EStatusBits { kCanDelete kMustCleanup kObjInCanvas kIsReferenced kHasUUID kCannotPick kNoContextMenu kInvalidObject }; enum TObject::[unnamed] { kIsOnHeap kNotDeleted kZombie kBitMask kSingleKey kOverwrite kWriteDelete };
protected:
 const Char_t* fError !error code Double_t fFactorPos !Relative position of subscripts and superscripts Double_t fFactorSize !Relative size of subscripts and superscripts Int_t fLimitFactorSize lower bound for subscripts/superscripts size Color_t TAttLine::fLineColor line color Style_t TAttLine::fLineStyle line style Width_t TAttLine::fLineWidth line width TString TNamed::fName object identifier Double_t fOriginSize Font size of the starting font Int_t fPos !Current position in array fTabSize; Bool_t fShow !is true during the second pass (Painting) Int_t fTabMax !Maximum allocation for array fTabSize; FormSize_t* fTabSize !array of values for the different zones Short_t TAttText::fTextAlign Text alignment Float_t TAttText::fTextAngle Text angle Color_t TAttText::fTextColor Text color index Font_t TAttText::fTextFont Text font number Float_t TAttText::fTextSize Text size TString TNamed::fTitle object title Double_t TText::fX X position of text (left,center,etc..) Double_t TText::fY Y position of text (left,center,etc..)

## Function documentation

TLatex()
Default constructor.
TLatex(Double_t x, Double_t y, const char* text)
Normal constructor.
~TLatex()
Destructor.
TLatex(const TLatex& text)
Copy constructor.
TLatex& operator=(const TLatex& )
assignment operator
void Copy(TObject& text) const
Copy this TLatex object to another TLatex.
TLatexFormSize Anal1(TextSpec_t spec, const Char_t* t, Int_t length)
Analyse function.
TLatexFormSize Analyse(Double_t x, Double_t y, TextSpec_t spec, const Char_t* t, Int_t length)
Analyse and paint the TLatex formula

It is called twice : first for calculating the size of
each portion of the formula, then to paint the formula.
When analyse finds an operator or separator, it calls
itself recursively to analyse the arguments of the operator.
when the argument is an atom (normal text), it calculates
the size of it and return it as the result.
for example : if the operator #frac{arg1}{arg2} is found :
Analyse(arg1) return the size of arg1 (width, up, down)
Analyse(arg2) return the size of arg2
now, we know the size of #frac{arg1}{arg2}  :
width = max(width_arg1, width_arg2)
up = up_arg1 + down_arg1
down = up_arg2 + down_arg2
so, when the user wants to paint a fraction at position (x,y),
the rect used for the formula is : (x,y-up,x+width,y+down)

return size of zone occupied by the text/formula
t : chain to be analyzed
length : number of chars in t.
TLatex * DrawLatex(Double_t x, Double_t y, const char* text)
Make a copy of this object with the new parameters
And copy object attributes
void DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2, TextSpec_t spec)
Draw a line in a Latex formula
void DrawCircle(Double_t x1, Double_t y1, Double_t r, TextSpec_t spec)
Draw an arc of ellipse in a Latex formula (right or left parenthesis)
void DrawParenthesis(Double_t x1, Double_t y1, Double_t r1, Double_t r2, Double_t phimin, Double_t phimax, TextSpec_t spec)
Draw an arc of ellipse in a Latex formula (right or left parenthesis)
void Paint(Option_t* option = "")
void PaintLatex(Double_t x, Double_t y, Double_t angle, Double_t size, const char* text)
Main drawing function

Warning: Unlike most others "XYZ::PaintXYZ" methods, PaintLatex modifies
the TLatex data members.
Int_t CheckLatexSyntax(TString& text)
Check if the Latex syntax is correct
TLatexFormSize FirstParse(Double_t angle, Double_t size, const Char_t* text)
First parsing of the analyse sequence
Double_t GetHeight() const
Return height of current pad in pixels

Return size of the formula along X in pad coordinates
void GetBoundingBox(UInt_t& w, UInt_t& h, Bool_t angle = kFALSE)
Return text size in pixels

Return size of the formula along Y in pad coordinates