Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TTeXDump.cxx
Go to the documentation of this file.
1// @(#)root/postscript:$Id$
2// Author: Olivier Couet
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifdef WIN32
13#pragma optimize("",off)
14#endif
15
16#include <cstdlib>
17#include <cstring>
18#include <cctype>
19#include <fstream>
20
21#include "TROOT.h"
22#include "TColor.h"
23#include "TVirtualPad.h"
24#include "TPoints.h"
25#include "TTeXDump.h"
26#include "TStyle.h"
27#include "TMath.h"
28
29
30/** \class TTeXDump
31\ingroup PS
32
33\brief Interface to TeX.
34
35This class allow to generate <b>PGF/TikZ</b> vector graphics output
36which can be included in TeX and LaTeX documents.
37
38PGF is a TeX macro package for generating graphics. It is platform
39and format-independent and works together with the most important TeX
40backend drivers, including pdftex and dvips. It comes with a
41user-friendly syntax layer called TikZ.
42
43To generate a such file it is enough to do:
44~~~ {.cpp}
45 gStyle->SetPaperSize(10.,10.);
46 hpx->Draw();
47 gPad->Print("hpx.tex");
48~~~
49
50Then, the generated file (`hpx.tex`) can be included in a
51LaTeX document (`simple.tex`) in the following way:
52~~~ {.cpp}
53\documentclass{article}
54\usepackage{tikz}
55\usetikzlibrary{patterns}
56\usetikzlibrary{plotmarks}
57\title{A simple LaTeX example}
58\date{July 2013}
59\begin{document}
60\maketitle
61The following image as been generated using the TTeXDump class:
62\par
63\input{hpx.tex}
64\end{document}
65~~~
66
67Note the three directives needed at the top of the LaTeX file:
68~~~ {.cpp}
69\usepackage{tikz}
70\usetikzlibrary{patterns}
71\usetikzlibrary{plotmarks}
72~~~
73
74Then including the picture in the document is done with the
75`\input` directive.
76
77 The command `pdflatex simple.tex` will generate the
78corresponding pdf file `simple.pdf`.
79*/
80
81////////////////////////////////////////////////////////////////////////////////
82/// Default TeX constructor
83
85{
86 fStream = nullptr;
87 fType = 0;
88 gVirtualPS = this;
90 fRange = kFALSE;
91 fXsize = 0.;
92 fYsize = 0.;
93 fCurrentRed = -1.;
94 fCurrentGreen = -1.;
95 fCurrentBlue = -1.;
96 fCurrentAlpha = 1.;
97 fLineScale = 0.;
98}
99
100////////////////////////////////////////////////////////////////////////////////
101/// Initialize the TeX interface
102///
103/// --fname : TeX file name
104/// - wtype : TeX workstation type. Not used in the TeX driver. But as TTeXDump
105/// inherits from TVirtualPS it should be kept. Anyway it is not
106/// necessary to specify this parameter at creation time because it
107/// has a default value (which is ignore in the TeX case).
108
110{
111 fStream = nullptr;
112 fType = 0;
113 gVirtualPS = this;
115 fRange = kFALSE;
116 fXsize = 0.;
117 fYsize = 0.;
118 fCurrentRed = -1.;
119 fCurrentGreen = -1.;
120 fCurrentBlue = -1.;
121 fCurrentAlpha = 1.;
122 fLineScale = 0.;
123
124 Open(fname, wtype);
125}
126
127////////////////////////////////////////////////////////////////////////////////
128/// Open a TeX file
129
130void TTeXDump::Open(const char *fname, Int_t wtype)
131{
132 if (fStream) {
133 Warning("Open", "TeX file already open");
134 return;
135 }
136
138 fLenBuffer = 0;
139 fType = abs(wtype);
140
142
144 if (gPad) {
145 Double_t ww = gPad->GetWw();
146 Double_t wh = gPad->GetWh();
147 ww *= gPad->GetWNDC();
148 wh *= gPad->GetHNDC();
149 Double_t ratio = wh/ww;
150 xrange = fXsize;
151 yrange = fXsize*ratio;
152 if (yrange > fYsize) { yrange = fYsize; xrange = yrange/ratio;}
154 }
155
156 // Open OS file
157 fStream = new std::ofstream(fname,std::ios::out);
158 if (!fStream || !fStream->good()) {
159 printf("ERROR in TTeXDump::Open: Cannot open file:%s\n",fname);
160 if (!fStream) return;
161 }
162
163 gVirtualPS = this;
164
165 for (Int_t i=0;i<fSizBuffer;i++) fBuffer[i] = ' ';
166
168 fRange = kFALSE;
170
171 // Set a default range
173
174 if (strstr(GetTitle(),"Standalone")) fStandalone = kTRUE;
175 if (fStandalone) {
176 PrintStr("\\documentclass{standalone}@");
177 PrintStr("\\usepackage{tikz}@");
178 PrintStr("\\usetikzlibrary{patterns,plotmarks}@");
179 PrintStr("\\begin{document}@");
180 } else {
181 PrintStr("%\\documentclass{standalone}@");
182 PrintStr("%\\usepackage{tikz}@");
183 PrintStr("%\\usetikzlibrary{patterns,plotmarks}@");
184 PrintStr("%\\begin{document}@");
185 }
186
187 NewPage();
188}
189
190////////////////////////////////////////////////////////////////////////////////
191/// Default TeX destructor
192
194{
195 Close();
196}
197
198////////////////////////////////////////////////////////////////////////////////
199/// Close a TeX file
200
202{
203 if (!gVirtualPS) return;
204 if (!fStream) return;
205 if (gPad) gPad->Update();
206 PrintStr("@");
207 PrintStr("\\end{tikzpicture}@");
208 if (fStandalone) {
209 PrintStr("\\end{document}@");
210 } else {
211 PrintStr("%\\end{document}@");
212 }
213
214 // Close file stream
215 if (fStream) { fStream->close(); delete fStream; fStream = nullptr;}
216
217 gVirtualPS = nullptr;
218}
219
220////////////////////////////////////////////////////////////////////////////////
221/// Activate an already open TeX file
222
224{
225 // fType is used to know if the TeX file is open. Unlike TPostScript, TTeXDump
226 // has no "workstation type". In fact there is only one TeX type.
227
228 if (!fType) {
229 Error("On", "no TeX file open");
230 Off();
231 return;
232 }
233 gVirtualPS = this;
234}
235
236////////////////////////////////////////////////////////////////////////////////
237/// Deactivate an already open TeX file
238
240{
241 gVirtualPS = nullptr;
242}
243
244////////////////////////////////////////////////////////////////////////////////
245/// Draw a Box
246
248{
249 Float_t x1c = XtoTeX(x1);
250 Float_t y1c = YtoTeX(y1);
251 Float_t x2c = XtoTeX(x2);
252 Float_t y2c = YtoTeX(y2);
253
254 Int_t fillis = fFillStyle/1000;
255 Int_t fillsi = fFillStyle%1000;
256
257 if (fillis==1) {
259 PrintStr("@");
260 if (fCurrentAlpha != 1.) {
261 PrintStr("\\fill [c");
262 PrintStr(", fill opacity=");
264 }
265 else {
266 PrintStr("\\draw [color=c, fill=c");
267 }
268 PrintStr("] (");
270 PrintFast(1,",");
272 PrintStr(") rectangle (");
274 PrintFast(1,",");
276 PrintStr(");");
277 }
278 if (fillis>1 && fillis<4) {
280 PrintStr("@");
281 PrintStr("\\draw [pattern=");
282 switch (fillsi) {
283 case 1 :
284 PrintStr("crosshatch dots");
285 break;
286 case 2 :
287 case 3 :
288 PrintStr("dots");
289 break;
290 case 4 :
291 PrintStr("north east lines");
292 break;
293 case 5 :
294 PrintStr("north west lines");
295 break;
296 case 6 :
297 PrintStr("vertical lines");
298 break;
299 case 7 :
300 PrintStr("horizontal lines");
301 break;
302 case 10 :
303 PrintStr("bricks");
304 break;
305 case 13 :
306 PrintStr("crosshatch");
307 break;
308 }
309 PrintStr(", draw=none, pattern color=c");
310 if (fCurrentAlpha != 1.) {
311 PrintStr(", fill opacity=");
313 }
314 PrintStr("] (");
316 PrintFast(1,",");
318 PrintStr(") rectangle (");
320 PrintFast(1,",");
322 PrintStr(");");
323 }
324 if (fillis == 0) {
325 if (fLineWidth<=0) return;
327 PrintStr("@");
328 PrintStr("\\draw [c");
329 PrintStr(",line width=");
331 if (fCurrentAlpha != 1.) {
332 PrintStr(", opacity=");
334 }
335 PrintStr("] (");
337 PrintFast(1,",");
339 PrintStr(") -- (");
341 PrintFast(1,",");
343 PrintStr(") -- (");
345 PrintFast(1,",");
347 PrintStr(") -- (");
349 PrintFast(1,",");
351 PrintStr(") -- (");
353 PrintFast(1,",");
355 PrintStr(");");
356 }
357}
358
359////////////////////////////////////////////////////////////////////////////////
360/// Draw a Frame around a box
361///
362/// mode = -1 the box looks as it is behind the screen
363/// mode = 1 the box looks as it is in front of the screen
364/// border is the border size in already pre-computed TeX units dark is the
365/// color for the dark part of the frame light is the color for the light
366/// part of the frame
367
370{
371 Warning("DrawFrame", "not yet implemented");
372}
373
374////////////////////////////////////////////////////////////////////////////////
375/// Draw a PolyLine
376///
377/// Draw a polyline through the points xy.
378/// - If NN=1 moves only to point x,y.
379/// - If NN=0 the x,y are written in the TeX file
380/// according to the current transformation.
381/// - If NN>0 the line is clipped as a line.
382/// - If NN<0 the line is clipped as a fill area.
383
385{
386 Warning("DrawPolyLine", "not yet implemented");
387}
388
389////////////////////////////////////////////////////////////////////////////////
390/// Draw a PolyLine in NDC space
391///
392/// Draw a polyline through the points xy.
393/// - If NN=1 moves only to point x,y.
394/// - If NN=0 the x,y are written in the TeX file
395/// according to the current transformation.
396/// - If NN>0 the line is clipped as a line.
397/// - If NN<0 the line is clipped as a fill area.
398
400{
401 Warning("DrawPolyLineNDC", "not yet implemented");
402}
403
404////////////////////////////////////////////////////////////////////////////////
405/// Paint PolyMarker
406
408{
409 Warning("DrawPolyMarker", "not yet implemented");
410}
411
412////////////////////////////////////////////////////////////////////////////////
413/// Paint PolyMarker
414
416{
417 Float_t x, y;
418
420
421 PrintStr("@");
422 PrintStr("\\foreach \\P in {");
423
424 x = XtoTeX(xw[0]);
425 y = YtoTeX(yw[0]);
426
427 PrintStr("(");
429 PrintFast(1,",");
431 PrintStr(")");
432
433 for (Int_t i=1;i<n;i++) {
434 x = XtoTeX(xw[i]);
435 y = YtoTeX(yw[i]);
436 PrintFast(3,", (");
438 PrintFast(1,",");
440 PrintFast(1,")");
441 }
442
443 PrintStr("}{\\draw[mark options={color=c,fill=c");
444
445 if (fCurrentAlpha != 1.) {
446 PrintStr(",opacity=");
448 }
449
451
454 PrintStr(", mark=");
456 case 1 :
457 PrintStr("*");
458 PrintStr(",mark size=1pt");
459 break;
460 case 2 :
461 PrintStr("+");
462 break;
463 case 3 :
464 PrintStr("asterisk");
465 break;
466 case 4 :
467 PrintStr("o");
468 break;
469 case 5 :
470 PrintStr("x");
471 break;
472 case 20 :
473 PrintStr("*");
474 break;
475 case 21 :
476 PrintStr("square*");
477 break;
478 case 22 :
479 PrintStr("triangle*");
480 break;
481 case 23 :
482 PrintStr("triangle*");
483 break;
484 case 24 :
485 PrintStr("o");
486 break;
487 case 25 :
488 PrintStr("square");
489 break;
490 case 26 :
491 PrintStr("triangle");
492 break;
493 case 27 :
494 PrintStr("diamond");
495 break;
496 case 28 :
497 PrintStr("cross");
498 break;
499 case 29 :
500 PrintStr("newstar*");
501 break;
502 case 30 :
503 PrintStr("newstar");
504 break;
505 case 31 :
506 PrintStr("10-pointed star");
507 break;
508 case 32 :
509 PrintStr("triangle");
510 break;
511 case 33 :
512 PrintStr("diamond*");
513 break;
514 case 34 :
515 PrintStr("cross*");
516 break;
517 }
518 PrintStr("] plot coordinates {\\P};}");
519}
520
521////////////////////////////////////////////////////////////////////////////////
522/// This function defines a path with xw and yw and draw it according the
523/// value of nn:
524///
525/// - If nn>0 a line is drawn.
526/// - If nn<0 a closed polygon is drawn.
527
529{
530 Int_t n = TMath::Abs(nn);
531 Float_t x, y;
532
533 if( n <= 1) {
534 Error("DrawPS", "Two points are needed");
535 return;
536 }
537
538 x = XtoTeX(xw[0]);
539 y = YtoTeX(yw[0]);
540
541 Int_t fillis = fFillStyle/1000;
542 Int_t fillsi = fFillStyle%1000;
543
544 if (nn>0) {
545 if (fLineWidth<=0) return;
547 PrintStr("@");
548 PrintStr("\\draw [c");
552 if (stripped.Length()) {
553 tikzSpec.Append(",dash pattern=");
554 Ssiz_t i{0}, j{0};
555 bool on{true}, iterate{true};
556
557 while (iterate){
558 j = stripped.Index(" ", 1, i, TString::kExact);
559 if (j == kNPOS){
560 iterate = false;
561 j = stripped.Length();
562 }
563
564 if (on) {
565 tikzSpec.Append("on ");
566 on = false;
567 } else {
568 tikzSpec.Append("off ");
569 on = true;
570 }
571 int num = TString{stripped(i, j - i)}.Atoi();
572 float pt = 0.2*num;
573 tikzSpec.Append(TString::Format("%.2fpt ", pt));
574 i = j + 1;
575 }
576 PrintStr(tikzSpec.Data());
577 }
578 PrintStr(",line width=");
580 if (fCurrentAlpha != 1.) {
581 PrintStr(",opacity=");
583 }
584 } else {
586 if (fillis==1) {
587 PrintStr("@");
588 PrintStr("\\draw [c, fill=c");
589 } else if (fillis==0) {
590 PrintStr("@");
591 PrintStr("\\draw [c");
592 } else {
593 PrintStr("\\draw [pattern=");
594 switch (fillsi) {
595 case 1 :
596 PrintStr("crosshatch dots");
597 break;
598 case 2 :
599 case 3 :
600 PrintStr("dots");
601 break;
602 case 4 :
603 PrintStr("north east lines");
604 break;
605 case 5 :
606 PrintStr("north west lines");
607 break;
608 case 6 :
609 PrintStr("vertical lines");
610 break;
611 case 7 :
612 PrintStr("horizontal lines");
613 break;
614 case 10 :
615 PrintStr("bricks");
616 break;
617 case 13 :
618 PrintStr("crosshatch");
619 break;
620 }
621 PrintStr(", draw=none, pattern color=c");
622 }
623 if (fCurrentAlpha != 1.) {
624 PrintStr(", fill opacity=");
626 }
627 }
628 PrintStr("] (");
630 PrintFast(1,",");
632 PrintStr(") -- ");
633
634 for (Int_t i=1;i<n;i++) {
635 x = XtoTeX(xw[i]);
636 y = YtoTeX(yw[i]);
637 PrintFast(1,"(");
639 PrintFast(1,",");
641 PrintFast(1,")");
642 if (i<n-1) PrintStr(" -- ");
643 else PrintStr(";@");
644 }
645}
646
647////////////////////////////////////////////////////////////////////////////////
648/// Start the TeX page. This function starts the tikzpicture environment
649
651{
652 // Compute pad conversion coefficients
653 if (gPad) {
654 Double_t ww = gPad->GetWw();
655 Double_t wh = gPad->GetWh();
656 fYsize = fXsize*wh/ww;
657 } else {
658 fYsize = 27;
659 }
660
661 if(!fBoundingBox) {
662 PrintStr("\\begin{tikzpicture}@");
663 PrintStr("\\def\\CheckTikzLibraryLoaded#1{ \\ifcsname tikz@library@#1@loaded\\endcsname \\else \\PackageWarning{tikz}{usetikzlibrary{#1} is missing in the preamble.} \\fi }@");
664 PrintStr("\\CheckTikzLibraryLoaded{patterns}@");
665 PrintStr("\\CheckTikzLibraryLoaded{plotmarks}@");
668 }
669}
670
671////////////////////////////////////////////////////////////////////////////////
672/// Set the range for the paper in centimetres
673
675{
676 fXsize = xsize;
677 fYsize = ysize;
678
679 fRange = kTRUE;
680}
681
682////////////////////////////////////////////////////////////////////////////////
683/// Set color index for fill areas
684
689
690////////////////////////////////////////////////////////////////////////////////
691/// Set color index for lines
692
697
698////////////////////////////////////////////////////////////////////////////////
699/// Change the line style
700///
701/// - linestyle = 2 dashed
702/// - linestyle = 3 dotted
703/// - linestyle = 4 dash-dotted
704/// - linestyle = else solid (1 in is used most of the time)
705
710
711////////////////////////////////////////////////////////////////////////////////
712/// Set the lines width.
713
718
719////////////////////////////////////////////////////////////////////////////////
720/// Set size for markers.
721
726
727////////////////////////////////////////////////////////////////////////////////
728/// Set color index for markers.
729
734
735////////////////////////////////////////////////////////////////////////////////
736/// Set color with its color index
737
739{
740 if (color < 0) color = 0;
741 TColor *col = gROOT->GetColor(color);
742
743 if (col) {
744 SetColor(col->GetRed(), col->GetGreen(), col->GetBlue());
745 fCurrentAlpha = col->GetAlpha();
746 } else {
747 SetColor(1., 1., 1.);
748 fCurrentAlpha = 1.;
749 }
750}
751
752////////////////////////////////////////////////////////////////////////////////
753/// Set color with its R G B components
754///
755/// - r: % of red in [0,1]
756/// - g: % of green in [0,1]
757/// - b: % of blue in [0,1]
758
760{
761 if (fCurrentRed == r && fCurrentGreen == g && fCurrentBlue == b) return;
762
763 fCurrentRed = r;
765 fCurrentBlue = b;
766 PrintStr("@");
767 PrintStr("\\definecolor{c}{rgb}{");
769 PrintFast(1,",");
771 PrintFast(1,",");
773 PrintFast(2,"};");
774}
775
776////////////////////////////////////////////////////////////////////////////////
777/// Set color index for text
778
783
784////////////////////////////////////////////////////////////////////////////////
785/// Draw text
786///
787/// - xx: x position of the text
788/// - yy: y position of the text
789/// - chars: text to be drawn
790
792{
793 Double_t wh = (Double_t)gPad->XtoPixel(gPad->GetX2());
794 Double_t hh = (Double_t)gPad->YtoPixel(gPad->GetY1());
796 if (wh < hh) {
798 Int_t sizeTTF = (Int_t)(tsize+0.5);
799 ftsize = (sizeTTF*fXsize*gPad->GetAbsWNDC())/wh;
800 } else {
802 Int_t sizeTTF = (Int_t)(tsize+0.5);
803 ftsize = (sizeTTF*fYsize*gPad->GetAbsHNDC())/hh;
804 }
805 ftsize *= 2.22097;
806 if (ftsize <= 0) return;
807
808 TString t(chars);
809 if (t.Index("\\")>=0 || t.Index("^{")>=0 || t.Index("_{")>=0) {
810 t.Prepend("$");
811 t.Append("$");
812 } else {
813 t.ReplaceAll("<","$<$");
814 t.ReplaceAll(">","$>$");
815 t.ReplaceAll("_","\\_");
816 }
817 t.ReplaceAll("&","\\&");
818 t.ReplaceAll("#","\\#");
819 t.ReplaceAll("%","\\%");
820
822 if (txalh <1) txalh = 1; else if (txalh > 3) txalh = 3;
824 if (txalv <1) txalv = 1; else if (txalv > 3) txalv = 3;
826 PrintStr("@");
827 PrintStr("\\draw");
828 if (txalh!=2 || txalv!=2) {
829 PrintStr(" [anchor=");
830 if (txalv==1) PrintStr("base");
831 if (txalv==3) PrintStr("north");
832 if (txalh==1) PrintStr(" west");
833 if (txalh==3) PrintStr(" east");
834 PrintFast(1,"]");
835 }
836 PrintFast(2," (");
838 PrintFast(1,",");
840 PrintStr(") node[scale=");
842 PrintStr(", color=c");
843 if (fCurrentAlpha != 1.) {
844 PrintStr(",opacity=");
846 }
847 PrintStr(", rotate=");
849 PrintFast(2,"]{");
850 PrintStr(t.Data());
851 PrintFast(2,"};");
852}
853
854////////////////////////////////////////////////////////////////////////////////
855/// Write a string of characters in NDC
856
858{
859 Double_t x = gPad->GetX1() + u*(gPad->GetX2() - gPad->GetX1());
860 Double_t y = gPad->GetY1() + v*(gPad->GetY2() - gPad->GetY1());
861 Text(x, y, chars);
862}
863
864////////////////////////////////////////////////////////////////////////////////
865/// Convert U from NDC coordinate to TeX
866
868{
869 Double_t cm = fXsize*(gPad->GetAbsXlowNDC() + u*gPad->GetAbsWNDC());
870 return cm;
871}
872
873////////////////////////////////////////////////////////////////////////////////
874/// Convert V from NDC coordinate to TeX
875
877{
878 Double_t cm = fYsize*(gPad->GetAbsYlowNDC() + v*gPad->GetAbsHNDC());
879 return cm;
880}
881
882////////////////////////////////////////////////////////////////////////////////
883/// Convert X from world coordinate to TeX
884
886{
887 Double_t u = (x - gPad->GetX1())/(gPad->GetX2() - gPad->GetX1());
888 return UtoTeX(u);
889}
890
891////////////////////////////////////////////////////////////////////////////////
892/// Convert Y from world coordinate to TeX
893
895{
896 Double_t v = (y - gPad->GetY1())/(gPad->GetY2() - gPad->GetY1());
897 return VtoTeX(v);
898}
899
900////////////////////////////////////////////////////////////////////////////////
901/// Begin the Cell Array painting
902
904 Double_t)
905{
906 Warning("CellArrayBegin", "not yet implemented");
907}
908
909////////////////////////////////////////////////////////////////////////////////
910/// Paint the Cell Array
911
913{
914 Warning("CellArrayFill", "not yet implemented");
915}
916
917////////////////////////////////////////////////////////////////////////////////
918/// End the Cell Array painting
919
921{
922 Warning("CellArrayEnd", "not yet implemented");
923}
924
925////////////////////////////////////////////////////////////////////////////////
926/// Not needed in TeX case
927
929{
930 Warning("DrawPS", "not yet implemented");
931}
932
933////////////////////////////////////////////////////////////////////////////////
934/// add additional pgfplotmarks
935
937{
938 // open cross
939 PrintStr("\\pgfdeclareplotmark{cross} {@");
940 PrintStr("\\pgfpathmoveto{\\pgfpoint{-0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
941 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
942 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
943 PrintStr("\\pgfpathlineto{\\pgfpoint{+1\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
944 PrintStr("\\pgfpathlineto{\\pgfpoint{+1\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
945 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
946 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
947 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
948 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
949 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
950 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
951 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
952 PrintStr("\\pgfpathclose@");
953 PrintStr("\\pgfusepathqstroke@");
954 PrintStr("}@");
955
956 // filled cross
957 PrintStr("\\pgfdeclareplotmark{cross*} {@");
958 PrintStr("\\pgfpathmoveto{\\pgfpoint{-0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
959 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
960 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
961 PrintStr("\\pgfpathlineto{\\pgfpoint{+1\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
962 PrintStr("\\pgfpathlineto{\\pgfpoint{+1\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
963 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
964 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
965 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
966 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
967 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
968 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
969 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
970 PrintStr("\\pgfpathclose@");
971 PrintStr("\\pgfusepathqfillstroke@");
972 PrintStr("}@");
973
974 // open star
975 PrintStr("\\pgfdeclareplotmark{newstar} {@");
976 PrintStr("\\pgfpathmoveto{\\pgfqpoint{0pt}{\\pgfplotmarksize}}@");
977 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{44}{0.5\\pgfplotmarksize}}@");
978 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{18}{\\pgfplotmarksize}}@");
979 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-20}{0.5\\pgfplotmarksize}}@");
980 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-54}{\\pgfplotmarksize}}@");
981 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-90}{0.5\\pgfplotmarksize}}@");
982 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{234}{\\pgfplotmarksize}}@");
983 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{198}{0.5\\pgfplotmarksize}}@");
984 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{162}{\\pgfplotmarksize}}@");
985 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{134}{0.5\\pgfplotmarksize}}@");
986 PrintStr("\\pgfpathclose@");
987 PrintStr("\\pgfusepathqstroke@");
988 PrintStr("}@");
989
990 // filled star
991 PrintStr("\\pgfdeclareplotmark{newstar*} {@");
992 PrintStr("\\pgfpathmoveto{\\pgfqpoint{0pt}{\\pgfplotmarksize}}@");
993 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{44}{0.5\\pgfplotmarksize}}@");
994 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{18}{\\pgfplotmarksize}}@");
995 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-20}{0.5\\pgfplotmarksize}}@");
996 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-54}{\\pgfplotmarksize}}@");
997 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-90}{0.5\\pgfplotmarksize}}@");
998 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{234}{\\pgfplotmarksize}}@");
999 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{198}{0.5\\pgfplotmarksize}}@");
1000 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{162}{\\pgfplotmarksize}}@");
1001 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{134}{0.5\\pgfplotmarksize}}@");
1002 PrintStr("\\pgfpathclose@");
1003 PrintStr("\\pgfusepathqfillstroke@");
1004 PrintStr("}@");
1005}
#define b(i)
Definition RSha256.hxx:100
#define g(i)
Definition RSha256.hxx:105
short Style_t
Style number (short)
Definition RtypesCore.h:96
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
short Color_t
Color number (short)
Definition RtypesCore.h:99
float Size_t
Attribute size (float)
Definition RtypesCore.h:103
short Width_t
Line width (short)
Definition RtypesCore.h:98
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
Definition RtypesCore.h:131
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t cindex
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 on
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
#define gROOT
Definition TROOT.h:411
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
R__EXTERN TVirtualPS * gVirtualPS
Definition TVirtualPS.h:81
#define gPad
Style_t fFillStyle
Fill area style.
Definition TAttFill.h:24
Color_t fFillColor
Fill area color.
Definition TAttFill.h:23
Width_t fLineWidth
Line width.
Definition TAttLine.h:25
Style_t fLineStyle
Line style.
Definition TAttLine.h:24
Color_t fLineColor
Line color.
Definition TAttLine.h:23
Color_t fMarkerColor
Marker color.
Definition TAttMarker.h:23
static Width_t GetMarkerLineWidth(Style_t style)
Internal helper function that returns the line width of the given marker style (0 = filled marker)
Size_t fMarkerSize
Marker size.
Definition TAttMarker.h:25
Style_t fMarkerStyle
Marker style.
Definition TAttMarker.h:24
static Style_t GetMarkerStyleBase(Style_t style)
Internal helper function that returns the corresponding marker style with line width 1 for the given ...
Color_t fTextColor
Text color.
Definition TAttText.h:26
Float_t fTextAngle
Text angle.
Definition TAttText.h:23
Short_t fTextAlign
Text alignment.
Definition TAttText.h:25
Float_t fTextSize
Text size.
Definition TAttText.h:24
The color creation and management class.
Definition TColor.h:22
Float_t GetRed() const
Definition TColor.h:61
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1926
Float_t GetAlpha() const
Definition TColor.h:67
Float_t GetBlue() const
Definition TColor.h:63
Float_t GetGreen() const
Definition TColor.h:62
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1057
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1071
2-D graphics point (world coordinates).
Definition TPoints.h:19
Basic string class.
Definition TString.h:138
Int_t Atoi() const
Return integer value of string.
Definition TString.cxx:1994
const char * Data() const
Definition TString.h:384
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:712
@ kBoth
Definition TString.h:284
@ kExact
Definition TString.h:285
TString & Prepend(const char *cs)
Definition TString.h:681
TString & Append(const char *cs)
Definition TString.h:580
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2384
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:659
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
Definition TStyle.cxx:1167
void GetPaperSize(Float_t &xsize, Float_t &ysize) const
Set paper size for PostScript output.
Definition TStyle.cxx:1184
Float_t GetLineScalePS() const
Definition TStyle.h:291
void CellArrayFill(Int_t r, Int_t g, Int_t b) override
Paint the Cell Array.
Definition TTeXDump.cxx:912
void SetLineStyle(Style_t linestyle=1) override
Change the line style.
Definition TTeXDump.cxx:706
void SetLineScale(Float_t scale=1)
Definition TTeXDump.h:67
void DrawPS(Int_t n, Float_t *xw, Float_t *yw) override
Not needed in TeX case.
Definition TTeXDump.cxx:928
void Close(Option_t *opt="") override
Close a TeX file.
Definition TTeXDump.cxx:201
void DrawPolyLineNDC(Int_t n, TPoints *uv)
Draw a PolyLine in NDC space.
Definition TTeXDump.cxx:399
void On()
Activate an already open TeX file.
Definition TTeXDump.cxx:223
void Open(const char *filename, Int_t type=-111) override
Open a TeX file.
Definition TTeXDump.cxx:130
Bool_t fStandalone
True when a TeX file should be standalone.
Definition TTeXDump.h:28
void DefineMarkers()
add additional pgfplotmarks
Definition TTeXDump.cxx:936
Bool_t fBoundingBox
True when the TeX header is printed.
Definition TTeXDump.h:26
Float_t fCurrentRed
Current Red component.
Definition TTeXDump.h:29
Float_t fXsize
Page size along X.
Definition TTeXDump.h:23
void SetLineWidth(Width_t linewidth=1) override
Set the lines width.
Definition TTeXDump.cxx:714
Float_t VtoTeX(Double_t v)
Convert V from NDC coordinate to TeX.
Definition TTeXDump.cxx:876
void NewPage() override
Start the TeX page. This function starts the tikzpicture environment.
Definition TTeXDump.cxx:650
Bool_t fRange
True when a range has been defined.
Definition TTeXDump.h:27
void SetFillColor(Color_t cindex=1) override
Set color index for fill areas.
Definition TTeXDump.cxx:685
~TTeXDump() override
Default TeX destructor.
Definition TTeXDump.cxx:193
void DrawFrame(Double_t xl, Double_t yl, Double_t xt, Double_t yt, Int_t mode, Int_t border, Int_t dark, Int_t light) override
Draw a Frame around a box.
Definition TTeXDump.cxx:368
void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y) override
Paint PolyMarker.
Definition TTeXDump.cxx:407
void Range(Float_t xrange, Float_t yrange)
Set the range for the paper in centimetres.
Definition TTeXDump.cxx:674
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Draw a Box.
Definition TTeXDump.cxx:247
void CellArrayBegin(Int_t W, Int_t H, Double_t x1, Double_t x2, Double_t y1, Double_t y2) override
Begin the Cell Array painting.
Definition TTeXDump.cxx:903
void SetTextColor(Color_t cindex=1) override
Set color index for text.
Definition TTeXDump.cxx:779
void SetLineColor(Color_t cindex=1) override
Set color index for lines.
Definition TTeXDump.cxx:693
Float_t fCurrentAlpha
Current Alpha value.
Definition TTeXDump.h:32
void CellArrayEnd() override
End the Cell Array painting.
Definition TTeXDump.cxx:920
Float_t fLineScale
Line width scale factor.
Definition TTeXDump.h:33
void TextNDC(Double_t u, Double_t v, const char *string)
Write a string of characters in NDC.
Definition TTeXDump.cxx:857
Int_t fType
Workstation type used to know if the Tex is open.
Definition TTeXDump.h:25
Float_t UtoTeX(Double_t u)
Convert U from NDC coordinate to TeX.
Definition TTeXDump.cxx:867
Float_t YtoTeX(Double_t y)
Convert Y from world coordinate to TeX.
Definition TTeXDump.cxx:894
void DrawPolyLine(Int_t n, TPoints *xy)
Draw a PolyLine.
Definition TTeXDump.cxx:384
void Off()
Deactivate an already open TeX file.
Definition TTeXDump.cxx:239
TTeXDump()
Default TeX constructor.
Definition TTeXDump.cxx:84
Float_t fCurrentGreen
Current Green component.
Definition TTeXDump.h:30
Float_t fYsize
Page size along Y.
Definition TTeXDump.h:24
void Text(Double_t x, Double_t y, const char *string) override
Draw text.
Definition TTeXDump.cxx:791
void SetMarkerSize(Size_t msize=1) override
Set size for markers.
Definition TTeXDump.cxx:722
void SetColor(Int_t color=1)
Set color with its color index.
Definition TTeXDump.cxx:738
Float_t fCurrentBlue
Current Blue component.
Definition TTeXDump.h:31
Float_t XtoTeX(Double_t x)
Convert X from world coordinate to TeX.
Definition TTeXDump.cxx:885
void SetMarkerColor(Color_t cindex=1) override
Set color index for markers.
Definition TTeXDump.cxx:730
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
Definition TVirtualPS.h:30
Int_t fSizBuffer
Definition TVirtualPS.h:39
Int_t fLenBuffer
Definition TVirtualPS.h:38
virtual void PrintStr(const char *string="")
Output the string str in the output buffer.
virtual void PrintFast(Int_t nch, const char *string="")
Fast version of Print.
std::ofstream * fStream
Definition TVirtualPS.h:41
char * fBuffer
Definition TVirtualPS.h:42
virtual void WriteReal(Float_t r, Bool_t space=kTRUE)
Write a Real number to the file.
TPaveText * pt
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
int iterate(rng_state_t *X)
Definition mixmax.icc:34
Double_t Floor(Double_t x)
Rounds x downward, returning the largest integral value that is not greater than x.
Definition TMath.h:691
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:124