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