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