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 = nullptr;
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
111{
112 fStream = nullptr;
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
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;}
155 }
156
157 // Open OS file
158 fStream = new std::ofstream(fname,std::ios::out);
159 if (!fStream || !fStream->good()) {
160 printf("ERROR in TTeXDump::Open: Cannot open file:%s\n",fname);
161 if (!fStream) return;
162 }
163
164 gVirtualPS = this;
165
166 for (Int_t i=0;i<fSizBuffer;i++) fBuffer[i] = ' ';
167
169 fRange = kFALSE;
171
172 // Set a default range
174
175 if (strstr(GetTitle(),"Standalone")) fStandalone = kTRUE;
176 if (fStandalone) {
177 PrintStr("\\documentclass{standalone}@");
178 PrintStr("\\usepackage{tikz}@");
179 PrintStr("\\usetikzlibrary{patterns,plotmarks}@");
180 PrintStr("\\begin{document}@");
181 } else {
182 PrintStr("%\\documentclass{standalone}@");
183 PrintStr("%\\usepackage{tikz}@");
184 PrintStr("%\\usetikzlibrary{patterns,plotmarks}@");
185 PrintStr("%\\begin{document}@");
186 }
187
188 NewPage();
189}
190
191////////////////////////////////////////////////////////////////////////////////
192/// Default TeX destructor
193
195{
196 Close();
197}
198
199////////////////////////////////////////////////////////////////////////////////
200/// Close a TeX file
201
203{
204 if (!gVirtualPS) return;
205 if (!fStream) return;
206 if (gPad) gPad->Update();
207 PrintStr("@");
208 PrintStr("\\end{tikzpicture}@");
209 if (fStandalone) {
210 PrintStr("\\end{document}@");
211 } else {
212 PrintStr("%\\end{document}@");
213 }
214
215 // Close file stream
216 if (fStream) { fStream->close(); delete fStream; fStream = nullptr;}
217
218 gVirtualPS = nullptr;
219}
220
221////////////////////////////////////////////////////////////////////////////////
222/// Activate an already open TeX file
223
225{
226 // fType is used to know if the TeX file is open. Unlike TPostScript, TTeXDump
227 // has no "workstation type". In fact there is only one TeX type.
228
229 if (!fType) {
230 Error("On", "no TeX file open");
231 Off();
232 return;
233 }
234 gVirtualPS = this;
235}
236
237////////////////////////////////////////////////////////////////////////////////
238/// Deactivate an already open TeX file
239
241{
242 gVirtualPS = nullptr;
243}
244
245////////////////////////////////////////////////////////////////////////////////
246/// Draw a Box
247
249{
250 Float_t x1c = XtoTeX(x1);
251 Float_t y1c = YtoTeX(y1);
252 Float_t x2c = XtoTeX(x2);
253 Float_t y2c = YtoTeX(y2);
254
255 Int_t fillis = fFillStyle/1000;
256 Int_t fillsi = fFillStyle%1000;
257
258 if (fillis==1) {
260 PrintStr("@");
261 if (fCurrentAlpha != 1.) {
262 PrintStr("\\fill [c");
263 PrintStr(", fill opacity=");
265 }
266 else {
267 PrintStr("\\draw [color=c, fill=c");
268 }
269 PrintStr("] (");
271 PrintFast(1,",");
273 PrintStr(") rectangle (");
275 PrintFast(1,",");
277 PrintStr(");");
278 }
279 if (fillis>1 && fillis<4) {
281 PrintStr("@");
282 PrintStr("\\draw [pattern=");
283 switch (fillsi) {
284 case 1 :
285 PrintStr("crosshatch dots");
286 break;
287 case 2 :
288 case 3 :
289 PrintStr("dots");
290 break;
291 case 4 :
292 PrintStr("north east lines");
293 break;
294 case 5 :
295 PrintStr("north west lines");
296 break;
297 case 6 :
298 PrintStr("vertical lines");
299 break;
300 case 7 :
301 PrintStr("horizontal lines");
302 break;
303 case 10 :
304 PrintStr("bricks");
305 break;
306 case 13 :
307 PrintStr("crosshatch");
308 break;
309 }
310 PrintStr(", draw=none, pattern color=c");
311 if (fCurrentAlpha != 1.) {
312 PrintStr(", fill opacity=");
314 }
315 PrintStr("] (");
317 PrintFast(1,",");
319 PrintStr(") rectangle (");
321 PrintFast(1,",");
323 PrintStr(");");
324 }
325 if (fillis == 0) {
326 if (fLineWidth<=0) return;
328 PrintStr("@");
329 PrintStr("\\draw [c");
330 PrintStr(",line width=");
332 if (fCurrentAlpha != 1.) {
333 PrintStr(", opacity=");
335 }
336 PrintStr("] (");
338 PrintFast(1,",");
340 PrintStr(") -- (");
342 PrintFast(1,",");
344 PrintStr(") -- (");
346 PrintFast(1,",");
348 PrintStr(") -- (");
350 PrintFast(1,",");
352 PrintStr(") -- (");
354 PrintFast(1,",");
356 PrintStr(");");
357 }
358}
359
360////////////////////////////////////////////////////////////////////////////////
361/// Draw a Frame around a box
362///
363/// mode = -1 the box looks as it is behind the screen
364/// mode = 1 the box looks as it is in front of the screen
365/// border is the border size in already pre-computed TeX units dark is the
366/// color for the dark part of the frame light is the color for the light
367/// part of the frame
368
371{
372 Warning("DrawFrame", "not yet implemented");
373}
374
375////////////////////////////////////////////////////////////////////////////////
376/// Draw a PolyLine
377///
378/// Draw a polyline through the points xy.
379/// - If NN=1 moves only to point x,y.
380/// - If NN=0 the x,y are written in the TeX file
381/// according to the current transformation.
382/// - If NN>0 the line is clipped as a line.
383/// - If NN<0 the line is clipped as a fill area.
384
386{
387 Warning("DrawPolyLine", "not yet implemented");
388}
389
390////////////////////////////////////////////////////////////////////////////////
391/// Draw a PolyLine in NDC space
392///
393/// Draw a polyline through the points xy.
394/// - If NN=1 moves only to point x,y.
395/// - If NN=0 the x,y are written in the TeX file
396/// according to the current transformation.
397/// - If NN>0 the line is clipped as a line.
398/// - If NN<0 the line is clipped as a fill area.
399
401{
402 Warning("DrawPolyLineNDC", "not yet implemented");
403}
404
405////////////////////////////////////////////////////////////////////////////////
406/// Paint PolyMarker
407
409{
410 Warning("DrawPolyMarker", "not yet implemented");
411}
412
413////////////////////////////////////////////////////////////////////////////////
414/// Paint PolyMarker
415
417{
418 Float_t x, y;
419
421
422 PrintStr("@");
423 PrintStr("\\foreach \\P in {");
424
425 x = XtoTeX(xw[0]);
426 y = YtoTeX(yw[0]);
427
428 PrintStr("(");
430 PrintFast(1,",");
432 PrintStr(")");
433
434 for (Int_t i=1;i<n;i++) {
435 x = XtoTeX(xw[i]);
436 y = YtoTeX(yw[i]);
437 PrintFast(3,", (");
439 PrintFast(1,",");
441 PrintFast(1,")");
442 }
443
444 PrintStr("}{\\draw[mark options={color=c,fill=c");
445
446 if (fCurrentAlpha != 1.) {
447 PrintStr(",opacity=");
449 }
450
452
455 PrintStr(", mark=");
457 case 1 :
458 PrintStr("*");
459 PrintStr(",mark size=1pt");
460 break;
461 case 2 :
462 PrintStr("+");
463 break;
464 case 3 :
465 PrintStr("asterisk");
466 break;
467 case 4 :
468 PrintStr("o");
469 break;
470 case 5 :
471 PrintStr("x");
472 break;
473 case 20 :
474 PrintStr("*");
475 break;
476 case 21 :
477 PrintStr("square*");
478 break;
479 case 22 :
480 PrintStr("triangle*");
481 break;
482 case 23 :
483 PrintStr("triangle*");
484 break;
485 case 24 :
486 PrintStr("o");
487 break;
488 case 25 :
489 PrintStr("square");
490 break;
491 case 26 :
492 PrintStr("triangle");
493 break;
494 case 27 :
495 PrintStr("diamond");
496 break;
497 case 28 :
498 PrintStr("cross");
499 break;
500 case 29 :
501 PrintStr("newstar*");
502 break;
503 case 30 :
504 PrintStr("newstar");
505 break;
506 case 31 :
507 PrintStr("10-pointed star");
508 break;
509 case 32 :
510 PrintStr("triangle");
511 break;
512 case 33 :
513 PrintStr("diamond*");
514 break;
515 case 34 :
516 PrintStr("cross*");
517 break;
518 }
519 PrintStr("] plot coordinates {\\P};}");
520}
521
522////////////////////////////////////////////////////////////////////////////////
523/// This function defines a path with xw and yw and draw it according the
524/// value of nn:
525///
526/// - If nn>0 a line is drawn.
527/// - If nn<0 a closed polygon is drawn.
528
530{
531 Int_t n = TMath::Abs(nn);
532 Float_t x, y;
533
534 if( n <= 1) {
535 Error("DrawPS", "Two points are needed");
536 return;
537 }
538
539 x = XtoTeX(xw[0]);
540 y = YtoTeX(yw[0]);
541
542 Int_t fillis = fFillStyle/1000;
543 Int_t fillsi = fFillStyle%1000;
544
545 if (nn>0) {
546 if (fLineWidth<=0) return;
548 PrintStr("@");
549 PrintStr("\\draw [c");
553 if (stripped.Length()) {
554 tikzSpec.Append(",dash pattern=");
555 Ssiz_t i{0}, j{0};
556 bool on{true}, iterate{true};
557
558 while (iterate){
559 j = stripped.Index(" ", 1, i, TString::kExact);
560 if (j == kNPOS){
561 iterate = false;
562 j = stripped.Length();
563 }
564
565 if (on) {
566 tikzSpec.Append("on ");
567 on = false;
568 } else {
569 tikzSpec.Append("off ");
570 on = true;
571 }
572 int num = TString{stripped(i, j - i)}.Atoi();
573 float pt = 0.2*num;
574 tikzSpec.Append(TString::Format("%.2fpt ", pt));
575 i = j + 1;
576 }
577 PrintStr(tikzSpec.Data());
578 }
579 PrintStr(",line width=");
581 if (fCurrentAlpha != 1.) {
582 PrintStr(",opacity=");
584 }
585 } else {
587 if (fillis==1) {
588 PrintStr("@");
589 PrintStr("\\draw [c, fill=c");
590 } else if (fillis==0) {
591 PrintStr("@");
592 PrintStr("\\draw [c");
593 } else {
594 PrintStr("\\draw [pattern=");
595 switch (fillsi) {
596 case 1 :
597 PrintStr("crosshatch dots");
598 break;
599 case 2 :
600 case 3 :
601 PrintStr("dots");
602 break;
603 case 4 :
604 PrintStr("north east lines");
605 break;
606 case 5 :
607 PrintStr("north west lines");
608 break;
609 case 6 :
610 PrintStr("vertical lines");
611 break;
612 case 7 :
613 PrintStr("horizontal lines");
614 break;
615 case 10 :
616 PrintStr("bricks");
617 break;
618 case 13 :
619 PrintStr("crosshatch");
620 break;
621 }
622 PrintStr(", draw=none, pattern color=c");
623 }
624 if (fCurrentAlpha != 1.) {
625 PrintStr(", fill opacity=");
627 }
628 }
629 PrintStr("] (");
631 PrintFast(1,",");
633 PrintStr(") -- ");
634
635 for (Int_t i=1;i<n;i++) {
636 x = XtoTeX(xw[i]);
637 y = YtoTeX(yw[i]);
638 PrintFast(1,"(");
640 PrintFast(1,",");
642 PrintFast(1,")");
643 if (i<n-1) PrintStr(" -- ");
644 else PrintStr(";@");
645 }
646}
647
648////////////////////////////////////////////////////////////////////////////////
649/// Start the TeX page. This function starts the tikzpicture environment
650
652{
653 // Compute pad conversion coefficients
654 if (gPad) {
655 Double_t ww = gPad->GetWw();
656 Double_t wh = gPad->GetWh();
657 fYsize = fXsize*wh/ww;
658 } else {
659 fYsize = 27;
660 }
661
662 if(!fBoundingBox) {
663 PrintStr("\\begin{tikzpicture}@");
664 PrintStr("\\def\\CheckTikzLibraryLoaded#1{ \\ifcsname tikz@library@#1@loaded\\endcsname \\else \\PackageWarning{tikz}{usetikzlibrary{#1} is missing in the preamble.} \\fi }@");
665 PrintStr("\\CheckTikzLibraryLoaded{patterns}@");
666 PrintStr("\\CheckTikzLibraryLoaded{plotmarks}@");
669 }
670}
671
672////////////////////////////////////////////////////////////////////////////////
673/// Set the range for the paper in centimetres
674
676{
677 fXsize = xsize;
678 fYsize = ysize;
679
680 fRange = kTRUE;
681}
682
683////////////////////////////////////////////////////////////////////////////////
684/// Set color index for fill areas
685
690
691////////////////////////////////////////////////////////////////////////////////
692/// Set color index for lines
693
698
699////////////////////////////////////////////////////////////////////////////////
700/// Change the line style
701///
702/// - linestyle = 2 dashed
703/// - linestyle = 3 dotted
704/// - linestyle = 4 dash-dotted
705/// - linestyle = else solid (1 in is used most of the time)
706
711
712////////////////////////////////////////////////////////////////////////////////
713/// Set the lines width.
714
719
720////////////////////////////////////////////////////////////////////////////////
721/// Set size for markers.
722
727
728////////////////////////////////////////////////////////////////////////////////
729/// Set color index for markers.
730
735
736////////////////////////////////////////////////////////////////////////////////
737/// Set color with its color index
738
740{
741 if (color < 0) color = 0;
742 TColor *col = gROOT->GetColor(color);
743
744 if (col) {
745 SetColor(col->GetRed(), col->GetGreen(), col->GetBlue());
746 fCurrentAlpha = col->GetAlpha();
747 } else {
748 SetColor(1., 1., 1.);
749 fCurrentAlpha = 1.;
750 }
751}
752
753////////////////////////////////////////////////////////////////////////////////
754/// Set color with its R G B components
755///
756/// - r: % of red in [0,1]
757/// - g: % of green in [0,1]
758/// - b: % of blue in [0,1]
759
761{
762 if (fCurrentRed == r && fCurrentGreen == g && fCurrentBlue == b) return;
763
764 fCurrentRed = r;
766 fCurrentBlue = b;
767 PrintStr("@");
768 PrintStr("\\definecolor{c}{rgb}{");
770 PrintFast(1,",");
772 PrintFast(1,",");
774 PrintFast(2,"};");
775}
776
777////////////////////////////////////////////////////////////////////////////////
778/// Set color index for text
779
784
785////////////////////////////////////////////////////////////////////////////////
786/// Draw text
787///
788/// - xx: x position of the text
789/// - yy: y position of the text
790/// - chars: text to be drawn
791
793{
794 Double_t wh = (Double_t)gPad->XtoPixel(gPad->GetX2());
795 Double_t hh = (Double_t)gPad->YtoPixel(gPad->GetY1());
797 if (wh < hh) {
799 Int_t sizeTTF = (Int_t)(tsize+0.5);
800 ftsize = (sizeTTF*fXsize*gPad->GetAbsWNDC())/wh;
801 } else {
803 Int_t sizeTTF = (Int_t)(tsize+0.5);
804 ftsize = (sizeTTF*fYsize*gPad->GetAbsHNDC())/hh;
805 }
806 ftsize *= 2.22097;
807 if (ftsize <= 0) return;
808
809 TString t(chars);
810 if (t.Index("\\")>=0 || t.Index("^{")>=0 || t.Index("_{")>=0) {
811 t.Prepend("$");
812 t.Append("$");
813 } else {
814 t.ReplaceAll("<","$<$");
815 t.ReplaceAll(">","$>$");
816 t.ReplaceAll("_","\\_");
817 }
818 t.ReplaceAll("&","\\&");
819 t.ReplaceAll("#","\\#");
820 t.ReplaceAll("%","\\%");
821
823 if (txalh <1) txalh = 1; else if (txalh > 3) txalh = 3;
825 if (txalv <1) txalv = 1; else if (txalv > 3) txalv = 3;
827 PrintStr("@");
828 PrintStr("\\draw");
829 if (txalh!=2 || txalv!=2) {
830 PrintStr(" [anchor=");
831 if (txalv==1) PrintStr("base");
832 if (txalv==3) PrintStr("north");
833 if (txalh==1) PrintStr(" west");
834 if (txalh==3) PrintStr(" east");
835 PrintFast(1,"]");
836 }
837 PrintFast(2," (");
839 PrintFast(1,",");
841 PrintStr(") node[scale=");
843 PrintStr(", color=c");
844 if (fCurrentAlpha != 1.) {
845 PrintStr(",opacity=");
847 }
848 PrintStr(", rotate=");
850 PrintFast(2,"]{");
851 PrintStr(t.Data());
852 PrintFast(2,"};");
853}
854
855////////////////////////////////////////////////////////////////////////////////
856/// Write a string of characters in NDC
857
859{
860 Double_t x = gPad->GetX1() + u*(gPad->GetX2() - gPad->GetX1());
861 Double_t y = gPad->GetY1() + v*(gPad->GetY2() - gPad->GetY1());
862 Text(x, y, chars);
863}
864
865////////////////////////////////////////////////////////////////////////////////
866/// Convert U from NDC coordinate to TeX
867
869{
870 Double_t cm = fXsize*(gPad->GetAbsXlowNDC() + u*gPad->GetAbsWNDC());
871 return cm;
872}
873
874////////////////////////////////////////////////////////////////////////////////
875/// Convert V from NDC coordinate to TeX
876
878{
879 Double_t cm = fYsize*(gPad->GetAbsYlowNDC() + v*gPad->GetAbsHNDC());
880 return cm;
881}
882
883////////////////////////////////////////////////////////////////////////////////
884/// Convert X from world coordinate to TeX
885
887{
888 Double_t u = (x - gPad->GetX1())/(gPad->GetX2() - gPad->GetX1());
889 return UtoTeX(u);
890}
891
892////////////////////////////////////////////////////////////////////////////////
893/// Convert Y from world coordinate to TeX
894
896{
897 Double_t v = (y - gPad->GetY1())/(gPad->GetY2() - gPad->GetY1());
898 return VtoTeX(v);
899}
900
901////////////////////////////////////////////////////////////////////////////////
902/// Begin the Cell Array painting
903
905 Double_t)
906{
907 Warning("CellArrayBegin", "not yet implemented");
908}
909
910////////////////////////////////////////////////////////////////////////////////
911/// Paint the Cell Array
912
914{
915 Warning("CellArrayFill", "not yet implemented");
916}
917
918////////////////////////////////////////////////////////////////////////////////
919/// End the Cell Array painting
920
922{
923 Warning("CellArrayEnd", "not yet implemented");
924}
925
926////////////////////////////////////////////////////////////////////////////////
927/// Not needed in TeX case
928
930{
931 Warning("DrawPS", "not yet implemented");
932}
933
934////////////////////////////////////////////////////////////////////////////////
935/// add additional pgfplotmarks
936
938{
939 // open cross
940 PrintStr("\\pgfdeclareplotmark{cross} {@");
941 PrintStr("\\pgfpathmoveto{\\pgfpoint{-0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
942 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{\\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("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
948 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
949 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
950 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
951 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
952 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
953 PrintStr("\\pgfpathclose@");
954 PrintStr("\\pgfusepathqstroke@");
955 PrintStr("}@");
956
957 // filled cross
958 PrintStr("\\pgfdeclareplotmark{cross*} {@");
959 PrintStr("\\pgfpathmoveto{\\pgfpoint{-0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
960 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
961 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
962 PrintStr("\\pgfpathlineto{\\pgfpoint{+1\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
963 PrintStr("\\pgfpathlineto{\\pgfpoint{+1\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
964 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
965 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
966 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
967 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
968 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
969 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
970 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
971 PrintStr("\\pgfpathclose@");
972 PrintStr("\\pgfusepathqfillstroke@");
973 PrintStr("}@");
974
975 // open star
976 PrintStr("\\pgfdeclareplotmark{newstar} {@");
977 PrintStr("\\pgfpathmoveto{\\pgfqpoint{0pt}{\\pgfplotmarksize}}@");
978 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{44}{0.5\\pgfplotmarksize}}@");
979 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{18}{\\pgfplotmarksize}}@");
980 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-20}{0.5\\pgfplotmarksize}}@");
981 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-54}{\\pgfplotmarksize}}@");
982 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-90}{0.5\\pgfplotmarksize}}@");
983 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{234}{\\pgfplotmarksize}}@");
984 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{198}{0.5\\pgfplotmarksize}}@");
985 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{162}{\\pgfplotmarksize}}@");
986 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{134}{0.5\\pgfplotmarksize}}@");
987 PrintStr("\\pgfpathclose@");
988 PrintStr("\\pgfusepathqstroke@");
989 PrintStr("}@");
990
991 // filled star
992 PrintStr("\\pgfdeclareplotmark{newstar*} {@");
993 PrintStr("\\pgfpathmoveto{\\pgfqpoint{0pt}{\\pgfplotmarksize}}@");
994 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{44}{0.5\\pgfplotmarksize}}@");
995 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{18}{\\pgfplotmarksize}}@");
996 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-20}{0.5\\pgfplotmarksize}}@");
997 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-54}{\\pgfplotmarksize}}@");
998 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-90}{0.5\\pgfplotmarksize}}@");
999 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{234}{\\pgfplotmarksize}}@");
1000 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{198}{0.5\\pgfplotmarksize}}@");
1001 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{162}{\\pgfplotmarksize}}@");
1002 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{134}{0.5\\pgfplotmarksize}}@");
1003 PrintStr("\\pgfpathclose@");
1004 PrintStr("\\pgfusepathqfillstroke@");
1005 PrintStr("}@");
1006}
#define b(i)
Definition RSha256.hxx:100
#define g(i)
Definition RSha256.hxx:105
short Style_t
Definition RtypesCore.h:82
int Int_t
Definition RtypesCore.h:45
short Color_t
Definition RtypesCore.h:85
float Size_t
Definition RtypesCore.h:89
short Width_t
Definition RtypesCore.h:84
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
double Double_t
Definition RtypesCore.h:59
constexpr Ssiz_t kNPOS
Definition RtypesCore.h:117
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:374
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:414
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:1927
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:139
Int_t Atoi() const
Return integer value of string.
Definition TString.cxx:1988
const char * Data() const
Definition TString.h:376
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:704
@ kBoth
Definition TString.h:276
@ kExact
Definition TString.h:277
TString & Prepend(const char *cs)
Definition TString.h:673
TString & Append(const char *cs)
Definition TString.h:572
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:2378
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:651
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
Definition TStyle.cxx:1168
void GetPaperSize(Float_t &xsize, Float_t &ysize) const
Set paper size for PostScript output.
Definition TStyle.cxx:1185
Float_t GetLineScalePS() const
Definition TStyle.h:291
Interface to TeX.
Definition TTeXDump.h:20
void CellArrayFill(Int_t r, Int_t g, Int_t b) override
Paint the Cell Array.
Definition TTeXDump.cxx:913
void SetLineStyle(Style_t linestyle=1) override
Change the line style.
Definition TTeXDump.cxx:707
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:929
void Close(Option_t *opt="") override
Close a TeX file.
Definition TTeXDump.cxx:202
void DrawPolyLineNDC(Int_t n, TPoints *uv)
Draw a PolyLine in NDC space.
Definition TTeXDump.cxx:400
void On()
Activate an already open TeX file.
Definition TTeXDump.cxx:224
void Open(const char *filename, Int_t type=-111) override
Open a TeX file.
Definition TTeXDump.cxx:131
Bool_t fStandalone
True when a TeX file should be standalone.
Definition TTeXDump.h:28
void DefineMarkers()
add additional pgfplotmarks
Definition TTeXDump.cxx:937
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:715
Float_t VtoTeX(Double_t v)
Convert V from NDC coordinate to TeX.
Definition TTeXDump.cxx:877
void NewPage() override
Start the TeX page. This function starts the tikzpicture environment.
Definition TTeXDump.cxx:651
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:686
~TTeXDump() override
Default TeX destructor.
Definition TTeXDump.cxx:194
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:369
void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y) override
Paint PolyMarker.
Definition TTeXDump.cxx:408
void Range(Float_t xrange, Float_t yrange)
Set the range for the paper in centimetres.
Definition TTeXDump.cxx:675
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Draw a Box.
Definition TTeXDump.cxx:248
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:904
void SetTextColor(Color_t cindex=1) override
Set color index for text.
Definition TTeXDump.cxx:780
void SetLineColor(Color_t cindex=1) override
Set color index for lines.
Definition TTeXDump.cxx:694
Float_t fCurrentAlpha
Current Alpha value.
Definition TTeXDump.h:32
void CellArrayEnd() override
End the Cell Array painting.
Definition TTeXDump.cxx:921
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:858
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:868
Float_t YtoTeX(Double_t y)
Convert Y from world coordinate to TeX.
Definition TTeXDump.cxx:895
void DrawPolyLine(Int_t n, TPoints *xy)
Draw a PolyLine.
Definition TTeXDump.cxx:385
void Off()
Deactivate an already open TeX file.
Definition TTeXDump.cxx:240
TTeXDump()
Default TeX constructor.
Definition TTeXDump.cxx:85
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:792
void SetMarkerSize(Size_t msize=1) override
Set size for markers.
Definition TTeXDump.cxx:723
void SetColor(Int_t color=1)
Set color with its color index.
Definition TTeXDump.cxx:739
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:886
void SetMarkerColor(Color_t cindex=1) override
Set color index for markers.
Definition TTeXDump.cxx:731
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:684
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:123