465 latex.TLatex::Copy(*
this);
475 TAttLine::operator=(lt);
517 pad->
AbsPixeltoXY( cos_angle * (
x[
n]-xOrigin) + sin_angle * (
y[
n]-yOrigin) + xOrigin,
518 -sin_angle * (
x[
n]-xOrigin) + cos_angle * (
y[
n]-yOrigin) + yOrigin,
572 const char *tab[] = {
"alpha",
"beta",
"chi",
"delta",
"varepsilon",
"phi",
"gamma",
"eta",
"iota",
"varphi",
"kappa",
"lambda",
573 "mu",
"nu",
"omicron",
"pi",
"theta",
"rho",
"sigma",
"tau",
"upsilon",
"varomega",
"omega",
"xi",
"psi",
"zeta",
574 "Alpha",
"Beta",
"Chi",
"Delta",
"Epsilon",
"Phi",
"Gamma",
"Eta",
"Iota",
"vartheta",
575 "Kappa",
"Lambda",
"Mu",
"Nu",
"Omicron",
"Pi",
"Theta",
"Rho",
"Sigma",
"Tau",
576 "Upsilon",
"varsigma",
"Omega",
"Xi",
"Psi",
"Zeta",
"varUpsilon",
"epsilon"};
578 const char *
tab2[] = {
"leq",
"/",
"infty",
"voidb",
"club",
"diamond",
"heart",
579 "spade",
"leftrightarrow",
"leftarrow",
"uparrow",
"rightarrow",
580 "downarrow",
"circ",
"pm",
"doublequote",
"geq",
"times",
"propto",
581 "partial",
"bullet",
"divide",
"neq",
"equiv",
"approx",
"3dots",
582 "cbar",
"topbar",
"downleftarrow",
"aleph",
"Jgothic",
"Rgothic",
"voidn",
583 "otimes",
"oplus",
"oslash",
"cap",
"cup",
"supset",
"supseteq",
584 "notsubset",
"subset",
"subseteq",
"in",
"notin",
"angle",
"nabla",
585 "oright",
"ocopyright",
"trademark",
"prod",
"surd",
"upoint",
"corner",
"wedge",
586 "vee",
"Leftrightarrow",
"Leftarrow",
"Uparrow",
"Rightarrow",
587 "Downarrow",
"diamond",
"LT",
"void1",
"copyright",
"void3",
"sum",
588 "arctop",
"lbar",
"arcbottom",
"topbar",
"void8",
"bottombar",
"arcbar",
589 "ltbar",
"AA",
"aa",
"void06",
"GT",
"int",
"forall",
"exists",
"textendash",
"textemdash" };
591 const char *
tab3[] = {
"bar",
"vec",
"dot",
"hat",
"ddot",
"acute",
"grave",
"check",
"tilde",
"slash"};
595 Int_t nBlancDeb = 0, nBlancFin = 0, l_nBlancDeb = 0, l_nBlancFin = 0;
597 Int_t min = 0, max = 0;
608 if (nBlancDeb==l_nBlancDeb && nBlancFin==l_nBlancFin) cont =
kFALSE;
611 if (t[nBlancDeb]==
'{' && t[
length-nBlancFin-1]==
'}') {
614 for(i=nBlancDeb;i<
length-nBlancFin;i++) {
615 if (t[i] ==
'{' && !(i>0 && t[i-1] ==
'@')) nBrackets++;
616 if (t[i] ==
'}' && t[i-1]!=
'@') nBrackets--;
617 if (nBrackets==0 && i<
length-nBlancFin-2) {
633 l_nBlancDeb = nBlancDeb;
634 l_nBlancFin = nBlancFin;
639 length -= nBlancFin+nBlancDeb;
641 Error(
"Analyse",
"It seems there is a syntax error in the TLatex string");
651 indiceSize = spec.
fSize;
654 specNewSize.
fSize = indiceSize;
663 Int_t opCurlyCurly = -1;
664 Int_t opSquareCurly = -1;
665 Int_t opCloseCurly = -2;
673 Int_t opSquareBracket = 0 ;
674 Int_t opBigCurly = 0 ;
677 Int_t abovePlace = 0 ;
685 Int_t opBackslash = 0;
686 Int_t opParallel = 0;
687 Int_t opSplitLine = -1;
699 case '\'' : quote1 = !quote1 ; break ;
700 case '"' : quote2 = !quote2 ; break ;
706 if (!(i>0 &&
text[i-1] ==
'@')) nBrackets++;
711 if (!(i>0 &&
text[i-1] ==
'@')) nBrackets--;
713 if (i<
length-1)
if (
text[i+1]==
'{' && opCurlyCurly==-1) opCurlyCurly=i;
715 if (
text[i+1]!=
'{' && !(
text[i+2]==
'{' && (
text[i+1]==
'^' ||
text[i+1]==
'_'))
716 && opCloseCurly==-2) opCloseCurly=i;
719 if (
text[i+1]!=
'{' && opCloseCurly==-2) opCloseCurly=i;
721 else if (opCloseCurly==-2) opCloseCurly=i;
727 if (!(i>0 &&
text[i-1] ==
'@')) nCroch++;
732 if (!(i>0 &&
text[i-1] ==
'@')) nCroch--;
744 strncpy(buf,&
text[i],2);
745 if (strncmp(buf,
"^{",2)==0) {
746 if (opPower==-1 && nBrackets==0 && nCroch==0) opPower=i;
749 strncpy(buf1,&
text[i-4],4);
750 if (strncmp(buf1,
"#int",4)==0) {
752 if (i>4 && opCloseCurly==-2) opCloseCurly=i-5;
754 if (strncmp(buf1,
"#sum",4)==0) {
756 if (i>4 && opCloseCurly==-2) opCloseCurly=i-5;
760 if (strncmp(buf,
"_{",2)==0) {
761 if (opUnder==-1 && nBrackets==0 && nCroch==0) opUnder=i;
764 strncpy(buf2,&
text[i-4],4);
765 if (strncmp(buf2,
"#int",4)==0) {
767 if (i>4 && opCloseCurly==-2) opCloseCurly=i-5;
769 if (strncmp(buf2,
"#sum",4)==0) {
771 if (i>4 && opCloseCurly==-2) opCloseCurly=i-5;
775 if (strncmp(buf,
"]{",2)==0)
776 if (opSquareCurly==-1 && nBrackets==0 && nCroch==0) opSquareCurly=i;
779 if (
text[i]==
'\\' || (
text[i]==
'#' && !opFound && nBrackets==0 && nCroch==0)) {
783 strncpy(buf,&
text[i+1],10);
784 if (strncmp(buf,
"splitline{",10)==0) {
785 opSplitLine=i; opFound =
kTRUE;
786 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
792 strncpy(buf,&
text[i+1],9);
793 if (!opBackslash && strncmp(buf,
"backslash",9)==0) {
794 opBackslash=1; opFound =
kTRUE;
795 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
801 strncpy(buf,&
text[i+1],8);
802 if (!opParallel && strncmp(buf,
"parallel",8)==0) {
803 opParallel=1; opFound =
kTRUE;
804 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
810 strncpy(buf,&
text[i+1],6);
811 if (strncmp(buf,
"lower[",6)==0 || strncmp(buf,
"lower{",6)==0) {
812 opLower=i; opFound =
kTRUE;
813 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
816 if (strncmp(buf,
"scale[",6)==0 || strncmp(buf,
"scale{",6)==0) {
817 opScale=i; opFound =
kTRUE;
818 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
821 if (strncmp(buf,
"color[",6)==0 || strncmp(buf,
"color{",6)==0) {
822 opColor=i; opFound =
kTRUE;
823 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
829 strncpy(buf,&
text[i+1],5);
830 if (strncmp(buf,
"frac{",5)==0) {
831 opFrac=i; opFound =
kTRUE;
832 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
835 if (strncmp(buf,
"sqrt{",5)==0 || strncmp(buf,
"sqrt[",5)==0) {
836 opSqrt=i; opFound =
kTRUE;
837 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
840 if (strncmp(buf,
"font{",5)==0 || strncmp(buf,
"font[",5)==0) {
841 opFont=i; opFound =
kTRUE;
842 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
845 if (strncmp(buf,
"kern[",5)==0 || strncmp(buf,
"kern{",5)==0) {
846 opKern=i; opFound =
kTRUE;
847 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
850 if (!opMinus && strncmp(buf,
"minus",5)==0) {
851 opMinus=1; opFound =
kTRUE;
852 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
855 if (strncmp(buf,
"mbox[",5)==0 || strncmp(buf,
"mbox{",5)==0) {
856 opMbox=i; opFound =
kTRUE;
857 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
863 strncpy(buf,&
text[i+1],4);
864 if (!opOdot && strncmp(buf,
"odot",4)==0) {
865 opOdot=1; opFound =
kTRUE;
866 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
869 if (!opHbar && strncmp(buf,
"hbar",4)==0) {
870 opHbar=1; opFound =
kTRUE;
871 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
874 if (!opPerp && strncmp(buf,
"perp",4)==0) {
875 opPerp=1; opFound =
kTRUE;
876 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
879 if (!opPlus && strncmp(buf,
"plus",4)==0) {
880 opPlus=1; opFound =
kTRUE;
881 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
884 if (strncmp(buf,
"url[",4)==0 || strncmp(buf,
"url{",4)==0) {
885 opUrl=i; opFound =
kTRUE;
886 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
892 strncpy(buf,&
text[i+1],3);
894 if (strncmp(buf,
"[]{",3)==0) {
895 opSquareBracket=1; opFound =
kTRUE;
896 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
899 if (strncmp(buf,
"{}{",3)==0 ) {
900 opBigCurly=1; opFound =
kTRUE;
901 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
904 if (strncmp(buf,
"||{",3)==0) {
905 opAbs=1; opFound =
kTRUE;
906 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
909 if (strncmp(buf,
"(){",3)==0) {
910 opParen=1; opFound =
kTRUE;
911 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
914 if (!opBox && strncmp(buf,
"Box",3)==0) {
915 opBox=1; opFound =
kTRUE;
916 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
919 if (strncmp(buf,
"bf[",3)==0 || strncmp(buf,
"bf{",3)==0) {
920 opBf=i; opFound =
kTRUE;
921 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
924 if (strncmp(buf,
"it[",3)==0 || strncmp(buf,
"it{",3)==0) {
925 opIt=i; opFound =
kTRUE;
926 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
932 strncpy(buf,&
text[i+1],2);
933 if (!opMp && strncmp(buf,
"mp",2)==0) {
934 opMp=1; opFound =
kTRUE;
935 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
941 if (strncmp(&
text[i+1],tab[k],strlen(tab[k]))==0) {
944 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
953 if (i>0 && opCloseCurly==-2) opCloseCurly=i-1;
958 constexpr Int_t lenTab2 =
sizeof(
tab2) /
sizeof(
const char *);
960 for (k = 0; k < lenTab2; k++) {
962 if (strncmp(&
text[i + 1],
tab2[k], strlen(
tab2[k])) == 0) {
963 lastsize = strlen(
tab2[k]);
966 if (i > 0 && opCloseCurly == -2)
967 opCloseCurly = i - 1;
981 if (opCloseCurly>-1 && opCloseCurly<
length-1) {
994 else if (opPower>-1 && opUnder>-1) {
996 max = std::max(opPower,opUnder);
999 switch (abovePlace) {
1001 prop = .8 ; propU = 1.75 ;
1004 prop = .9 ; propU = 1.75 ;
1013 if (min >= 2 && strncmp(&
text[min-2],
"{}",2)==0) {
1020 fs2 =
Anal1(specNewSize,
text+min+1,max-min-1);
1032 if (opPower<opUnder) {
1042 Double_t addW1, addW2, addH1, addH2;
1045 if (opPower<opUnder) {
1047 addW1 = (
m-fs2.
Width())/2;
1049 addW2 = (
m-fs3.
Width())/2;
1052 addW1 = (
m-fs2.
Width())/2;
1054 addW2 = (
m-fs3.
Width())/2;
1061 if (min >= 2 && strncmp(&
text[min-2],
"{}",2)==0) {
1070 if (opPower<opUnder) {
1080 if (opPower<opUnder) {
1089 else if (opPower>-1) {
1092 switch (abovePlace) {
1094 prop = 1.75 ; break ;
1096 prop = 1.75; break ;
1100 Int_t ltext = opPower ;
1101 if (ltext >= 2 && strncmp(&
text[ltext-2],
"{}",2)==0) {
1117 if (over <= 0) over = 1.5*fs2.
Over();
1128 if (opPower >= 2 && strncmp(&
text[opPower-2],
"{}",2)==0) {
1143 else if (opUnder>-1) {
1149 Int_t ltext = opUnder ;
1150 if (ltext >= 2 && strncmp(&
text[ltext-2],
"{}",2)==0) {
1175 if (opUnder >= 2 && strncmp(&
text[opUnder-2],
"{}",2)==0) {
1309 else if (opBackslash) {
1327 else if (opParallel) {
1342 else if (opGreek>-1) {
1345 char letter = 97 + opGreek;
1347 if (opGreek>25) letter -= 58;
1348 if (opGreek == 52) letter =
'\241';
1349 if (opGreek == 53) letter =
'\316';
1351 fs1 =
Anal1(newSpec,&letter,1);
1352 fs2 =
Anal1(spec,
text+strlen(tab[opGreek])+1,
length-strlen(tab[opGreek])-1);
1363 else if (opSpec > -1) {
1366 char letter =
'\243' + opSpec;
1367 if(opSpec == 75 || opSpec == 76) {
1369 if (
gPad->GetPainter()->IsCocoa()) {
1370 if (opSpec == 75) letter =
'\201';
1371 else if (opSpec == 76) letter =
'\214';
1373 if (opSpec == 75) letter =
'\305';
1374 else if (opSpec == 76) letter =
'\345';
1379 else if (opSpec == 81)
1381 else if (opSpec == 82)
1383 else if (opSpec == 83)
1392 }
else if (opSpec==79) {
1396 fs1 =
Anal1(newSpec,&letter,1);
1397 if (opSpec == 79 || opSpec == 66)
1405 if (opSpec!=66 && opSpec!=79)
1413 else if (opAbove>-1) {
1424 xx[0] =
x; xx[1] =
x + fs1.
Width();
1425 yy[0] = yy[1] =
y - sub - fs1.
Over();
1432 midy =
y - sub - fs1.
Over() - dd;
1433 xx[0] =
x; xx[1] =
x + fs1.
Width();
1434 yy[0] = yy[1] = midy;
1436 xx[1] =
x + fs1.
Width(); xx[0] = xx[2] = xx[1] - 2*dd;
1437 yy[0] = midy - dd; yy[1] = midy; yy[2] = midy + dd;
1443 midx =
x + fs1.
Width()/2,
1444 midy =
y - sub - fs1.
Over() - dd;
1445 Double_t xx[5] = { midx - dd, midx - dd, midx + dd, midx + dd, midx - dd },
1446 yy[5] = { midy + dd, midy - dd, midy - dd, midy + dd, midy + dd };
1452 xx[1] =
x + fs1.
Width()/2;
1453 xx[0] = xx[1] - fs1.
Width()/3;
1454 xx[2] = xx[1] + fs1.
Width()/3;
1455 yy[0] =
y - sub - fs1.
Over();
1456 yy[1] = yy[0] - 2*sub;
1463 midx =
x + fs1.
Width()/2 - 1.5*sub,
1464 midy =
y - sub - fs1.
Over() - dd;
1465 Double_t xx1[5] = { midx - dd, midx - dd, midx + dd, midx + dd, midx - dd },
1466 yy1[5] = { midy + dd, midy - dd, midy - dd, midy + dd, midy + dd };
1468 midx =
x + fs1.
Width()/2 + 1.5*sub;
1469 Double_t xx2[5] = { midx - dd, midx - dd, midx + dd, midx + dd, midx - dd },
1470 yy2[5] = { midy + dd, midy - dd, midy - dd, midy + dd, midy + dd };
1476 xx[0] =
x + fs1.
Width()/2; xx[1] = xx[0] + 3*sub;
1477 yy[0] =
y - sub - fs1.
Over();
1478 yy[1] = yy[0] - 2.5*sub;
1484 xx[0] =
x + fs1.
Width()/2 + sub; xx[1] = xx[0] - 2*sub;
1485 yy[0] =
y - sub - fs1.
Over();
1486 yy[1] = yy[0] - 2*sub;
1492 xx[1] =
x+fs1.
Width()/2; xx[0] = xx[1] - 2*sub; xx[2] = xx[1] + 2*sub;
1493 yy[1] =
y - sub - fs1.
Over();
1494 yy[0] = yy[2] = yy[1] - 2*sub;
1504 if (
auto ps =
gPad->GetPainter()->GetPS()) {
1505 if (!strstr(ps->GetTitle(),
"IMG"))
1508 ps->SetTextAlign(22);
1509 ps->Text(xx, yy,
"~");
1511 if (
gPad->GetPainter()->IsCocoa())
1527 xx[0] =
x + 0.8*fs1.
Width();
1528 yy[0] =
y - fs1.
Over() - sub;
1529 xx[1] =
x + 0.3*fs1.
Width();
1530 yy[1] = yy[0] + fs1.
Height() + 2*sub;
1537 if (opAbove==1) div=4;
1540 else if (opSquareBracket) {
1560 Double_t radius2,radius1 , dw, l2 =
l/2 ;
1566 radius1 = radius2 * 2 / 3;
1571 radius1 = radius2 * 2 / 3;
1597 else if (opBigCurly) {
1639 else if (opFrac>-1) {
1640 if (opCurlyCurly==-1) {
1642 fError =
"Missing denominator for #frac";
1648 fs1 =
Anal1(spec,
text+opFrac+6,opCurlyCurly-opFrac-6);
1672 else if (opSplitLine>-1) {
1673 if (opCurlyCurly==-1) {
1675 fError =
"Missing second line for #splitline";
1681 fs1 =
Anal1(spec,
text+opSplitLine+11,opCurlyCurly-opSplitLine-11);
1695 else if (opSqrt>-1) {
1697 if (opSquareCurly>-1) {
1699 fs1 =
Anal1(specNewSize,
text+opSqrt+6,opSquareCurly-opSqrt-6);
1711 if (opSquareCurly>-1) {
1748 else if (opColor>-1) {
1749 if (opSquareCurly==-1) {
1751 fError =
"Missing color number. Syntax is #color[(Int_t)nb]{ ... }";
1757 strncpy(nb,
text+opColor+7,opSquareCurly-opColor-7);
1758 nb[opSquareCurly-opColor-7] = 0;
1759 if (sscanf(nb,
"%d",&newSpec.
fColor) < 1) {
1762 fError =
"Invalid color number. Syntax is #color[(Int_t)nb]{ ... }";
1773 else if (opUrl>-1) {
1774 if (opSquareCurly==-1) {
1776 fError =
"Missing url. Syntax is #url[http://...]{ ... }";
1782 strncpy(url,
text+opUrl+5,opSquareCurly-opUrl-5);
1792 else if (opFont>-1) {
1793 if (opSquareCurly==-1) {
1795 fError =
"Missing font number. Syntax is #font[nb]{ ... }";
1801 strncpy(nb,
text+opFont+6,opSquareCurly-opFont-6);
1802 nb[opSquareCurly-opFont-6] = 0;
1803 if (sscanf(nb,
"%d",&newSpec.
fFont) < 1) {
1806 fError =
"Invalid font number. Syntax is #font[(Int_t)nb]{ ... }";
1817 else if (opKern>-1) {
1818 if (opSquareCurly==-1) {
1820 fError =
"Missing horizontal shift number. Syntax is #kern[dx]{ ... }";
1825 strncpy(dxc,
text+opKern+6,opSquareCurly-opKern-6);
1826 dxc[opSquareCurly-opKern-6] = 0;
1828 if (sscanf(dxc,
"%f",&dx) < 1) {
1831 fError =
"Invalid horizontal shift number. Syntax is #kern[(Float_t)dx]{ ... }";
1847 else if (opLower>-1) {
1848 if (opSquareCurly==-1) {
1850 fError =
"Missing vertical shift number. Syntax is #lower[dy]{ ... }";
1855 strncpy(dyc,
text+opLower+7,opSquareCurly-opLower-7);
1856 dyc[opSquareCurly-opLower-7] = 0;
1858 if (sscanf(dyc,
"%f",&dy) < 1) {
1861 fError =
"Invalid vertical shift number. Syntax is #lower[(Float_t)dy]{ ... }";
1877 else if (opScale>-1) {
1878 if (opSquareCurly==-1) {
1880 fError =
"Missing scale factor. Syntax is #scale[(Double_t)nb]{ ... }";
1886 strncpy(nb,
text+opScale+7,opSquareCurly-opScale-7);
1887 nb[opSquareCurly-opScale-7] = 0;
1888 if (sscanf(nb,
"%lf",&newSpec.
fSize) < 1) {
1891 fError =
"Invalid scale factor. Syntax is #factor[(Double_t)nb]{ ... }";
1905 Int_t lut[] = {3, 13, 1, 6, 7, 4, 5, 10, 11, 8, 9, 12, 2, 14, 15};
1907 if ((fontId >= 1) && (fontId <= (
Int_t)(
sizeof(lut)/
sizeof(lut[0])))) fontId = lut[fontId-1];
1908 newSpec.
fFont = fontId*10 + newSpec.
fFont%10;
1918 else if (opMbox>-1) {
1931 Int_t lut[] = {13, 3, 2, 5, 4, 7, 6, 9, 8, 11, 10, 15, 1, 14, 12};
1933 if ((fontId >= 1) && (fontId <= (
Int_t)(
sizeof(lut)/
sizeof(lut[0])))) fontId = lut[fontId-1];
1934 newSpec.
fFont = fontId*10 + newSpec.
fFont%10;
1957 quote1 = quote2 =
kFALSE ;
1959 for (i=0 ; i<leng ; i++) {
1961 case '\'' : quote1 = !quote1 ; break ;
1962 case '"' : quote2 = !quote2 ; break ;
1965 if (
text[i] ==
'@') {
1967 if ( *(p+1) ==
'{' || *(p+1) ==
'}' || *(p+1) ==
'[' || *(p+1) ==
']') {
1982 else gPad->PaintText(xx, yy,
text);
2037 if (scale_width >= 1.) {
2040 gPad->PaintFillArea(npoints, xx, yy,
"f");
2047 SetLineWidth(lineWidth > prevWidth ? lineWidth : prevWidth);
2053 gPad->PaintPolyLine(npoints, xx, yy);
2070 gPad->PaintLine(xx[0], yy[0], xx[1], yy[1]);
2090 for (
Int_t i = 0; i <=
np; i++) {
2120 for (
Int_t i = 0; i <=
np; i++) {
2158 if (
size<=0 || strlen(text1) <= 0)
return;
2162 auto ps =
gPad->GetPainter()->GetPS();
2164 if (ps && ps->InheritsFrom(
"TTeXDump")) {
2222 t.
ReplaceAll(
"#splitline",
"\\genfrac{}{}{0pt}{}");
2227 ps->SetTextAngle(
angle);
2228 ps->Text(
x,
y, t.
Data());
2242 if(newText.
Length() == 0)
2248 Error(
"PaintLatex1",
"%s\n==> %s",
fError, text1);
2255 gPad->GetPainter()->SetTextAngle(
angle);
2256 gPad->PaintText(
x,
y, text1);
2261 if (strstr(text1,
"\\")) {
2262 auto ps =
gPad->GetPainter()->GetPS();
2264 if (ps && (ps->InheritsFrom(
"TPDF") || ps->InheritsFrom(
"TSVG"))) {
2315 case 0:
y -=
fs.Under();
break;
2317 case 2:
y +=
fs.Height()*0.5-
fs.Under() + 1.;
break;
2318 case 3:
y +=
fs.Over();
break;
2321 case 2:
x -=
fs.Width()/2;
break;
2322 case 3:
x -=
fs.Width();
break;
2345 const Char_t *kWord1[] = {
"{}^{",
"{}_{",
"^{",
"_{",
"#scale{",
"#color{",
"#url{",
"#font{",
"#sqrt{",
"#[]{",
"#{}{",
"#||{",
2346 "#bar{",
"#vec{",
"#dot{",
"#hat{",
"#ddot{",
"#acute{",
"#grave{",
"#check{",
"#tilde{",
"#slash{",
"#bf{",
"#it{",
"#mbox{",
2347 "\\scale{",
"\\color{",
"\\font{",
"\\sqrt{",
"\\[]{",
"\\{}{",
"\\||{",
"#(){",
"\\(){",
2348 "\\bar{",
"\\vec{",
"\\dot{",
"\\hat{",
"\\ddot{",
"\\acute{",
"\\grave{",
"\\check{",
"\\bf{",
"\\it{",
"\\mbox{"};
2349 const Char_t *kWord2[] = {
"#scale[",
"#color[",
"#url[",
"#font[",
"#sqrt[",
"#kern[",
"#lower[",
"\\scale[",
"\\color[",
"\\font[",
"\\sqrt[",
"\\kern[",
"\\lower["};
2350 const Char_t *kWord3[] = {
"#frac{",
"\\frac{",
"#splitline{",
"\\splitline{"};
2351 const Char_t *kLeft1[] = {
"#left[",
"\\left[",
"#left{",
"\\left{",
"#left|",
"\\left|",
"#left(",
"\\left("};
2352 const Char_t *kLeft2[] = {
"#[]{",
"#[]{",
"#{}{",
"#{}{",
"#||{",
"#||{",
"#(){",
"#(){"};
2353 const Char_t *kRight[] = {
"#right]",
"\\right]",
"#right}",
"\\right}",
"#right|",
"\\right|",
"#right)",
"\\right)"};
2354 const Int_t lkWord1[] = {4,4,2,2,7,7,5,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};
2355 const Int_t lkWord2[] = {7,7,5,6,6,6,7,7,7,6,6,6,7} ;
2356 const Int_t lkWord3[] = {6,6,11,11} ;
2357 Int_t nkWord1 = 45, nkWord2 = 13, nkWord3 = 4;
2359 Int_t nLeft1 , nRight , nOfLeft, nOfRight;
2363 nLeft1 = nRight = 8 ;
2364 nOfLeft = nOfRight = 0 ;
2366 Char_t buf[11] ;
for (i=0;i<11;i++) buf[i]=0;
2371 Int_t nOfCurlyBracket, nOfKW1, nOfKW2, nOfKW3, nOfSquareCurly, nOfCurlyCurly ;
2372 Int_t nOfSquareBracket = 0 ;
2384 for (k = 0 ; k < nLeft1 ; k++) {
2385 if (strncmp(buf,kLeft1[k],lLeft1)==0) {
2392 if (opFound) continue ;
2394 for(k=0;k<nRight;k++) {
2395 if (strncmp(buf,kRight[k],lRight)==0) {
2404 if (nOfLeft != nOfRight) {
2405 printf(
" nOfLeft = %d, nOfRight = %d\n",nOfLeft,nOfRight) ;
2407 fError =
"Operators \"#left\" and \"#right\" don't match !" ;
2411 for (k = 0 ; k < nLeft1 ; k++) {
2412 text.ReplaceAll(kLeft1[k],lLeft1,kLeft2[k],lLeft2) ;
2414 for (k = 0 ; k < nRight ; k++) {
2415 text.ReplaceAll(kRight[k],lRight,
"}",1) ;
2419 i = nOfCurlyBracket = nOfKW1 = nOfKW2 = nOfKW3 = nOfSquareCurly = nOfCurlyCurly =0 ;
2422 case '"' : quote1 = !quote1 ; break ;
2423 case '\'': quote2 = !quote2 ; break ;
2430 for(k=0;k<nkWord1;k++) {
2431 if (strncmp(buf,kWord1[k],lkWord1[k])==0) {
2439 if (opFound) continue ;
2441 for(k=0;k<nkWord2;k++) {
2442 if (strncmp(buf,kWord2[k],lkWord2[k])==0) {
2450 if (opFound) continue ;
2452 for(k=0;k<nkWord3;k++) {
2453 if (strncmp(buf,kWord3[k],lkWord3[k])==0) {
2462 if (opFound) continue ;
2463 if (strncmp(buf,
"}{",2) == 0 && opFrac) {
2468 else if (strncmp(buf,
"]{",2) == 0 && nOfSquareBracket) {
2472 nOfSquareBracket-- ;
2474 else if (strncmp(buf,
"@{",2) == 0 || strncmp(buf,
"@}",2) == 0) {
2477 else if (strncmp(buf,
"@[",2) == 0 || strncmp(buf,
"@]",2) == 0) {
2480 else if (
text[i] ==
']' ) {
2481 text.Insert(i,
"@") ;
2485 else if (
text[i] ==
'[' ) {
2486 text.Insert(i,
"@") ;
2490 else if (
text[i] ==
'{' ) {
2491 text.Insert(i,
"@") ;
2495 else if (
text[i] ==
'}' ) {
2496 if ( nOfCurlyBracket) {
2500 text.Insert(i,
"@") ;
2510 if (nOfKW2 != nOfSquareCurly) {
2512 fError =
"Invalid number of \"]{\"" ;
2514 else if (nOfKW3 != nOfCurlyCurly) {
2516 fError =
"Error in syntax of \"#frac\"" ;
2518 else if (nOfCurlyBracket < 0) {
2520 fError =
"Missing \"{\"" ;
2522 else if (nOfCurlyBracket > 0) {
2524 fError =
"Missing \"}\"" ;
2526 else if (nOfSquareBracket < 0) {
2528 fError =
"Missing \"[\"" ;
2530 else if (nOfSquareBracket > 0) {
2532 fError =
"Missing \"]\"" ;
2577 if (!
gPad)
return 0.;
2592 if (!
gPad)
return 0.;
2594 if( newText.
Length() == 0)
return 0;
2614 return std::abs(
gPad->AbsPixeltoX(
fs.Width()) -
gPad->AbsPixeltoX(0));
2624 if( newText.
Length() == 0)
return;
2641 Int_t cBoxX[4], cBoxY[4];
2644 ptx =
gPad->UtoPixel(
fX);
2645 pty =
gPad->VtoPixel(
fY);
2655 for (
Int_t i=1; i<4; i++) {
2656 if (cBoxX[i] <
x1)
x1 = cBoxX[i];
2657 if (cBoxX[i] >
x2)
x2 = cBoxX[i];
2658 if (cBoxY[i] <
y1)
y1 = cBoxY[i];
2659 if (cBoxY[i] >
y2)
y2 = cBoxY[i];
2678 if (!
gPad)
return 0.;
2680 if( newText.
Length() == 0)
return 0;
2700 return std::abs(
gPad->AbsPixeltoY(
fs.Height()) -
gPad->AbsPixeltoY(0));
2709 Error(
"Readfs",
"No data in fTabSize stack");
2732 out,
Class(),
"tex",
2739 out <<
" tex->SetNDC();\n";
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Boolean (0=false, 1=true) (bool)
int Int_t
Signed integer 4 bytes (int)
char Char_t
Character 1 byte (char)
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
float Float_t
Float 4 bytes (float)
short Short_t
Signed Short integer 2 bytes (short)
double Double_t
Double 8 bytes.
const char Option_t
Option string (const char)
return
Invalidate stored TCling state for declarations included in transaction âTâ.
Option_t Option_t SetLineWidth
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void w
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 y1
Fill Area Attributes class.
virtual Color_t GetLineColor() const
Return the line color.
virtual Width_t GetLineWidth() const
Return the line width.
TAttLine()
AttLine default constructor.
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.
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.
void Rotate(TVirtualPad *pad, Double_t angle, Int_t np, Double_t *x, Double_t *y)
Rotate array of points around fX, fY coordinate by specified angle.
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.
@ kTextNDC
The text position is in NDC coordinates.
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.
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.
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 void Error(const char *method, const char *msgfmt,...) const
Issue error message.
static void SavePrimitiveDraw(std::ostream &out, const char *variable_name, Option_t *option=nullptr)
Save invocation of primitive Draw() method Skipped if option contains "nodraw" string.
TObject()
TObject constructor.
static void SavePrimitiveConstructor(std::ostream &out, TClass *cl, const char *variable_name, const char *constructor_agrs="", Bool_t empty_line=kTRUE)
Save object constructor in the output stream "out".
@ kCanDelete
if object in a list can be deleted
const char * Data() const
TString & ReplaceAll(const TString &s1, const TString &s2)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
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.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
virtual void AbsPixeltoXY(Double_t xpixel, Double_t ypixel, Double_t &x, Double_t &y)=0
virtual void XYtoAbsPixel(Double_t x, Double_t y, Int_t &xpixel, Int_t &ypixel) const =0
Int_t Nint(T x)
Round to nearest integer. Rounds half integers to the nearest even integer.
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.
TLatex helper struct holding the attributes of a piece of text.