449 latex.TLatex::Copy(*
this);
459 TAttLine::operator=(lt);
526 const char *tab[] = {
"alpha",
"beta",
"chi",
"delta",
"varepsilon",
"phi",
"gamma",
"eta",
"iota",
"varphi",
"kappa",
"lambda",
527 "mu",
"nu",
"omicron",
"pi",
"theta",
"rho",
"sigma",
"tau",
"upsilon",
"varomega",
"omega",
"xi",
"psi",
"zeta",
528 "Alpha",
"Beta",
"Chi",
"Delta",
"Epsilon",
"Phi",
"Gamma",
"Eta",
"Iota",
"vartheta",
529 "Kappa",
"Lambda",
"Mu",
"Nu",
"Omicron",
"Pi",
"Theta",
"Rho",
"Sigma",
"Tau",
530 "Upsilon",
"varsigma",
"Omega",
"Xi",
"Psi",
"Zeta",
"varUpsilon",
"epsilon"};
532 const char *
tab2[] = {
"leq",
"/",
"infty",
"voidb",
"club",
"diamond",
"heart",
533 "spade",
"leftrightarrow",
"leftarrow",
"uparrow",
"rightarrow",
534 "downarrow",
"circ",
"pm",
"doublequote",
"geq",
"times",
"propto",
535 "partial",
"bullet",
"divide",
"neq",
"equiv",
"approx",
"3dots",
536 "cbar",
"topbar",
"downleftarrow",
"aleph",
"Jgothic",
"Rgothic",
"voidn",
537 "otimes",
"oplus",
"oslash",
"cap",
"cup",
"supset",
"supseteq",
538 "notsubset",
"subset",
"subseteq",
"in",
"notin",
"angle",
"nabla",
539 "oright",
"ocopyright",
"trademark",
"prod",
"surd",
"upoint",
"corner",
"wedge",
540 "vee",
"Leftrightarrow",
"Leftarrow",
"Uparrow",
"Rightarrow",
541 "Downarrow",
"diamond",
"LT",
"void1",
"copyright",
"void3",
"sum",
542 "arctop",
"lbar",
"arcbottom",
"topbar",
"void8",
"bottombar",
"arcbar",
543 "ltbar",
"AA",
"aa",
"void06",
"GT",
"int",
"forall",
"exists" };
545 const char *
tab3[] = {
"bar",
"vec",
"dot",
"hat",
"ddot",
"acute",
"grave",
"check",
"tilde",
"slash"};
549 Int_t nBlancDeb = 0, nBlancFin = 0, l_nBlancDeb = 0, l_nBlancFin = 0;
551 Int_t min = 0, max = 0;
562 if (nBlancDeb==l_nBlancDeb && nBlancFin==l_nBlancFin) cont =
kFALSE;
565 if (t[nBlancDeb]==
'{' && t[
length-nBlancFin-1]==
'}') {
568 for(i=nBlancDeb;i<
length-nBlancFin;i++) {
569 if (t[i] ==
'{' && !(i>0 && t[i-1] ==
'@')) nBrackets++;
570 if (t[i] ==
'}' && t[i-1]!=
'@') nBrackets--;
571 if (nBrackets==0 && i<
length-nBlancFin-2) {
587 l_nBlancDeb = nBlancDeb;
588 l_nBlancFin = nBlancFin;
593 length -= nBlancFin+nBlancDeb;
595 Error(
"Analyse",
"It seems there is a syntax error in the TLatex string");
605 indiceSize = spec.
fSize;
608 specNewSize.
fSize = indiceSize;
617 Int_t opCurlyCurly = -1;
618 Int_t opSquareCurly = -1;
619 Int_t opCloseCurly = -2;
626 Int_t opSquareBracket = 0 ;
627 Int_t opBigCurly = 0 ;
630 Int_t abovePlace = 0 ;
638 Int_t opBackslash = 0;
639 Int_t opParallel = 0;
640 Int_t opSplitLine = -1;
652 case '\'' : quote1 = !quote1 ; break ;
653 case '"' : quote2 = !quote2 ; break ;
659 if (!(i>0 &&
text[i-1] ==
'@')) nBrackets++;
664 if (!(i>0 &&
text[i-1] ==
'@')) nBrackets--;
666 if (i<
length-1)
if (
text[i+1]==
'{' && opCurlyCurly==-1) opCurlyCurly=i;
668 if (
text[i+1]!=
'{' && !(
text[i+2]==
'{' && (
text[i+1]==
'^' ||
text[i+1]==
'_'))
669 && opCloseCurly==-2) opCloseCurly=i;
672 if (
text[i+1]!=
'{' && opCloseCurly==-2) opCloseCurly=i;
674 else if (opCloseCurly==-2) opCloseCurly=i;
680 if (!(i>0 &&
text[i-1] ==
'@')) nCroch++;
685 if (!(i>0 &&
text[i-1] ==
'@')) nCroch--;
697 strncpy(buf,&
text[i],2);
698 if (strncmp(buf,
"^{",2)==0) {
699 if (opPower==-1 && nBrackets==0 && nCroch==0) opPower=i;
702 strncpy(buf1,&
text[i-4],4);
703 if (strncmp(buf1,
"#int",4)==0) {
705 if (i>4 && opCloseCurly==-2) opCloseCurly=i-5;
707 if (strncmp(buf1,
"#sum",4)==0) {
709 if (i>4 && opCloseCurly==-2) opCloseCurly=i-5;
713 if (strncmp(buf,
"_{",2)==0) {
714 if (opUnder==-1 && nBrackets==0 && nCroch==0) opUnder=i;
717 strncpy(buf2,&
text[i-4],4);
718 if (strncmp(buf2,
"#int",4)==0) {
720 if (i>4 && opCloseCurly==-2) opCloseCurly=i-5;
722 if (strncmp(buf2,
"#sum",4)==0) {
724 if (i>4 && opCloseCurly==-2) opCloseCurly=i-5;
728 if (strncmp(buf,
"]{",2)==0)
729 if (opSquareCurly==-1 && nBrackets==0 && nCroch==0) opSquareCurly=i;
732 if (
text[i]==
'\\' || (
text[i]==
'#' && !opFound && nBrackets==0 && nCroch==0)) {
736 strncpy(buf,&
text[i+1],10);
737 if (strncmp(buf,
"splitline{",10)==0) {
738 opSplitLine=i; opFound =
kTRUE;
739 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
745 strncpy(buf,&
text[i+1],9);
746 if (!opBackslash && strncmp(buf,
"backslash",9)==0) {
747 opBackslash=1; opFound =
kTRUE;
748 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
754 strncpy(buf,&
text[i+1],8);
755 if (!opParallel && strncmp(buf,
"parallel",8)==0) {
756 opParallel=1; opFound =
kTRUE;
757 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
763 strncpy(buf,&
text[i+1],6);
764 if (strncmp(buf,
"lower[",6)==0 || strncmp(buf,
"lower{",6)==0) {
765 opLower=i; opFound =
kTRUE;
766 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
769 if (strncmp(buf,
"scale[",6)==0 || strncmp(buf,
"scale{",6)==0) {
770 opScale=i; opFound =
kTRUE;
771 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
774 if (strncmp(buf,
"color[",6)==0 || strncmp(buf,
"color{",6)==0) {
775 opColor=i; opFound =
kTRUE;
776 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
782 strncpy(buf,&
text[i+1],5);
783 if (strncmp(buf,
"frac{",5)==0) {
784 opFrac=i; opFound =
kTRUE;
785 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
788 if (strncmp(buf,
"sqrt{",5)==0 || strncmp(buf,
"sqrt[",5)==0) {
789 opSqrt=i; opFound =
kTRUE;
790 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
793 if (strncmp(buf,
"font{",5)==0 || strncmp(buf,
"font[",5)==0) {
794 opFont=i; opFound =
kTRUE;
795 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
798 if (strncmp(buf,
"kern[",5)==0 || strncmp(buf,
"kern{",5)==0) {
799 opKern=i; opFound =
kTRUE;
800 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
803 if (!opMinus && strncmp(buf,
"minus",5)==0) {
804 opMinus=1; opFound =
kTRUE;
805 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
808 if (strncmp(buf,
"mbox[",5)==0 || strncmp(buf,
"mbox{",5)==0) {
809 opMbox=i; opFound =
kTRUE;
810 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
816 strncpy(buf,&
text[i+1],4);
817 if (!opOdot && strncmp(buf,
"odot",4)==0) {
818 opOdot=1; opFound =
kTRUE;
819 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
822 if (!opHbar && strncmp(buf,
"hbar",4)==0) {
823 opHbar=1; opFound =
kTRUE;
824 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
827 if (!opPerp && strncmp(buf,
"perp",4)==0) {
828 opPerp=1; opFound =
kTRUE;
829 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
832 if (!opPlus && strncmp(buf,
"plus",4)==0) {
833 opPlus=1; opFound =
kTRUE;
834 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
840 strncpy(buf,&
text[i+1],3);
842 if (strncmp(buf,
"[]{",3)==0) {
843 opSquareBracket=1; opFound =
kTRUE;
844 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
847 if (strncmp(buf,
"{}{",3)==0 ) {
848 opBigCurly=1; opFound =
kTRUE;
849 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
852 if (strncmp(buf,
"||{",3)==0) {
853 opAbs=1; opFound =
kTRUE;
854 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
857 if (strncmp(buf,
"(){",3)==0) {
858 opParen=1; opFound =
kTRUE;
859 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
862 if (!opBox && strncmp(buf,
"Box",3)==0) {
863 opBox=1; opFound =
kTRUE;
864 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
867 if (strncmp(buf,
"bf[",3)==0 || strncmp(buf,
"bf{",3)==0) {
868 opBf=i; opFound =
kTRUE;
869 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
872 if (strncmp(buf,
"it[",3)==0 || strncmp(buf,
"it{",3)==0) {
873 opIt=i; opFound =
kTRUE;
874 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
880 strncpy(buf,&
text[i+1],2);
881 if (!opMp && strncmp(buf,
"mp",2)==0) {
882 opMp=1; opFound =
kTRUE;
883 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
889 if (strncmp(&
text[i+1],tab[k],strlen(tab[k]))==0) {
892 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
901 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
910 lastsize = strlen(
tab2[k]);
913 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
926 if (opCloseCurly>-1 && opCloseCurly<
length-1) {
939 else if (opPower>-1 && opUnder>-1) {
944 switch (abovePlace) {
946 prop = .8 ; propU = 1.75 ;
949 prop = .9 ; propU = 1.75 ;
958 if (min >= 2 && strncmp(&
text[min-2],
"{}",2)==0) {
965 fs2 =
Anal1(specNewSize,
text+min+1,max-min-1);
977 if (opPower<opUnder) {
987 Double_t addW1, addW2, addH1, addH2;
990 if (opPower<opUnder) {
992 addW1 = (
m-fs2.
Width())/2;
994 addW2 = (
m-fs3.
Width())/2;
997 addW1 = (
m-fs2.
Width())/2;
999 addW2 = (
m-fs3.
Width())/2;
1006 if (min >= 2 && strncmp(&
text[min-2],
"{}",2)==0) {
1015 if (opPower<opUnder) {
1025 if (opPower<opUnder) {
1034 else if (opPower>-1) {
1037 switch (abovePlace) {
1039 prop = 1.75 ; break ;
1041 prop = 1.75; break ;
1045 Int_t ltext = opPower ;
1046 if (ltext >= 2 && strncmp(&
text[ltext-2],
"{}",2)==0) {
1062 if (over <= 0) over = 1.5*fs2.
Over();
1073 if (opPower >= 2 && strncmp(&
text[opPower-2],
"{}",2)==0) {
1088 else if (opUnder>-1) {
1094 Int_t ltext = opUnder ;
1095 if (ltext >= 2 && strncmp(&
text[ltext-2],
"{}",2)==0) {
1120 if (opUnder >= 2 && strncmp(&
text[opUnder-2],
"{}",2)==0) {
1266 else if (opBackslash) {
1287 else if (opParallel) {
1302 else if (opGreek>-1) {
1305 char letter = 97 + opGreek;
1307 if (opGreek>25) letter -= 58;
1308 if (opGreek == 52) letter =
'\241';
1309 if (opGreek == 53) letter =
'\316';
1311 fs1 =
Anal1(newSpec,&letter,1);
1312 fs2 =
Anal1(spec,
text+strlen(tab[opGreek])+1,
length-strlen(tab[opGreek])-1);
1323 else if (opSpec>-1) {
1326 char letter =
'\243' + opSpec;
1327 if(opSpec == 75 || opSpec == 76) {
1329 if (
gVirtualX->InheritsFrom(
"TGCocoa")) {
1330 if (opSpec == 75) letter =
'\201';
1331 if (opSpec == 76) letter =
'\214';
1333 if (opSpec == 75) letter =
'\305';
1334 if (opSpec == 76) letter =
'\345';
1337 if(opSpec == 80 || opSpec == 81) {
1338 if (opSpec == 80) letter =
'\042';
1339 if (opSpec == 81) letter =
'\044';
1347 }
else if (opSpec==79) {
1351 fs1 =
Anal1(newSpec,&letter,1);
1352 if (opSpec == 79 || opSpec == 66)
1360 if (opSpec!=66 && opSpec!=79)
1368 else if (opAbove>-1) {
1379 xx[0] =
x; xx[1] =
x + fs1.
Width();
1380 yy[0] = yy[1] =
y - sub - fs1.
Over();
1387 midy =
y - sub - fs1.
Over() - dd;
1388 xx[0] =
x; xx[1] =
x + fs1.
Width();
1389 yy[0] = yy[1] = midy;
1391 xx[1] =
x + fs1.
Width(); xx[0] = xx[2] = xx[1] - 2*dd;
1392 yy[0] = midy - dd; yy[1] = midy; yy[2] = midy + dd;
1398 midx =
x + fs1.
Width()/2,
1399 midy =
y - sub - fs1.
Over() - dd;
1400 Double_t xx[5] = { midx - dd, midx - dd, midx + dd, midx + dd, midx - dd },
1401 yy[5] = { midy + dd, midy - dd, midy - dd, midy + dd, midy + dd };
1407 xx[1] =
x + fs1.
Width()/2;
1408 xx[0] = xx[1] - fs1.
Width()/3;
1409 xx[2] = xx[1] + fs1.
Width()/3;
1410 yy[0] =
y - sub - fs1.
Over();
1411 yy[1] = yy[0] - 2*sub;
1418 midx =
x + fs1.
Width()/2 - 1.5*sub,
1419 midy =
y - sub - fs1.
Over() - dd;
1420 Double_t xx1[5] = { midx - dd, midx - dd, midx + dd, midx + dd, midx - dd },
1421 yy1[5] = { midy + dd, midy - dd, midy - dd, midy + dd, midy + dd };
1423 midx =
x + fs1.
Width()/2 + 1.5*sub;
1424 Double_t xx2[5] = { midx - dd, midx - dd, midx + dd, midx + dd, midx - dd },
1425 yy2[5] = { midy + dd, midy - dd, midy - dd, midy + dd, midy + dd };
1431 xx[0] =
x + fs1.
Width()/2; xx[1] = xx[0] + 3*sub;
1432 yy[0] =
y - sub - fs1.
Over();
1433 yy[1] = yy[0] - 2.5*sub;
1439 xx[0] =
x + fs1.
Width()/2 + sub; xx[1] = xx[0] - 2*sub;
1440 yy[0] =
y - sub - fs1.
Over();
1441 yy[1] = yy[0] - 2*sub;
1447 xx[1] =
x+fs1.
Width()/2; xx[0] = xx[1] - 2*sub; xx[2] = xx[1] + 2*sub;
1448 yy[1] =
y - sub - fs1.
Over();
1449 yy[0] = yy[2] = yy[1] - 2*sub;
1460 if (
gVirtualX->InheritsFrom(
"TGCocoa"))
y2 -= 4.7*sub;
1477 xx =
gPad->AbsPixeltoX(
Int_t((
x2-xOrigin)*cosang+(y22-yOrigin)*sinang+xOrigin));
1478 yy =
gPad->AbsPixeltoY(
Int_t((
x2-xOrigin)*-sinang+(y22-yOrigin)*cosang+yOrigin));
1486 xx[0] =
x + 0.8*fs1.
Width();
1487 yy[0] =
y - fs1.
Over() - sub;
1488 xx[1] =
x + 0.3*fs1.
Width();
1489 yy[1] = yy[0] + fs1.
Height() + 2*sub;
1496 if (opAbove==1) div=4;
1499 else if (opSquareBracket) {
1519 Double_t radius2,radius1 , dw, l2 =
l/2 ;
1525 radius1 = radius2 * 2 / 3;
1530 radius1 = radius2 * 2 / 3;
1556 else if (opBigCurly) {
1598 else if (opFrac>-1) {
1599 if (opCurlyCurly==-1) {
1601 fError =
"Missing denominator for #frac";
1607 fs1 =
Anal1(spec,
text+opFrac+6,opCurlyCurly-opFrac-6);
1631 else if (opSplitLine>-1) {
1632 if (opCurlyCurly==-1) {
1634 fError =
"Missing second line for #splitline";
1640 fs1 =
Anal1(spec,
text+opSplitLine+11,opCurlyCurly-opSplitLine-11);
1654 else if (opSqrt>-1) {
1656 if (opSquareCurly>-1) {
1658 fs1 =
Anal1(specNewSize,
text+opSqrt+6,opSquareCurly-opSqrt-6);
1670 if (opSquareCurly>-1) {
1707 else if (opColor>-1) {
1708 if (opSquareCurly==-1) {
1710 fError =
"Missing color number. Syntax is #color[(Int_t)nb]{ ... }";
1716 strncpy(nb,
text+opColor+7,opSquareCurly-opColor-7);
1717 nb[opSquareCurly-opColor-7] = 0;
1718 if (sscanf(nb,
"%d",&newSpec.
fColor) < 1) {
1721 fError =
"Invalid color number. Syntax is #color[(Int_t)nb]{ ... }";
1732 else if (opFont>-1) {
1733 if (opSquareCurly==-1) {
1735 fError =
"Missing font number. Syntax is #font[nb]{ ... }";
1741 strncpy(nb,
text+opFont+6,opSquareCurly-opFont-6);
1742 nb[opSquareCurly-opFont-6] = 0;
1743 if (sscanf(nb,
"%d",&newSpec.
fFont) < 1) {
1746 fError =
"Invalid font number. Syntax is #font[(Int_t)nb]{ ... }";
1757 else if (opKern>-1) {
1758 if (opSquareCurly==-1) {
1760 fError =
"Missing horizontal shift number. Syntax is #kern[dx]{ ... }";
1765 strncpy(dxc,
text+opKern+6,opSquareCurly-opKern-6);
1766 dxc[opSquareCurly-opKern-6] = 0;
1768 if (sscanf(dxc,
"%f",&dx) < 1) {
1771 fError =
"Invalid horizontal shift number. Syntax is #kern[(Float_t)dx]{ ... }";
1787 else if (opLower>-1) {
1788 if (opSquareCurly==-1) {
1790 fError =
"Missing vertical shift number. Syntax is #lower[dy]{ ... }";
1795 strncpy(dyc,
text+opLower+7,opSquareCurly-opLower-7);
1796 dyc[opSquareCurly-opLower-7] = 0;
1798 if (sscanf(dyc,
"%f",&dy) < 1) {
1801 fError =
"Invalid vertical shift number. Syntax is #lower[(Float_t)dy]{ ... }";
1817 else if (opScale>-1) {
1818 if (opSquareCurly==-1) {
1820 fError =
"Missing scale factor. Syntax is #scale[(Double_t)nb]{ ... }";
1826 strncpy(nb,
text+opScale+7,opSquareCurly-opScale-7);
1827 nb[opSquareCurly-opScale-7] = 0;
1828 if (sscanf(nb,
"%lf",&newSpec.
fSize) < 1) {
1831 fError =
"Invalid scale factor. Syntax is #factor[(Double_t)nb]{ ... }";
1845 Int_t lut[] = {3, 13, 1, 6, 7, 4, 5, 10, 11, 8, 9, 12, 2, 14, 15};
1847 if ((fontId >= 1) && (fontId <= (
Int_t)(
sizeof(lut)/
sizeof(lut[0])))) fontId = lut[fontId-1];
1848 newSpec.
fFont = fontId*10 + newSpec.
fFont%10;
1858 else if (opMbox>-1) {
1871 Int_t lut[] = {13, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 15, 1, 14, 12};
1873 if ((fontId >= 1) && (fontId <= (
Int_t)(
sizeof(lut)/
sizeof(lut[0])))) fontId = lut[fontId-1];
1874 newSpec.
fFont = fontId*10 + newSpec.
fFont%10;
1897 quote1 = quote2 =
kFALSE ;
1899 for (i=0 ; i<leng ; i++) {
1901 case '\'' : quote1 = !quote1 ; break ;
1902 case '"' : quote2 = !quote2 ; break ;
1905 if (
text[i] ==
'@') {
1907 if ( *(
p+1) ==
'{' || *(
p+1) ==
'}' || *(
p+1) ==
'[' || *(
p+1) ==
']') {
1979 for (
Int_t n = 0;
n < npoints; ++
n) {
1981 Double_t my =
gPad->AbsPixeltoY(
Int_t((xx[
n]-xOrigin)*-sinang+(yy[
n]-yOrigin)*cosang+yOrigin));
1986 if (scale_width >= 1.) {
1989 gPad->PaintFillArea(npoints, xx, yy,
"f");
1996 SetLineWidth(lineWidth > prevWidth ? lineWidth : prevWidth);
2002 gPad->PaintPolyLine(npoints, xx, yy);
2026 gPad->PaintLine(xx,yy,xx2,yy2);
2085 x[i] =
gPad->AbsPixeltoX(
Int_t( dx*cosang+dy*sinang +xOrigin));
2086 y[i] =
gPad->AbsPixeltoY(
Int_t(-dx*sinang+dy*cosang +yOrigin));
2118 if (
size<=0 || strlen(text1) <= 0)
return;
2184 t.
ReplaceAll(
"#splitline",
"\\genfrac{}{}{0pt}{}");
2197 gPad->SetBatch(saveb);
2211 if (!
gPad)
return 0;
2213 if( newText.
Length() == 0)
return 0;
2218 std::cout<<
"\n*ERROR<TLatex>: "<<
fError<<std::endl;
2219 std::cout<<
"==> "<<text1<<std::endl;
2228 gPad->PaintText(
x,
y,text1);
2234 if (strstr(text1,
"\\")) {
2267 x =
gPad->XtoAbsPixel(
x);
2268 y =
gPad->YtoAbsPixel(
y);
2287 std::cout<<
"*ERROR<TLatex>: "<<
fError<<std::endl;
2288 std::cout<<
"==> "<<
text<<std::endl;
2294 case 0:
y -=
fs.Under() ;
break;
2296 case 2:
y +=
fs.Height()*0.5-
fs.Under();
y++;
break;
2297 case 3:
y +=
fs.Over() ;
break;
2300 case 2:
x -=
fs.Width()/2 ;
break;
2301 case 3:
x -=
fs.Width() ;
break;
2306 gPad->SetBatch(saveb);
2326 const Char_t *kWord1[] = {
"{}^{",
"{}_{",
"^{",
"_{",
"#scale{",
"#color{",
"#font{",
"#sqrt{",
"#[]{",
"#{}{",
"#||{",
2327 "#bar{",
"#vec{",
"#dot{",
"#hat{",
"#ddot{",
"#acute{",
"#grave{",
"#check{",
"#tilde{",
"#slash{",
"#bf{",
"#it{",
"#mbox{",
2328 "\\scale{",
"\\color{",
"\\font{",
"\\sqrt{",
"\\[]{",
"\\{}{",
"\\||{",
"#(){",
"\\(){",
2329 "\\bar{",
"\\vec{",
"\\dot{",
"\\hat{",
"\\ddot{",
"\\acute{",
"\\grave{",
"\\check{",
"\\bf{",
"\\it{",
"\\mbox{"};
2330 const Char_t *kWord2[] = {
"#scale[",
"#color[",
"#font[",
"#sqrt[",
"#kern[",
"#lower[",
"\\scale[",
"\\color[",
"\\font[",
"\\sqrt[",
"\\kern[",
"\\lower["};
2331 const Char_t *kWord3[] = {
"#frac{",
"\\frac{",
"#splitline{",
"\\splitline{"};
2332 const Char_t *kLeft1[] = {
"#left[",
"\\left[",
"#left{",
"\\left{",
"#left|",
"\\left|",
"#left(",
"\\left("};
2333 const Char_t *kLeft2[] = {
"#[]{",
"#[]{",
"#{}{",
"#{}{",
"#||{",
"#||{",
"#(){",
"#(){"};
2334 const Char_t *kRight[] = {
"#right]",
"\\right]",
"#right}",
"\\right}",
"#right|",
"\\right|",
"#right)",
"\\right)"};
2335 const Int_t lkWord1[] = {4,4,2,2,7,7,6,6,4,4,4,5,5,5,5,6,7,7,7,7,7,4,4,6,7,7,6,6,4,4,4,4,4,5,5,5,5,6,7,7,7,4,4,6};
2336 const Int_t lkWord2[] = {7,7,6,6,6,7,7,7,6,6,6,7} ;
2337 const Int_t lkWord3[] = {6,6,11,11} ;
2338 Int_t nkWord1 = 44, nkWord2 = 12, nkWord3 = 4;
2340 Int_t nLeft1 , nRight , nOfLeft, nOfRight;
2344 nLeft1 = nRight = 8 ;
2345 nOfLeft = nOfRight = 0 ;
2347 Char_t buf[11] ;
for (i=0;i<11;i++) buf[i]=0;
2352 Int_t nOfCurlyBracket, nOfKW1, nOfKW2, nOfKW3, nOfSquareCurly, nOfCurlyCurly ;
2353 Int_t nOfSquareBracket = 0 ;
2365 for (k = 0 ; k < nLeft1 ; k++) {
2366 if (strncmp(buf,kLeft1[k],lLeft1)==0) {
2373 if (opFound) continue ;
2375 for(k=0;k<nRight;k++) {
2376 if (strncmp(buf,kRight[k],lRight)==0) {
2385 if (nOfLeft != nOfRight) {
2386 printf(
" nOfLeft = %d, nOfRight = %d\n",nOfLeft,nOfRight) ;
2388 fError =
"Operators \"#left\" and \"#right\" don't match !" ;
2392 for (k = 0 ; k < nLeft1 ; k++) {
2393 text.ReplaceAll(kLeft1[k],lLeft1,kLeft2[k],lLeft2) ;
2395 for (k = 0 ; k < nRight ; k++) {
2396 text.ReplaceAll(kRight[k],lRight,
"}",1) ;
2400 i = nOfCurlyBracket = nOfKW1 = nOfKW2 = nOfKW3 = nOfSquareCurly = nOfCurlyCurly =0 ;
2403 case '"' : quote1 = !quote1 ; break ;
2404 case '\'': quote2 = !quote2 ; break ;
2411 for(k=0;k<nkWord1;k++) {
2412 if (strncmp(buf,kWord1[k],lkWord1[k])==0) {
2420 if (opFound) continue ;
2422 for(k=0;k<nkWord2;k++) {
2423 if (strncmp(buf,kWord2[k],lkWord2[k])==0) {
2431 if (opFound) continue ;
2433 for(k=0;k<nkWord3;k++) {
2434 if (strncmp(buf,kWord3[k],lkWord3[k])==0) {
2443 if (opFound) continue ;
2444 if (strncmp(buf,
"}{",2) == 0 && opFrac) {
2449 else if (strncmp(buf,
"]{",2) == 0 && nOfSquareBracket) {
2453 nOfSquareBracket-- ;
2455 else if (strncmp(buf,
"@{",2) == 0 || strncmp(buf,
"@}",2) == 0) {
2458 else if (strncmp(buf,
"@[",2) == 0 || strncmp(buf,
"@]",2) == 0) {
2461 else if (
text[i] ==
']' ) {
2462 text.Insert(i,
"@") ;
2466 else if (
text[i] ==
'[' ) {
2467 text.Insert(i,
"@") ;
2471 else if (
text[i] ==
'{' ) {
2472 text.Insert(i,
"@") ;
2476 else if (
text[i] ==
'}' ) {
2477 if ( nOfCurlyBracket) {
2481 text.Insert(i,
"@") ;
2491 if (nOfKW2 != nOfSquareCurly) {
2493 fError =
"Invalid number of \"]{\"" ;
2495 else if (nOfKW3 != nOfCurlyCurly) {
2497 fError =
"Error in syntax of \"#frac\"" ;
2499 else if (nOfCurlyBracket < 0) {
2501 fError =
"Missing \"{\"" ;
2503 else if (nOfCurlyBracket > 0) {
2505 fError =
"Missing \"}\"" ;
2507 else if (nOfSquareBracket < 0) {
2509 fError =
"Missing \"[\"" ;
2511 else if (nOfSquareBracket > 0) {
2513 fError =
"Missing \"]\"" ;
2558 if (!
gPad)
return 0.;
2573 if (!
gPad)
return 0.;
2575 if( newText.
Length() == 0)
return 0;
2585 std::cout<<
"\n*ERROR<TLatex>: "<<
fError<<std::endl;
2586 std::cout<<
"==> "<<
GetTitle()<<std::endl;
2606 if( newText.
Length() == 0)
return;
2617 std::cout<<
"\n*ERROR<TLatex>: "<<
fError<<std::endl;
2618 std::cout<<
"==> "<<
GetTitle()<<std::endl;
2624 Int_t cBoxX[4], cBoxY[4];
2627 ptx =
gPad->UtoPixel(
fX);
2628 pty =
gPad->VtoPixel(
fY);
2638 for (
Int_t i=1; i<4; i++) {
2639 if (cBoxX[i] <
x1)
x1 = cBoxX[i];
2640 if (cBoxX[i] >
x2)
x2 = cBoxX[i];
2641 if (cBoxY[i] <
y1)
y1 = cBoxY[i];
2642 if (cBoxY[i] >
y2)
y2 = cBoxY[i];
2661 if (!
gPad)
return 0.;
2663 if( newText.
Length() == 0)
return 0;
2673 std::cout<<
"\n*ERROR<TLatex>: "<<
fError<<std::endl;
2674 std::cout<<
"==> "<<
GetTitle()<<std::endl;
2693 Error(
"Readfs",
"No data in fTabSize stack");
2725 out<<
" tex = new TLatex("<<
fX<<
","<<
fY<<
","<<quote<<s<<quote<<
");"<<std::endl;
2727 out<<
" tex->SetNDC();"<<std::endl;
2732 out<<
" tex->Draw();"<<std::endl;
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t SetLineWidth
Option_t Option_t SetTextSize
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t np
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h prop
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
Option_t Option_t SetLineColor
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t SetTextFont
Option_t Option_t TPoint TPoint angle
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char DrawLine
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char mx
Option_t Option_t TPoint TPoint const char y1
R__EXTERN TVirtualPS * gVirtualPS
Fill Area Attributes class.
virtual Color_t GetLineColor() const
Return the line color.
virtual Width_t GetLineWidth() const
Return the line width.
virtual void Modify()
Change current line attributes if necessary.
void Copy(TAttLine &attline) const
Copy this line attributes to a new TAttLine.
virtual void SaveLineAttributes(std::ostream &out, const char *name, Int_t coldef=1, Int_t stydef=1, Int_t widdef=1)
Save line attributes as C++ statement(s) on output stream out.
virtual Float_t GetTextSize() const
Return the text size.
virtual void Modify()
Change current text attributes if necessary.
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual Short_t GetTextAlign() const
Return the text alignment.
virtual Font_t GetTextFont() const
Return the text font.
Float_t fTextAngle
Text angle.
virtual Color_t GetTextColor() const
Return the text color.
virtual void SetTextAngle(Float_t tangle=0)
Set the text angle.
virtual Float_t GetTextAngle() const
Return the text angle.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
Font_t fTextFont
Text font.
virtual void SaveTextAttributes(std::ostream &out, const char *name, Int_t alidef=12, Float_t angdef=0, Int_t coldef=1, Int_t fondef=61, Float_t sizdef=1)
Save text attributes as C++ statement(s) on output stream out.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
virtual Float_t GetTextSizePercent(Float_t size)
Return the text in percent of the pad size.
Short_t fTextAlign
Text alignment.
void Copy(TAttText &atttext) const
Copy this text attributes to a new TAttText.
To draw Mathematical Formula.
virtual void SetLimitIndiceSize(Int_t limitFactorSize)
Set limit for text resizing of subscripts and superscripts.
Double_t GetXsize()
Return size of the formula along X in pad coordinates when the text precision is smaller than 3.
Double_t GetHeight() const
Return height of current pad in pixels.
void Copy(TObject &text) const override
Copy this TLatex object to another TLatex.
Double_t fFactorPos
! Relative position of subscripts and superscripts
Int_t fLimitFactorSize
lower bound for subscripts/superscripts size
void DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2, const TextSpec_t &spec)
Draw a line in a Latex formula.
TLatexFormSize Anal1(const TextSpec_t &spec, const Char_t *t, Int_t length)
Analyse function.
void DrawParenthesis(Double_t x1, Double_t y1, Double_t r1, Double_t r2, Double_t phimin, Double_t phimax, const TextSpec_t &spec)
Draw an arc of ellipse in a Latex formula (right or left parenthesis)
virtual void SetIndiceSize(Double_t factorSize)
Set relative size of subscripts and superscripts.
std::vector< TLatexFormSize > fTabSize
! array of values for the different zones
Int_t PaintLatex1(Double_t x, Double_t y, Double_t angle, Double_t size, const char *text)
Drawing function.
Double_t fOriginSize
Font size of the starting font.
Double_t GetYsize()
Return size of the formula along Y in pad coordinates when the text precision is smaller than 3.
TLatexFormSize FirstParse(Double_t angle, Double_t size, const Char_t *text)
First parsing of the analyse sequence.
TLatexFormSize Readfs()
Read fs in fTabSize.
void GetBoundingBox(UInt_t &w, UInt_t &h, Bool_t angle=kFALSE) override
Return text size in pixels.
@ kTextNDC
The text position is in NDC coordinates.
TLatex * DrawLatexNDC(Double_t x, Double_t y, const char *text)
Draw this TLatex with new coordinates in NDC.
void DrawCircle(Double_t x1, Double_t y1, Double_t r, const TextSpec_t &spec)
Draw an arc of ellipse in a Latex formula (right or left parenthesis)
virtual void PaintLatex(Double_t x, Double_t y, Double_t angle, Double_t size, const char *text)
Main drawing function.
TLatex()
Default constructor.
Bool_t fShow
! is true during the second pass (Painting)
~TLatex() override
Destructor.
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save primitive as a C++ statement(s) on output stream out.
TLatex & operator=(const TLatex &)
assignment operator
void DrawPolyLine(Int_t npoints, Double_t *xx, Double_t *yy, const TextSpec_t &spec, Double_t scale_width=0.)
Draw a poly line in a Latex formula Is scale_width parameter >=1, fill area will be drawn Otherwise l...
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.
Double_t fFactorSize
! Relative size of subscripts and superscripts
const Char_t * fError
! error code
Bool_t fItalic
! Currently inside italic operator
void Paint(Option_t *option="") override
Paint.
TLatexFormSize Analyse(Double_t x, Double_t y, const TextSpec_t &spec, const Char_t *t, Int_t length)
Analyse and paint the TLatex formula.
Int_t CheckLatexSyntax(TString &text)
Check if the Latex syntax is correct.
void Savefs(TLatexFormSize *fs)
Save fs values in array fTabSize.
To draw TeX Mathematical Formula.
Double_t GetYsize()
Get Y size.
void GetBoundingBox(UInt_t &w, UInt_t &h, Bool_t angle=kFALSE) override
Get the text width and height.
Double_t GetXsize()
Get X size.
virtual void PaintMathText(Double_t x, Double_t y, Double_t angle, Double_t size, const char *text)
Paint text (used by Paint()).
const char * GetTitle() const override
Returns title of object.
Mother of all ROOT objects.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void AppendPad(Option_t *option="")
Append graphics object to current pad.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
@ kCanDelete
if object in a list can be deleted
TString & ReplaceSpecialCppChars()
Find special characters which are typically used in printf() calls and replace them by appropriate es...
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Base class for several text objects.
Double_t fY
Y position of text (left,center,etc..)
void Copy(TObject &text) const override
Copy this text to text.
TText & operator=(const TText &src)
Assignment operator.
Double_t fX
X position of text (left,center,etc..)
virtual void PaintText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
virtual void GetTextExtent(UInt_t &w, UInt_t &h, const char *text) const
Return text extent for string text.
virtual void GetTextAscentDescent(UInt_t &a, UInt_t &d, const char *text) const
Return text ascent and descent for string text.
virtual void SetNDC(Bool_t isNDC=kTRUE)
Set NDC mode on if isNDC = kTRUE, off otherwise.
virtual void GetControlBox(Int_t x, Int_t y, Double_t theta, Int_t cBoxX[4], Int_t cBoxY[4])
Return the text control box.
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
virtual void Text(Double_t x, Double_t y, const char *string)=0
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Exp(Double_t x)
Returns the base-e exponential function of x, which is e raised to the power x.
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
TLatex helper struct holding the attributes of a piece of text.