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{
397
398 PrintStr("@");
399 PrintStr("\\foreach \\P in {");
400
401 Float_t x = XtoTeX(xw[0]);
402 Float_t y = YtoTeX(yw[0]);
403
404 PrintStr("(");
406 PrintFast(1,",");
408 PrintStr(")");
409
410 for (Int_t i = 1; i < n; i++) {
411 x = XtoTeX(xw[i]);
412 y = YtoTeX(yw[i]);
413 PrintFast(3,", (");
415 PrintFast(1,",");
417 PrintFast(1,")");
418 }
419
420 PrintStr("}{\\draw[mark options={color=c,fill=c");
421
422 if (fCurrentAlpha != 1.) {
423 PrintStr(",opacity=");
425 }
426
428 auto markerLineWidth = TAttMarker::GetMarkerLineWidth(GetMarkerStyle());
429
431 PrintStr(",rotate=180");
432
433 PrintStr(TString::Format("},mark size=%fpt", 8./3.33*(GetMarkerSize() - TMath::Floor(markerLineWidth/2.)/4.)));
434 PrintStr(TString::Format(", line width=%fpt", 4./3.33*TMath::Floor(markerLineWidth/2.)));
435 PrintStr(", mark=");
436
437 switch (markerStyle) {
438 case kDot :
439 PrintStr("*");
440 PrintStr(",mark size=1pt");
441 break;
442 case kPlus :
443 PrintStr("+");
444 break;
445 case kStar :
446 PrintStr("asterisk");
447 break;
448 case kCircle :
449 PrintStr("o");
450 break;
451 case kMultiply :
452 PrintStr("x");
453 break;
454 case kFullCircle :
455 PrintStr("*");
456 break;
457 case kFullSquare :
458 PrintStr("square*");
459 break;
460 case kFullTriangleUp :
461 PrintStr("triangle*");
462 break;
463 case kFullTriangleDown :
464 PrintStr("triangle*");
465 break;
466 case kOpenCircle :
467 PrintStr("o");
468 break;
469 case kOpenSquare :
470 PrintStr("square");
471 break;
472 case kOpenTriangleUp :
473 PrintStr("triangle");
474 break;
475 case kOpenDiamond :
476 PrintStr("diamond");
477 break;
478 case kOpenCross :
479 PrintStr("cross");
480 break;
481 case kFullStar :
482 PrintStr("newstar*");
483 break;
484 case kOpenStar :
485 PrintStr("newstar");
486 break;
487 case kStar2 :
488 PrintStr("10-pointed star");
489 break;
490 case kOpenTriangleDown :
491 PrintStr("triangle");
492 break;
493 case kFullDiamond :
494 PrintStr("diamond*");
495 break;
496 case kFullCross :
497 PrintStr("cross*");
498 break;
499 }
500 PrintStr("] plot coordinates {\\P};}");
501}
502
503////////////////////////////////////////////////////////////////////////////////
504/// This function defines a path with xw and yw and draw it according the
505/// value of nn:
506///
507/// - If nn>0 a line is drawn.
508/// - If nn<0 a closed polygon is drawn.
509
511{
512 Int_t n = TMath::Abs(nn);
513 Float_t x, y;
514
515 if( n <= 1) {
516 Error("DrawPS", "Two points are needed");
517 return;
518 }
519
520 x = XtoTeX(xw[0]);
521 y = YtoTeX(yw[0]);
522
523 Int_t fillis = fFillStyle/1000;
524 Int_t fillsi = fFillStyle%1000;
525
526 if (nn>0) {
527 if (fLineWidth<=0) return;
529 PrintStr("@");
530 PrintStr("\\draw [c");
534 if (stripped.Length()) {
535 tikzSpec.Append(",dash pattern=");
536 Ssiz_t i{0}, j{0};
537 bool on{true}, iterate{true};
538
539 while (iterate){
540 j = stripped.Index(" ", 1, i, TString::kExact);
541 if (j == kNPOS){
542 iterate = false;
543 j = stripped.Length();
544 }
545
546 if (on) {
547 tikzSpec.Append("on ");
548 on = false;
549 } else {
550 tikzSpec.Append("off ");
551 on = true;
552 }
553 int num = TString{stripped(i, j - i)}.Atoi();
554 float pt = 0.2*num;
555 tikzSpec.Append(TString::Format("%.2fpt ", pt));
556 i = j + 1;
557 }
558 PrintStr(tikzSpec.Data());
559 }
560 PrintStr(",line width=");
562 if (fCurrentAlpha != 1.) {
563 PrintStr(",opacity=");
565 }
566 } else {
568 if (fillis==1) {
569 PrintStr("@");
570 PrintStr("\\draw [c, fill=c");
571 } else if (fillis==0) {
572 PrintStr("@");
573 PrintStr("\\draw [c");
574 } else {
575 PrintStr("\\draw [pattern=");
576 switch (fillsi) {
577 case 1 :
578 PrintStr("crosshatch dots");
579 break;
580 case 2 :
581 case 3 :
582 PrintStr("dots");
583 break;
584 case 4 :
585 PrintStr("north east lines");
586 break;
587 case 5 :
588 PrintStr("north west lines");
589 break;
590 case 6 :
591 PrintStr("vertical lines");
592 break;
593 case 7 :
594 PrintStr("horizontal lines");
595 break;
596 case 10 :
597 PrintStr("bricks");
598 break;
599 case 13 :
600 PrintStr("crosshatch");
601 break;
602 }
603 PrintStr(", draw=none, pattern color=c");
604 }
605 if (fCurrentAlpha != 1.) {
606 PrintStr(", fill opacity=");
608 }
609 }
610 PrintStr("] (");
612 PrintFast(1,",");
614 PrintStr(") -- ");
615
616 for (Int_t i=1;i<n;i++) {
617 x = XtoTeX(xw[i]);
618 y = YtoTeX(yw[i]);
619 PrintFast(1,"(");
621 PrintFast(1,",");
623 PrintFast(1,")");
624 if (i<n-1) PrintStr(" -- ");
625 else PrintStr(";@");
626 }
627}
628
629////////////////////////////////////////////////////////////////////////////////
630/// Start the TeX page. This function starts the tikzpicture environment
631
633{
634 // Compute pad conversion coefficients
635 if (gPad) {
636 Double_t ww = gPad->GetWw();
637 Double_t wh = gPad->GetWh();
638 fYsize = fXsize*wh/ww;
639 } else {
640 fYsize = 27;
641 }
642
643 if(!fBoundingBox) {
644 PrintStr("\\begin{tikzpicture}@");
645 PrintStr("\\def\\CheckTikzLibraryLoaded#1{ \\ifcsname tikz@library@#1@loaded\\endcsname \\else \\PackageWarning{tikz}{usetikzlibrary{#1} is missing in the preamble.} \\fi }@");
646 PrintStr("\\CheckTikzLibraryLoaded{patterns}@");
647 PrintStr("\\CheckTikzLibraryLoaded{plotmarks}@");
650 }
651}
652
653////////////////////////////////////////////////////////////////////////////////
654/// Set the range for the paper in centimetres
655
657{
658 fXsize = xsize;
659 fYsize = ysize;
660
661 fRange = kTRUE;
662}
663
664////////////////////////////////////////////////////////////////////////////////
665/// Set color index for fill areas
666
671
672////////////////////////////////////////////////////////////////////////////////
673/// Set color index for lines
674
679
680////////////////////////////////////////////////////////////////////////////////
681/// Change the line style
682///
683/// - linestyle = 2 dashed
684/// - linestyle = 3 dotted
685/// - linestyle = 4 dash-dotted
686/// - linestyle = else solid (1 in is used most of the time)
687
692
693////////////////////////////////////////////////////////////////////////////////
694/// Set the lines width.
695
700
701////////////////////////////////////////////////////////////////////////////////
702/// Set size for markers.
703
708
709////////////////////////////////////////////////////////////////////////////////
710/// Set color index for markers.
711
716
717////////////////////////////////////////////////////////////////////////////////
718/// Set color with its color index
719
721{
722 if (color < 0) color = 0;
723 TColor *col = gROOT->GetColor(color);
724
725 if (col) {
726 SetColor(col->GetRed(), col->GetGreen(), col->GetBlue());
727 fCurrentAlpha = col->GetAlpha();
728 } else {
729 SetColor(1., 1., 1.);
730 fCurrentAlpha = 1.;
731 }
732}
733
734////////////////////////////////////////////////////////////////////////////////
735/// Set color with its R G B components
736///
737/// - r: % of red in [0,1]
738/// - g: % of green in [0,1]
739/// - b: % of blue in [0,1]
740
742{
743 if (fCurrentRed == r && fCurrentGreen == g && fCurrentBlue == b) return;
744
745 fCurrentRed = r;
747 fCurrentBlue = b;
748 PrintStr("@");
749 PrintStr("\\definecolor{c}{rgb}{");
751 PrintFast(1,",");
753 PrintFast(1,",");
755 PrintFast(2,"};");
756}
757
758////////////////////////////////////////////////////////////////////////////////
759/// Set color index for text
760
765
766////////////////////////////////////////////////////////////////////////////////
767/// Draw text
768///
769/// - xx: x position of the text
770/// - yy: y position of the text
771/// - chars: text to be drawn
772
774{
775 Double_t wh = (Double_t)gPad->GetPadWidth();
776 Double_t hh = (Double_t)gPad->GetPadHeight();
778 if (wh < hh) {
780 Int_t sizeTTF = (Int_t)(tsize+0.5);
781 ftsize = (sizeTTF*fXsize*gPad->GetAbsWNDC())/wh;
782 } else {
784 Int_t sizeTTF = (Int_t)(tsize+0.5);
785 ftsize = (sizeTTF*fYsize*gPad->GetAbsHNDC())/hh;
786 }
787 ftsize *= 2.22097;
788 if (ftsize <= 0) return;
789
790 TString t(chars);
791 if (t.Index("\\")>=0 || t.Index("^{")>=0 || t.Index("_{")>=0) {
792 t.Prepend("$");
793 t.Append("$");
794 } else {
795 t.ReplaceAll("<","$<$");
796 t.ReplaceAll(">","$>$");
797 t.ReplaceAll("_","\\_");
798 }
799 t.ReplaceAll("&","\\&");
800 t.ReplaceAll("#","\\#");
801 t.ReplaceAll("%","\\%");
802
804 if (txalh <1) txalh = 1; else if (txalh > 3) txalh = 3;
806 if (txalv <1) txalv = 1; else if (txalv > 3) txalv = 3;
808 PrintStr("@");
809 PrintStr("\\draw");
810 if (txalh!=2 || txalv!=2) {
811 PrintStr(" [anchor=");
812 if (txalv==1) PrintStr("base");
813 if (txalv==3) PrintStr("north");
814 if (txalh==1) PrintStr(" west");
815 if (txalh==3) PrintStr(" east");
816 PrintFast(1,"]");
817 }
818 PrintFast(2," (");
820 PrintFast(1,",");
822 PrintStr(") node[scale=");
824 PrintStr(", color=c");
825 if (fCurrentAlpha != 1.) {
826 PrintStr(",opacity=");
828 }
829 PrintStr(", rotate=");
831 PrintFast(2,"]{");
832 PrintStr(t.Data());
833 PrintFast(2,"};");
834}
835
836////////////////////////////////////////////////////////////////////////////////
837/// Draw text with URL. Same as Text.
838///
839
840void TTeXDump::TextUrl(Double_t x, Double_t y, const char *chars, const char *)
841{
842 Text(x, y, chars);
843}
844
845////////////////////////////////////////////////////////////////////////////////
846/// Write a string of characters in NDC
847
849{
850 Double_t x = gPad->GetX1() + u*(gPad->GetX2() - gPad->GetX1());
851 Double_t y = gPad->GetY1() + v*(gPad->GetY2() - gPad->GetY1());
852 Text(x, y, chars);
853}
854
855////////////////////////////////////////////////////////////////////////////////
856/// Convert U from NDC coordinate to TeX
857
859{
860 Double_t cm = fXsize*(gPad->GetAbsXlowNDC() + u*gPad->GetAbsWNDC());
861 return cm;
862}
863
864////////////////////////////////////////////////////////////////////////////////
865/// Convert V from NDC coordinate to TeX
866
868{
869 Double_t cm = fYsize*(gPad->GetAbsYlowNDC() + v*gPad->GetAbsHNDC());
870 return cm;
871}
872
873////////////////////////////////////////////////////////////////////////////////
874/// Convert X from world coordinate to TeX
875
877{
878 Double_t u = (x - gPad->GetX1())/(gPad->GetX2() - gPad->GetX1());
879 return UtoTeX(u);
880}
881
882////////////////////////////////////////////////////////////////////////////////
883/// Convert Y from world coordinate to TeX
884
886{
887 Double_t v = (y - gPad->GetY1())/(gPad->GetY2() - gPad->GetY1());
888 return VtoTeX(v);
889}
890
891////////////////////////////////////////////////////////////////////////////////
892/// Begin the Cell Array painting
893
895 Double_t)
896{
897 Warning("CellArrayBegin", "not yet implemented");
898}
899
900////////////////////////////////////////////////////////////////////////////////
901/// Paint the Cell Array
902
904{
905 Warning("CellArrayFill", "not yet implemented");
906}
907
908////////////////////////////////////////////////////////////////////////////////
909/// End the Cell Array painting
910
912{
913 Warning("CellArrayEnd", "not yet implemented");
914}
915
916////////////////////////////////////////////////////////////////////////////////
917/// Not needed in TeX case
918
920{
921 Warning("DrawPS", "not yet implemented");
922}
923
924////////////////////////////////////////////////////////////////////////////////
925/// add additional pgfplotmarks
926
928{
929 // open cross
930 PrintStr("\\pgfdeclareplotmark{cross} {@");
931 PrintStr("\\pgfpathmoveto{\\pgfpoint{-0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
932 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
933 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
934 PrintStr("\\pgfpathlineto{\\pgfpoint{+1\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
935 PrintStr("\\pgfpathlineto{\\pgfpoint{+1\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
936 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
937 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
938 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
939 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
940 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
941 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
942 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
943 PrintStr("\\pgfpathclose@");
944 PrintStr("\\pgfusepathqstroke@");
945 PrintStr("}@");
946
947 // filled cross
948 PrintStr("\\pgfdeclareplotmark{cross*} {@");
949 PrintStr("\\pgfpathmoveto{\\pgfpoint{-0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
950 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{\\pgfplotmarksize}}@");
951 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
952 PrintStr("\\pgfpathlineto{\\pgfpoint{+1\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
953 PrintStr("\\pgfpathlineto{\\pgfpoint{+1\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
954 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
955 PrintStr("\\pgfpathlineto{\\pgfpoint{+0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
956 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-1.\\pgfplotmarksize}}@");
957 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
958 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{-0.3\\pgfplotmarksize}}@");
959 PrintStr("\\pgfpathlineto{\\pgfpoint{-1.\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
960 PrintStr("\\pgfpathlineto{\\pgfpoint{-0.3\\pgfplotmarksize}{0.3\\pgfplotmarksize}}@");
961 PrintStr("\\pgfpathclose@");
962 PrintStr("\\pgfusepathqfillstroke@");
963 PrintStr("}@");
964
965 // open star
966 PrintStr("\\pgfdeclareplotmark{newstar} {@");
967 PrintStr("\\pgfpathmoveto{\\pgfqpoint{0pt}{\\pgfplotmarksize}}@");
968 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{44}{0.5\\pgfplotmarksize}}@");
969 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{18}{\\pgfplotmarksize}}@");
970 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-20}{0.5\\pgfplotmarksize}}@");
971 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-54}{\\pgfplotmarksize}}@");
972 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-90}{0.5\\pgfplotmarksize}}@");
973 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{234}{\\pgfplotmarksize}}@");
974 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{198}{0.5\\pgfplotmarksize}}@");
975 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{162}{\\pgfplotmarksize}}@");
976 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{134}{0.5\\pgfplotmarksize}}@");
977 PrintStr("\\pgfpathclose@");
978 PrintStr("\\pgfusepathqstroke@");
979 PrintStr("}@");
980
981 // filled star
982 PrintStr("\\pgfdeclareplotmark{newstar*} {@");
983 PrintStr("\\pgfpathmoveto{\\pgfqpoint{0pt}{\\pgfplotmarksize}}@");
984 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{44}{0.5\\pgfplotmarksize}}@");
985 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{18}{\\pgfplotmarksize}}@");
986 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-20}{0.5\\pgfplotmarksize}}@");
987 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-54}{\\pgfplotmarksize}}@");
988 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{-90}{0.5\\pgfplotmarksize}}@");
989 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{234}{\\pgfplotmarksize}}@");
990 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{198}{0.5\\pgfplotmarksize}}@");
991 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{162}{\\pgfplotmarksize}}@");
992 PrintStr("\\pgfpathlineto{\\pgfqpointpolar{134}{0.5\\pgfplotmarksize}}@");
993 PrintStr("\\pgfpathclose@");
994 PrintStr("\\pgfusepathqfillstroke@");
995 PrintStr("}@");
996}
#define b(i)
Definition RSha256.hxx:100
#define g(i)
Definition RSha256.hxx:105
short Style_t
Style number (short)
Definition RtypesCore.h:97
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
short Color_t
Color number (short)
Definition RtypesCore.h:100
float Size_t
Attribute size (float)
Definition RtypesCore.h:104
short Width_t
Line width (short)
Definition RtypesCore.h:99
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:72
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
double Double_t
Double 8 bytes.
Definition RtypesCore.h:74
constexpr Ssiz_t kNPOS
The equivalent of std::string::npos for the ROOT class TString.
Definition RtypesCore.h:132
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
const char Option_t
Option string (const char)
Definition RtypesCore.h:81
@ kStar
Definition TAttMarker.h:61
@ kOpenSquare
Definition TAttMarker.h:72
@ kOpenTriangleUp
Definition TAttMarker.h:73
@ kOpenTriangleDown
Definition TAttMarker.h:79
@ kFullTriangleDown
Definition TAttMarker.h:70
@ kCircle
Definition TAttMarker.h:62
@ kFullSquare
Definition TAttMarker.h:68
@ kFullStar
Definition TAttMarker.h:76
@ kOpenDiamond
Definition TAttMarker.h:74
@ kStar2
Definition TAttMarker.h:78
@ kFullTriangleUp
Definition TAttMarker.h:69
@ kMultiply
Definition TAttMarker.h:63
@ kPlus
Definition TAttMarker.h:60
@ kFullCircle
Definition TAttMarker.h:67
@ kDot
Definition TAttMarker.h:59
@ kOpenCross
Definition TAttMarker.h:75
@ kOpenCircle
Definition TAttMarker.h:71
@ kFullCross
Definition TAttMarker.h:81
@ kOpenStar
Definition TAttMarker.h:77
@ kFullDiamond
Definition TAttMarker.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
virtual Style_t GetMarkerStyle() const
Return the marker style.
Definition TAttMarker.h:35
virtual Color_t GetMarkerColor() const
Return the marker color.
Definition TAttMarker.h:34
Color_t fMarkerColor
Marker color.
Definition TAttMarker.h:25
virtual Size_t GetMarkerSize() const
Return the marker size.
Definition TAttMarker.h:36
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:27
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:1082
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1096
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:2068
const char * Data() const
Definition TString.h:386
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:715
@ kBoth
Definition TString.h:284
@ kExact
Definition TString.h:285
TString & Prepend(const char *cs)
Definition TString.h:684
TString & Append(const char *cs)
Definition TString.h:583
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:2459
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:662
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:903
void SetLineStyle(Style_t linestyle=1) override
Change the line style.
Definition TTeXDump.cxx:688
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:919
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:927
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:840
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:696
Float_t VtoTeX(Double_t v)
Convert V from NDC coordinate to TeX.
Definition TTeXDump.cxx:867
void NewPage() override
Start the TeX page. This function starts the tikzpicture environment.
Definition TTeXDump.cxx:632
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:667
~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:656
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:894
void SetTextColor(Color_t cindex=1) override
Set color index for text.
Definition TTeXDump.cxx:761
void SetLineColor(Color_t cindex=1) override
Set color index for lines.
Definition TTeXDump.cxx:675
Float_t fCurrentAlpha
Current Alpha value.
Definition TTeXDump.h:32
void CellArrayEnd() override
End the Cell Array painting.
Definition TTeXDump.cxx:911
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:848
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:858
Float_t YtoTeX(Double_t y)
Convert Y from world coordinate to TeX.
Definition TTeXDump.cxx:885
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:773
void SetMarkerSize(Size_t msize=1) override
Set size for markers.
Definition TTeXDump.cxx:704
void SetColor(Int_t color=1)
Set color with its color index.
Definition TTeXDump.cxx:720
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:876
void SetMarkerColor(Color_t cindex=1) override
Set color index for markers.
Definition TTeXDump.cxx:712
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:693
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:122