Logo ROOT   6.14/05
Reference Guide
latex4.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_graphics
3 /// \notebook
4 /// Draw the Greek letters as a table and save the result as GIF, PS, PDF
5 /// and SVG files.
6 /// Lowercase Greek letters are obtained by adding a # to the name of the letter.
7 /// For an uppercase Greek letter, just capitalize the first letter of the
8 /// command name. Some letter have two representations. The name of the
9 /// second one (the "variation") starts with "var".
10 ///
11 /// \macro_image
12 ///
13 /// \author Rene Brun
14 
15 void latex4() {
16  TCanvas *c1 = new TCanvas("greek","greek",600,700);
17 
18  TLatex l;
19  l.SetTextSize(0.03);
20 
21  // Draw the columns titles
22  l.SetTextAlign(22);
23  l.DrawLatex(0.165, 0.95, "Lower case");
24  l.DrawLatex(0.495, 0.95, "Upper case");
25  l.DrawLatex(0.825, 0.95, "Variations");
26 
27  // Draw the lower case letters
28  l.SetTextAlign(12);
29  float y, x1, x2;
30  y = 0.90; x1 = 0.07; x2 = x1+0.2;
31  l.DrawLatex(x1, y, "alpha : ") ; l.DrawLatex(x2, y, "#alpha");
32  y -= 0.0375 ; l.DrawLatex(x1, y, "beta : ") ; l.DrawLatex(x2, y, "#beta");
33  y -= 0.0375 ; l.DrawLatex(x1, y, "gamma : ") ; l.DrawLatex(x2, y, "#gamma");
34  y -= 0.0375 ; l.DrawLatex(x1, y, "delta : ") ; l.DrawLatex(x2, y, "#delta");
35  y -= 0.0375 ; l.DrawLatex(x1, y, "epsilon : ") ; l.DrawLatex(x2, y, "#epsilon");
36  y -= 0.0375 ; l.DrawLatex(x1, y, "zeta : ") ; l.DrawLatex(x2, y, "#zeta");
37  y -= 0.0375 ; l.DrawLatex(x1, y, "eta : ") ; l.DrawLatex(x2, y, "#eta");
38  y -= 0.0375 ; l.DrawLatex(x1, y, "theta : ") ; l.DrawLatex(x2, y, "#theta");
39  y -= 0.0375 ; l.DrawLatex(x1, y, "iota : ") ; l.DrawLatex(x2, y, "#iota");
40  y -= 0.0375 ; l.DrawLatex(x1, y, "kappa : ") ; l.DrawLatex(x2, y, "#kappa");
41  y -= 0.0375 ; l.DrawLatex(x1, y, "lambda : ") ; l.DrawLatex(x2, y, "#lambda");
42  y -= 0.0375 ; l.DrawLatex(x1, y, "mu : ") ; l.DrawLatex(x2, y, "#mu");
43  y -= 0.0375 ; l.DrawLatex(x1, y, "nu : ") ; l.DrawLatex(x2, y, "#nu");
44  y -= 0.0375 ; l.DrawLatex(x1, y, "xi : ") ; l.DrawLatex(x2, y, "#xi");
45  y -= 0.0375 ; l.DrawLatex(x1, y, "omicron : ") ; l.DrawLatex(x2, y, "#omicron");
46  y -= 0.0375 ; l.DrawLatex(x1, y, "pi : ") ; l.DrawLatex(x2, y, "#pi");
47  y -= 0.0375 ; l.DrawLatex(x1, y, "rho : ") ; l.DrawLatex(x2, y, "#rho");
48  y -= 0.0375 ; l.DrawLatex(x1, y, "sigma : ") ; l.DrawLatex(x2, y, "#sigma");
49  y -= 0.0375 ; l.DrawLatex(x1, y, "tau : ") ; l.DrawLatex(x2, y, "#tau");
50  y -= 0.0375 ; l.DrawLatex(x1, y, "upsilon : ") ; l.DrawLatex(x2, y, "#upsilon");
51  y -= 0.0375 ; l.DrawLatex(x1, y, "phi : ") ; l.DrawLatex(x2, y, "#phi");
52  y -= 0.0375 ; l.DrawLatex(x1, y, "chi : ") ; l.DrawLatex(x2, y, "#chi");
53  y -= 0.0375 ; l.DrawLatex(x1, y, "psi : ") ; l.DrawLatex(x2, y, "#psi");
54  y -= 0.0375 ; l.DrawLatex(x1, y, "omega : ") ; l.DrawLatex(x2, y, "#omega");
55 
56  // Draw the upper case letters
57  y = 0.90; x1 = 0.40; x2 = x1+0.2;
58  l.DrawLatex(x1, y, "Alpha : ") ; l.DrawLatex(x2, y, "#Alpha");
59  y -= 0.0375 ; l.DrawLatex(x1, y, "Beta : ") ; l.DrawLatex(x2, y, "#Beta");
60  y -= 0.0375 ; l.DrawLatex(x1, y, "Gamma : ") ; l.DrawLatex(x2, y, "#Gamma");
61  y -= 0.0375 ; l.DrawLatex(x1, y, "Delta : ") ; l.DrawLatex(x2, y, "#Delta");
62  y -= 0.0375 ; l.DrawLatex(x1, y, "Epsilon : ") ; l.DrawLatex(x2, y, "#Epsilon");
63  y -= 0.0375 ; l.DrawLatex(x1, y, "Zeta : ") ; l.DrawLatex(x2, y, "#Zeta");
64  y -= 0.0375 ; l.DrawLatex(x1, y, "Eta : ") ; l.DrawLatex(x2, y, "#Eta");
65  y -= 0.0375 ; l.DrawLatex(x1, y, "Theta : ") ; l.DrawLatex(x2, y, "#Theta");
66  y -= 0.0375 ; l.DrawLatex(x1, y, "Iota : ") ; l.DrawLatex(x2, y, "#Iota");
67  y -= 0.0375 ; l.DrawLatex(x1, y, "Kappa : ") ; l.DrawLatex(x2, y, "#Kappa");
68  y -= 0.0375 ; l.DrawLatex(x1, y, "Lambda : ") ; l.DrawLatex(x2, y, "#Lambda");
69  y -= 0.0375 ; l.DrawLatex(x1, y, "Mu : ") ; l.DrawLatex(x2, y, "#Mu");
70  y -= 0.0375 ; l.DrawLatex(x1, y, "Nu : ") ; l.DrawLatex(x2, y, "#Nu");
71  y -= 0.0375 ; l.DrawLatex(x1, y, "Xi : ") ; l.DrawLatex(x2, y, "#Xi");
72  y -= 0.0375 ; l.DrawLatex(x1, y, "Omicron : ") ; l.DrawLatex(x2, y, "#Omicron");
73  y -= 0.0375 ; l.DrawLatex(x1, y, "Pi : ") ; l.DrawLatex(x2, y, "#Pi");
74  y -= 0.0375 ; l.DrawLatex(x1, y, "Rho : ") ; l.DrawLatex(x2, y, "#Rho");
75  y -= 0.0375 ; l.DrawLatex(x1, y, "Sigma : ") ; l.DrawLatex(x2, y, "#Sigma");
76  y -= 0.0375 ; l.DrawLatex(x1, y, "Tau : ") ; l.DrawLatex(x2, y, "#Tau");
77  y -= 0.0375 ; l.DrawLatex(x1, y, "Upsilon : ") ; l.DrawLatex(x2, y, "#Upsilon");
78  y -= 0.0375 ; l.DrawLatex(x1, y, "Phi : ") ; l.DrawLatex(x2, y, "#Phi");
79  y -= 0.0375 ; l.DrawLatex(x1, y, "Chi : ") ; l.DrawLatex(x2, y, "#Chi");
80  y -= 0.0375 ; l.DrawLatex(x1, y, "Psi : ") ; l.DrawLatex(x2, y, "#Psi");
81  y -= 0.0375 ; l.DrawLatex(x1, y, "Omega : ") ; l.DrawLatex(x2, y, "#Omega");
82 
83  // Draw the variations
84  x1 = 0.73; x2 = x1+0.2;
85  y = 0.7500 ; l.DrawLatex(x1, y, "varepsilon : ") ; l.DrawLatex(x2, y, "#varepsilon");
86  y = 0.6375 ; l.DrawLatex(x1, y, "vartheta : ") ; l.DrawLatex(x2, y, "#vartheta");
87  y = 0.2625 ; l.DrawLatex(x1, y, "varsigma : ") ; l.DrawLatex(x2, y, "#varsigma");
88  y = 0.1875 ; l.DrawLatex(x1, y, "varUpsilon : ") ; l.DrawLatex(x2, y, "#varUpsilon");
89  y = 0.1500 ; l.DrawLatex(x1, y, "varphi : ") ; l.DrawLatex(x2, y, "#varphi");
90  y = 0.0375 ; l.DrawLatex(x1, y, "varomega : ") ; l.DrawLatex(x2, y, "#varomega");
91 
92  // Save the picture in various formats
93  c1->Print("greek.ps");
94  c1->Print("greek.gif");
95  c1->Print("greek.pdf");
96  c1->Print("greek.svg");
97 }
return c1
Definition: legend1.C:41
static const double x2[5]
To draw Mathematical Formula.
Definition: TLatex.h:18
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.
Definition: TLatex.cxx:1914
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
Definition: TAttText.h:41
virtual void Print(const char *filename="") const
Save Pad contents in a file in one of various formats.
Definition: TPad.cxx:4617
The Canvas class.
Definition: TCanvas.h:31
static const double x1[5]
Double_t y[n]
Definition: legend1.C:17
auto * l
Definition: textangle.C:4
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
Definition: TAttText.h:46