Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TTeXDump.cxx
Go to the documentation of this file.
1// @(#)root/postscript:$Id$
2// Author: Olivier Couet
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifdef WIN32
13#pragma optimize("",off)
14#endif
15
16#include <cstdlib>
17#include <cstring>
18#include <cctype>
19#include <fstream>
20
21#include "TROOT.h"
22#include "TColor.h"
23#include "TVirtualPad.h"
24#include "TPoints.h"
25#include "TTeXDump.h"
26#include "TStyle.h"
27#include "TMath.h"
28
29
30/** \class TTeXDump
31\ingroup PS
32
33\brief Interface to TeX.
34
35This class allow to generate <b>PGF/TikZ</b> vector graphics output
36which can be included in TeX and LaTeX documents.
37
38PGF is a TeX macro package for generating graphics. It is platform
39and format-independent and works together with the most important TeX
40backend drivers, including pdftex and dvips. It comes with a
41user-friendly syntax layer called TikZ.
42
43To generate a such file it is enough to do:
44~~~ {.cpp}
45 gStyle->SetPaperSize(10.,10.);
46 hpx->Draw();
47 gPad->Print("hpx.tex");
48~~~
49
50Then, the generated file (`hpx.tex`) can be included in a
51LaTeX document (`simple.tex`) in the following way:
52~~~ {.cpp}
53\documentclass{article}
54\usepackage{tikz}
55\usetikzlibrary{patterns}
56\usetikzlibrary{plotmarks}
57\title{A simple LaTeX example}
58\date{July 2013}
59\begin{document}
60\maketitle
61The following image as been generated using the TTeXDump class:
62\par
63\input{hpx.tex}
64\end{document}
65~~~
66
67Note the three directives needed at the top of the LaTeX file:
68~~~ {.cpp}
69\usepackage{tikz}
70\usetikzlibrary{patterns}
71\usetikzlibrary{plotmarks}
72~~~
73
74Then including the picture in the document is done with the
75`\input` directive.
76
77 The command `pdflatex simple.tex` will generate the
78corresponding pdf file `simple.pdf`.
79*/
80
81////////////////////////////////////////////////////////////////////////////////
82/// Default TeX constructor
83
85{
86 gVirtualPS = this;
87}
88
89////////////////////////////////////////////////////////////////////////////////
90/// Initialize the TeX interface
91///
92/// --fname : TeX file name
93/// - wtype : TeX workstation type. Not used in the TeX driver. But as TTeXDump
94/// inherits from TVirtualPS it should be kept. Anyway it is not
95/// necessary to specify this parameter at creation time because it
96/// has a default value (which is ignore in the TeX case).
97
99{
100 gVirtualPS = this;
101
102 Open(fname, wtype);
103}
104
105////////////////////////////////////////////////////////////////////////////////
106/// Open a TeX file
107
108void TTeXDump::Open(const char *fname, Int_t wtype)
109{
110 if (fStream) {
111 Warning("Open", "TeX file already open");
112 return;
113 }
114
116 fLenBuffer = 0;
117 fType = abs(wtype);
118
120
122 if (gPad) {
123 Double_t ww = gPad->GetWw();
124 Double_t wh = gPad->GetWh();
125 ww *= gPad->GetWNDC();
126 wh *= gPad->GetHNDC();
127 Double_t ratio = wh/ww;
128 xrange = fXsize;
129 yrange = fXsize*ratio;
130 if (yrange > fYsize) { yrange = fYsize; xrange = yrange/ratio;}
132 }
133
134 // Open OS file
135 if (!OpenStream(fname)) {
136 Error("Open", "Cannot open file:%s", fname);
137 return;
138 }
139
140 gVirtualPS = this;
141
142 ClearBuffer();
143
145 fRange = kFALSE;
147
148 // Set a default range
150
151 if (strstr(GetTitle(),"Standalone"))
153 if (fStandalone) {
154 PrintStr("\\documentclass{standalone}@");
155 PrintStr("\\usepackage{tikz}@");
156 PrintStr("\\usetikzlibrary{patterns,plotmarks}@");
157 PrintStr("\\begin{document}@");
158 } else {
159 PrintStr("%\\documentclass{standalone}@");
160 PrintStr("%\\usepackage{tikz}@");
161 PrintStr("%\\usetikzlibrary{patterns,plotmarks}@");
162 PrintStr("%\\begin{document}@");
163 }
164
165 NewPage();
166}
167
168////////////////////////////////////////////////////////////////////////////////
169/// Default TeX destructor
170
172{
173 Close();
174}
175
176////////////////////////////////////////////////////////////////////////////////
177/// Close a TeX file
178
180{
181 if (!gVirtualPS || !fStream)
182 return;
183 if (gPad)
184 gPad->Update();
185 PrintStr("@");
186 PrintStr("\\end{tikzpicture}@");
187 if (fStandalone) {
188 PrintStr("\\end{document}@");
189 } else {
190 PrintStr("%\\end{document}@");
191 }
192
193 // Close file stream
194 CloseStream();
195
196 gVirtualPS = nullptr;
197}
198
199////////////////////////////////////////////////////////////////////////////////
200/// Activate an already open TeX file
201
203{
204 // fType is used to know if the TeX file is open. Unlike TPostScript, TTeXDump
205 // has no "workstation type". In fact there is only one TeX type.
206
207 if (!fType) {
208 Error("On", "no TeX file open");
209 Off();
210 return;
211 }
212 gVirtualPS = this;
213}
214
215////////////////////////////////////////////////////////////////////////////////
216/// Deactivate an already open TeX file
217
219{
220 gVirtualPS = nullptr;
221}
222
223////////////////////////////////////////////////////////////////////////////////
224/// Draw a Box
225
227{
228 Float_t x1c = XtoTeX(x1);
229 Float_t y1c = YtoTeX(y1);
230 Float_t x2c = XtoTeX(x2);
231 Float_t y2c = YtoTeX(y2);
232
233 Int_t fillis = fFillStyle/1000;
234 Int_t fillsi = fFillStyle%1000;
235
236 if (fillis==1) {
238 PrintStr("@");
239 if (fCurrentAlpha != 1.) {
240 PrintStr("\\fill [c");
241 PrintStr(", fill opacity=");
243 }
244 else {
245 PrintStr("\\draw [color=c, fill=c");
246 }
247 PrintStr("] (");
249 PrintFast(1,",");
251 PrintStr(") rectangle (");
253 PrintFast(1,",");
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("] (");
295 PrintFast(1,",");
297 PrintStr(") rectangle (");
299 PrintFast(1,",");
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("] (");
316 PrintFast(1,",");
318 PrintStr(") -- (");
320 PrintFast(1,",");
322 PrintStr(") -- (");
324 PrintFast(1,",");
326 PrintStr(") -- (");
328 PrintFast(1,",");
330 PrintStr(") -- (");
332 PrintFast(1,",");
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
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");
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}@");
642 PrintStr("\\def\\CheckTikzLibraryLoaded#1{ \\ifcsname tikz@library@#1@loaded\\endcsname \\else \\PackageWarning{tikz}{usetikzlibrary{#1} is missing in the preamble.} \\fi }@");
643 PrintStr("\\CheckTikzLibraryLoaded{patterns}@");
644 PrintStr("\\CheckTikzLibraryLoaded{plotmarks}@");
647 }
648}
649
650////////////////////////////////////////////////////////////////////////////////
651/// Set the range for the paper in centimetres
652
654{
655 fXsize = xsize;
656 fYsize = ysize;
657
658 fRange = kTRUE;
659}
660
661////////////////////////////////////////////////////////////////////////////////
662/// Set color index for fill areas
663
668
669////////////////////////////////////////////////////////////////////////////////
670/// Set color index for lines
671
676
677////////////////////////////////////////////////////////////////////////////////
678/// Change the line style
679///
680/// - linestyle = 2 dashed
681/// - linestyle = 3 dotted
682/// - linestyle = 4 dash-dotted
683/// - linestyle = else solid (1 in is used most of the time)
684
689
690////////////////////////////////////////////////////////////////////////////////
691/// Set the lines width.
692
697
698////////////////////////////////////////////////////////////////////////////////
699/// Set size for markers.
700
705
706////////////////////////////////////////////////////////////////////////////////
707/// Set color index for markers.
708
713
714////////////////////////////////////////////////////////////////////////////////
715/// Set color with its color index
716
718{
719 if (color < 0) color = 0;
720 TColor *col = gROOT->GetColor(color);
721
722 if (col) {
723 SetColor(col->GetRed(), col->GetGreen(), col->GetBlue());
724 fCurrentAlpha = col->GetAlpha();
725 } else {
726 SetColor(1., 1., 1.);
727 fCurrentAlpha = 1.;
728 }
729}
730
731////////////////////////////////////////////////////////////////////////////////
732/// Set color with its R G B components
733///
734/// - r: % of red in [0,1]
735/// - g: % of green in [0,1]
736/// - b: % of blue in [0,1]
737
739{
740 if (fCurrentRed == r && fCurrentGreen == g && fCurrentBlue == b) return;
741
742 fCurrentRed = r;
744 fCurrentBlue = b;
745 PrintStr("@");
746 PrintStr("\\definecolor{c}{rgb}{");
748 PrintFast(1,",");
750 PrintFast(1,",");
752 PrintFast(2,"};");
753}
754
755////////////////////////////////////////////////////////////////////////////////
756/// Set color index for text
757
762
763////////////////////////////////////////////////////////////////////////////////
764/// Draw text
765///
766/// - xx: x position of the text
767/// - yy: y position of the text
768/// - chars: text to be drawn
769
771{
772 Double_t wh = (Double_t)gPad->GetPadWidth();
773 Double_t hh = (Double_t)gPad->GetPadHeight();
775 if (wh < hh) {
777 Int_t sizeTTF = (Int_t)(tsize+0.5);
778 ftsize = (sizeTTF*fXsize*gPad->GetAbsWNDC())/wh;
779 } else {
781 Int_t sizeTTF = (Int_t)(tsize+0.5);
782 ftsize = (sizeTTF*fYsize*gPad->GetAbsHNDC())/hh;
783 }
784 ftsize *= 2.22097;
785 if (ftsize <= 0) return;
786
787 TString t(chars);
788 if (t.Index("\\")>=0 || t.Index("^{")>=0 || t.Index("_{")>=0) {
789 t.Prepend("$");
790 t.Append("$");
791 } else {
792 t.ReplaceAll("<","$<$");
793 t.ReplaceAll(">","$>$");
794 t.ReplaceAll("_","\\_");
795 }
796 t.ReplaceAll("&","\\&");
797 t.ReplaceAll("#","\\#");
798 t.ReplaceAll("%","\\%");
799
801 if (txalh <1) txalh = 1; else if (txalh > 3) txalh = 3;
803 if (txalv <1) txalv = 1; else if (txalv > 3) txalv = 3;
805 PrintStr("@");
806 PrintStr("\\draw");
807 if (txalh!=2 || txalv!=2) {
808 PrintStr(" [anchor=");
809 if (txalv==1) PrintStr("base");
810 if (txalv==3) PrintStr("north");
811 if (txalh==1) PrintStr(" west");
812 if (txalh==3) PrintStr(" east");
813 PrintFast(1,"]");
814 }
815 PrintFast(2," (");
817 PrintFast(1,",");
819 PrintStr(") node[scale=");
821 PrintStr(", color=c");
822 if (fCurrentAlpha != 1.) {
823 PrintStr(",opacity=");
825 }
826 PrintStr(", rotate=");
828 PrintFast(2,"]{");
829 PrintStr(t.Data());
830 PrintFast(2,"};");
831}
832
833////////////////////////////////////////////////////////////////////////////////
834/// Draw text with URL. Same as Text.
835///
836
837void TTeXDump::TextUrl(Double_t x, Double_t y, const char *chars, const char *)
838{
839 Text(x, y, chars);
840}
841
842////////////////////////////////////////////////////////////////////////////////
843/// Write a string of characters in NDC
844
846{
847 Double_t x = gPad->GetX1() + u*(gPad->GetX2() - gPad->GetX1());
848 Double_t y = gPad->GetY1() + v*(gPad->GetY2() - gPad->GetY1());
849 Text(x, y, chars);
850}
851
852////////////////////////////////////////////////////////////////////////////////
853/// Convert U from NDC coordinate to TeX
854
856{
857 Double_t cm = fXsize*(gPad->GetAbsXlowNDC() + u*gPad->GetAbsWNDC());
858 return cm;
859}
860
861////////////////////////////////////////////////////////////////////////////////
862/// Convert V from NDC coordinate to TeX
863
865{
866 Double_t cm = fYsize*(gPad->GetAbsYlowNDC() + v*gPad->GetAbsHNDC());
867 return cm;
868}
869
870////////////////////////////////////////////////////////////////////////////////
871/// Convert X from world coordinate to TeX
872
874{
875 Double_t u = (x - gPad->GetX1())/(gPad->GetX2() - gPad->GetX1());
876 return UtoTeX(u);
877}
878
879////////////////////////////////////////////////////////////////////////////////
880/// Convert Y from world coordinate to TeX
881
883{
884 Double_t v = (y - gPad->GetY1())/(gPad->GetY2() - gPad->GetY1());
885 return VtoTeX(v);
886}
887
888////////////////////////////////////////////////////////////////////////////////
889/// Begin the Cell Array painting
890
892 Double_t)
893{
894 Warning("CellArrayBegin", "not yet implemented");
895}
896
897////////////////////////////////////////////////////////////////////////////////
898/// Paint the Cell Array
899
901{
902 Warning("CellArrayFill", "not yet implemented");
903}
904
905////////////////////////////////////////////////////////////////////////////////
906/// End the Cell Array painting
907
909{
910 Warning("CellArrayEnd", "not yet implemented");
911}
912
913////////////////////////////////////////////////////////////////////////////////
914/// Not needed in TeX case
915
917{
918 Warning("DrawPS", "not yet implemented");
919}
920
921////////////////////////////////////////////////////////////////////////////////
922/// add additional pgfplotmarks
923
925{
926 // open cross
927 PrintStr("\\pgfdeclareplotmark{cross} {@");
928 PrintStr("\\pgfpathmoveto{\\pgfpoint{-0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
929 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
930 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
931 PrintStr("\\pgfpathlineto{\\pgfpoint{+1\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
932 PrintStr("\\pgfpathlineto{\\pgfpoint{+1\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
933 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
934 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
935 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
936 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
937 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
938 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
939 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
940 PrintStr("\\pgfpathclose@");
941 PrintStr("\\pgfusepathqstroke@");
942 PrintStr("}@");
943
944 // filled cross
945 PrintStr("\\pgfdeclareplotmark{cross*} {@");
946 PrintStr("\\pgfpathmoveto{\\pgfpoint{-0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
947 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
948 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
949 PrintStr("\\pgfpathlineto{\\pgfpoint{+1\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
950 PrintStr("\\pgfpathlineto{\\pgfpoint{+1\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
951 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
952 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
953 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
954 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
955 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
956 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
957 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
958 PrintStr("\\pgfpathclose@");
959 PrintStr("\\pgfusepathqfillstroke@");
960 PrintStr("}@");
961
962 // open star
963 PrintStr("\\pgfdeclareplotmark{newstar} {@");
964 PrintStr("\\pgfpathmoveto{\\pgfqpoint{0pt}{\\pgfplotmarksize}}@");
965 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{44}{0.5\\pgfplotmarksize}}@");
966 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{18}{\\pgfplotmarksize}}@");
967 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-20}{0.5\\pgfplotmarksize}}@");
968 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-54}{\\pgfplotmarksize}}@");
969 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-90}{0.5\\pgfplotmarksize}}@");
970 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{234}{\\pgfplotmarksize}}@");
971 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{198}{0.5\\pgfplotmarksize}}@");
972 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{162}{\\pgfplotmarksize}}@");
973 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{134}{0.5\\pgfplotmarksize}}@");
974 PrintStr("\\pgfpathclose@");
975 PrintStr("\\pgfusepathqstroke@");
976 PrintStr("}@");
977
978 // filled star
979 PrintStr("\\pgfdeclareplotmark{newstar*} {@");
980 PrintStr("\\pgfpathmoveto{\\pgfqpoint{0pt}{\\pgfplotmarksize}}@");
981 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{44}{0.5\\pgfplotmarksize}}@");
982 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{18}{\\pgfplotmarksize}}@");
983 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-20}{0.5\\pgfplotmarksize}}@");
984 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-54}{\\pgfplotmarksize}}@");
985 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-90}{0.5\\pgfplotmarksize}}@");
986 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{234}{\\pgfplotmarksize}}@");
987 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{198}{0.5\\pgfplotmarksize}}@");
988 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{162}{\\pgfplotmarksize}}@");
989 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{134}{0.5\\pgfplotmarksize}}@");
990 PrintStr("\\pgfpathclose@");
991 PrintStr("\\pgfusepathqfillstroke@");
992 PrintStr("}@");
993}
#define b(i)
Definition RSha256.hxx:100
#define g(i)
Definition RSha256.hxx:105
short Style_t
Style number (short)
Definition RtypesCore.h:96
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
short Color_t
Color number (short)
Definition RtypesCore.h:99
float Size_t
Attribute size (float)
Definition RtypesCore.h:103
short Width_t
Line width (short)
Definition RtypesCore.h:98
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
Definition RtypesCore.h:131
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t cindex
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t TPoint TPoint const char y2
Option_t Option_t TPoint TPoint const char y1
#define gROOT
Definition TROOT.h:417
R__EXTERN TStyle * gStyle
Definition TStyle.h:442
R__EXTERN TVirtualPS * gVirtualPS
Definition TVirtualPS.h:88
#define gPad
Style_t fFillStyle
Fill area style.
Definition TAttFill.h:25
Color_t fFillColor
Fill area color.
Definition TAttFill.h:24
Width_t fLineWidth
Line width.
Definition TAttLine.h:26
Style_t fLineStyle
Line style.
Definition TAttLine.h:25
Color_t fLineColor
Line color.
Definition TAttLine.h:24
Color_t fMarkerColor
Marker color.
Definition TAttMarker.h:24
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:26
Style_t fMarkerStyle
Marker style.
Definition TAttMarker.h:25
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:27
Float_t fTextAngle
Text angle.
Definition TAttText.h:24
Short_t fTextAlign
Text alignment.
Definition TAttText.h:26
Float_t fTextSize
Text size.
Definition TAttText.h:25
The color creation and management class.
Definition TColor.h:22
Float_t GetRed() const
Definition TColor.h:61
static Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by hex color string of form: "#rrggbb",...
Definition TColor.cxx:1926
Float_t GetAlpha() const
Definition TColor.h:67
Float_t GetBlue() const
Definition TColor.h:63
Float_t GetGreen() const
Definition TColor.h:62
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1081
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1095
2-D graphics point (world coordinates).
Definition TPoints.h:19
Basic string class.
Definition TString.h:138
Int_t Atoi() const
Return integer value of string.
Definition TString.cxx:1994
const char * Data() const
Definition TString.h:384
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:713
@ kBoth
Definition TString.h:284
@ kExact
Definition TString.h:285
TString & Prepend(const char *cs)
Definition TString.h:682
TString & Append(const char *cs)
Definition TString.h:581
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:2385
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:660
const char * GetLineStyleString(Int_t i=1) const
Return line style string (used by PostScript).
Definition TStyle.cxx:1167
void GetPaperSize(Float_t &xsize, Float_t &ysize) const
Set paper size for PostScript output.
Definition TStyle.cxx:1184
Float_t GetLineScalePS() const
Definition TStyle.h:291
void CellArrayFill(Int_t r, Int_t g, Int_t b) override
Paint the Cell Array.
Definition TTeXDump.cxx:900
void SetLineStyle(Style_t linestyle=1) override
Change the line style.
Definition TTeXDump.cxx:685
void SetLineScale(Float_t scale=1)
Definition TTeXDump.h:66
void DrawPS(Int_t n, Float_t *xw, Float_t *yw) override
Not needed in TeX case.
Definition TTeXDump.cxx:916
void Close(Option_t *opt="") override
Close a TeX file.
Definition TTeXDump.cxx:179
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:202
void Open(const char *filename, Int_t type=-111) override
Open a TeX file.
Definition TTeXDump.cxx:108
Bool_t fStandalone
True when a TeX file should be standalone.
Definition TTeXDump.h:28
void DefineMarkers()
add additional pgfplotmarks
Definition TTeXDump.cxx:924
Bool_t fBoundingBox
True when the TeX header is printed.
Definition TTeXDump.h:26
Float_t fCurrentRed
Current Red component.
Definition TTeXDump.h:29
void TextUrl(Double_t x, Double_t y, const char *string, const char *url) override
Draw text with URL.
Definition TTeXDump.cxx:837
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:693
Float_t VtoTeX(Double_t v)
Convert V from NDC coordinate to TeX.
Definition TTeXDump.cxx:864
void NewPage() override
Start the TeX page. This function starts the tikzpicture environment.
Definition TTeXDump.cxx:629
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:664
~TTeXDump() override
Default TeX destructor.
Definition TTeXDump.cxx:171
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:347
void DrawPolyMarker(Int_t n, Float_t *x, Float_t *y) override
Paint PolyMarker.
Definition TTeXDump.cxx:386
void Range(Float_t xrange, Float_t yrange)
Set the range for the paper in centimetres.
Definition TTeXDump.cxx:653
void DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2) override
Draw a Box.
Definition TTeXDump.cxx:226
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:891
void SetTextColor(Color_t cindex=1) override
Set color index for text.
Definition TTeXDump.cxx:758
void SetLineColor(Color_t cindex=1) override
Set color index for lines.
Definition TTeXDump.cxx:672
Float_t fCurrentAlpha
Current Alpha value.
Definition TTeXDump.h:32
void CellArrayEnd() override
End the Cell Array painting.
Definition TTeXDump.cxx:908
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:845
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:855
Float_t YtoTeX(Double_t y)
Convert Y from world coordinate to TeX.
Definition TTeXDump.cxx:882
void DrawPolyLine(Int_t n, TPoints *xy)
Draw a PolyLine.
Definition TTeXDump.cxx:363
void Off()
Deactivate an already open TeX file.
Definition TTeXDump.cxx:218
TTeXDump()
Default TeX constructor.
Definition TTeXDump.cxx:84
Float_t fCurrentGreen
Current Green component.
Definition TTeXDump.h:30
Float_t fYsize
Page size along Y.
Definition TTeXDump.h:24
void Text(Double_t x, Double_t y, const char *string) override
Draw text.
Definition TTeXDump.cxx:770
void SetMarkerSize(Size_t msize=1) override
Set size for markers.
Definition TTeXDump.cxx:701
void SetColor(Int_t color=1)
Set color with its color index.
Definition TTeXDump.cxx:717
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:873
void SetMarkerColor(Color_t cindex=1) override
Set color index for markers.
Definition TTeXDump.cxx:709
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
Definition TVirtualPS.h:30
Int_t fLenBuffer
Definition TVirtualPS.h:38
void CloseStream()
Close existing stream.
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
Bool_t OpenStream(const char *fname, Bool_t binary=kFALSE)
Open output stream.
void ClearBuffer()
Clear content of internal buffer.
virtual void WriteReal(Float_t r, Bool_t space=kTRUE)
Write a Real number to the file.
TPaveText * pt
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
int iterate(rng_state_t *X)
Definition mixmax.icc:34
Double_t Floor(Double_t x)
Rounds x downward, returning the largest integral value that is not greater than x.
Definition TMath.h:691
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:122