\ProvidesPackage{tioga}[2018/03/01]
% Here are some command to ease the use of pictures produced by Tioga
% within a LaTeX document.


% \tiogafigurefullpage[minwhitespace]{figurename}
%
% \tiogafigurefullpage shows a version of the picture scaled to fit the 
% paper size minus the minwhitespace.  The minwhitespace is the sum of 
% the margins on both sides, top and bottom or left and right. 
% The minwhitespace defaults to 2 inches.
%
\newcommand{\tiogafigurefullpage}[2][2in]{
  \tiogafigurescaledtofit{#2}{\paperwidth - (#1)}{\paperheight - (#1)}}


% \tiogafigurescaledtofit{figurename}{maxwidth}{maxheight}
%
% \tiogafigurescaledtofit shows a version of the picture scaled to fit the
% given width and height while preserving the aspect ratio.
% The 1st arg is the base name for the pdf and txt files.
% The 2nd arg determines the maximum figure width.
% The 3rd arg determines the maximum figure height.
\newcommand{\tiogafigurescaledtofit}[3]{
  \setkeys{Gin}{keepaspectratio=true}
  \resizebox{#2}{#3}{\tiogafigureshow{#1}}}


% \tiogafigurescaled{figurename}{scalefactor}
%
% \tiogafigurescaled shows a scaled version of the picture
% The 1st arg is the base name for the pdf and txt files.
% The 2nd arg determines the scale.
\newcommand{\tiogafigurescaled}[2]{
  \scalebox{#2}{\tiogafigureshow{#1}}}


% \tiogafigurescaledxy{figurename}{xscalefactor}{yscalefactor}
%
% \tiogafigurescaledxy shows a scaled version of the picture where you
% can use different scaling factors in the horizontal and vertical directions.
% The 1st arg is the base name for the pdf and txt files.
% The 2nd arg determines the horizontal scale.
% The 3rd arg determines the vertical scale.
\newcommand{\tiogafigurescaledxy}[3]{
  \scalebox{#2}[#3]{\tiogafigureshow{#1}}}


% \tiogafiguresized{figurename}{figurewidth}{figureheight}
%
% \tiogafiguresized shows a scaled version of the picture, where you
% can specify the actual size you want.  If either length is
% given as !, the one scale factor is used in both directions.
% The 1st arg is the base name for the pdf and txt files.
% The 2nd arg determines the figure width.
% The 3rd arg determines the figure height.
\newcommand{\tiogafiguresized}[3]{
  \resizebox{#2}{#3}{\tiogafigureshow{#1}}}


% \tiogaprefix can be used to set a path for the figure pdf and txt files.
%
\newcommand{\tiogaprefix}{}
% The prefix is initialized to an empty string.  
% To change it, use \renewcommand as in the following example:
% \renewcommand{\tiogaprefix}{plot_out/}


% \tiogafigurecentered{figurename}{targetwidth}{targetheight}
%
% \tiogafigurecentered displays an unscaled figure centered within
% a box of targetwidth *targetheight.
\newcommand{\tiogafigurecentered}[3]{
\vbox to #3{%
\vspace*{\fill}%
\hbox to #2{\hfill%
\tiogafigureshow{#1}%
\hspace*{\fill}}%
\vspace*{\fill}%
}}

% \tiogafigurecentereddebug{figurename}{targetwidth}{targetheight}
%
% \tiogafigurecentereddebug has the same effect as \tiogafigurecentered
% except that the figure is included in a \fbox, which makes it easier
% to track problems.
\newcommand{\tiogafigurecentereddebug}[3]{
\vbox to #3{%
\vspace*{\fill}%
\hbox to #2{\hfill%
\fbox{\tiogafigureshow{#1}}
\hspace*{\fill}}%
\vspace*{\fill}%
}}


% \tiogafigureshow{figurename}
%
% \tiogafigureshow shows the figure and the accompanying text.
% Inside a box, it first creates a picture that includes the pdf
% file with the graphics for the figure, then it includes the text.
% The \tiogaprefix is added at the start of the file names for both.
\newcommand{\tiogafigureshow}[1]{%
  \mbox{\begin{picture}(0,0)(0,0)%
      \put(0,0){\includegraphics{\tiogaprefix#1_figure.pdf}}%
    \end{picture}%
    \input{\tiogaprefix#1_figure.txt}}}

% Commands for text properties:
% Font size (two parameters)
% {sz}{line_sp}, 1st is size of font in points,
% 2nd is line spacing (not used by Tioga)
\newcommand\tiog@fontsize{{10.0}{10pt}}
\newcommand\settiogafontsize[2][10pt]{\renewcommand\tiog@fontsize{{#2}{#1}}}

% Font family
% \rmdefault, \sfdefault, \ttdefault  -- roman, sans serif, typewriter
\newcommand\tiog@fontfamily{\rmdefault}
\newcommand\settiogafontfamily[1]{\renewcommand\tiog@fontfamily{#1}}

% Font series
% \mddefault, \bfdefault -- medium, bold 
\newcommand\tiog@fontseries{\mddefault}
\newcommand\settiogafontseries[1]{\renewcommand\tiog@fontseries{#1}}

% Font shape
% \updefault, \itdefault, \sldefault, \scdefault -- upright, italic, slant, small caps
\newcommand\tiog@fontshape{\updefault}
\newcommand\settiogafontshape[1]{\renewcommand\tiog@fontshape{#1}}

% \SetTiogaFontInfo is called from within the figure.txt file with the TeX
% for the text of the figure. Do not modify this function directly, it
% is way better to use the previous settiogafont* commands.
\newcommand\SetTiogaFontInfo{%
\expandafter\fontsize\tiog@fontsize%
\fontfamily{\tiog@fontfamily}% 
\fontseries{\tiog@fontseries}%
\fontshape{\tiog@fontshape}%
}

% This command is used inside the _figure.txt files. You can use it directly
% as well, if you really want to make sure you get the same fonts. But I
% personnaly doubt it would really come in useful ;-)...
\newcommand\tiogasetfont{\reset@font\SetTiogaFontInfo%
\selectfont}%


% This commands typesets its second argument while sending to the
% standard output successively the width, height and depth of the
% box produced.
%
% These informations are collected when Tioga runs pdflatex.
\newlength{\tiogatempdim}
\newcommand{\tiogameasure}[2]{%
\settowidth{\tiogatempdim}{#2}\typeout{#1[0]=\the\tiogatempdim}%
\settoheight{\tiogatempdim}{#2}\typeout{#1[1]=\the\tiogatempdim}%
\settodepth{\tiogatempdim}{#2}\typeout{#1[2]=\the\tiogatempdim}%
{#2}}
% Color constants, generated from ColorConstants.rb
\definecolor{FloralWhite}{rgb}{1.000,0.980,0.940}
\definecolor{ForestGreen}{rgb}{0.132,0.545,0.132}
\definecolor{Fuchsia}{rgb}{1.000,0.000,1.000}
\definecolor{Gainsboro}{rgb}{0.864,0.864,0.864}
\definecolor{GhostWhite}{rgb}{0.972,0.972,1.000}
\definecolor{Gold}{rgb}{1.000,0.844,0.000}
\definecolor{GoldenBrown}{rgb}{0.600,0.400,0.000}
\definecolor{Goldenrod}{rgb}{0.855,0.648,0.125}
\definecolor{GrassGreen}{rgb}{0.200,0.600,0.000}
\definecolor{Gray}{rgb}{0.500,0.500,0.500}
\definecolor{GrayBlue}{rgb}{0.000,0.400,0.600}
\definecolor{Green}{rgb}{0.000,0.500,0.000}
\definecolor{GreenYellow}{rgb}{0.680,1.000,0.185}
\definecolor{Grey}{rgb}{0.500,0.500,0.500}
\definecolor{Honeydew}{rgb}{0.940,1.000,0.940}
\definecolor{HotPink}{rgb}{1.000,0.410,0.705}
\definecolor{IndianRed}{rgb}{0.804,0.360,0.360}
\definecolor{Indigo}{rgb}{0.294,0.000,0.510}
\definecolor{Ivory}{rgb}{1.000,1.000,0.940}
\definecolor{Khaki}{rgb}{0.940,0.900,0.550}
\definecolor{Lavender}{rgb}{0.900,0.900,0.980}
\definecolor{LavenderBlue}{rgb}{0.400,0.200,1.000}
\definecolor{LavenderBlush}{rgb}{1.000,0.940,0.960}
\definecolor{LawnGreen}{rgb}{0.488,0.990,0.000}
\definecolor{LemonChiffon}{rgb}{1.000,0.980,0.804}
\definecolor{LightBlue}{rgb}{0.680,0.848,0.900}
\definecolor{LightBrightGreen}{rgb}{0.000,0.800,0.200}
\definecolor{LightCoral}{rgb}{0.940,0.500,0.500}
\definecolor{LightCrimson}{rgb}{0.864,0.080,0.235}
\definecolor{LightCyan}{rgb}{0.880,1.000,1.000}
\definecolor{LightDullGreen}{rgb}{0.400,1.000,0.600}
\definecolor{LightGold}{rgb}{0.800,0.800,0.400}
\definecolor{LightGrassGreen}{rgb}{0.400,1.000,0.400}
\definecolor{LightGray}{rgb}{0.828,0.828,0.828}
\definecolor{LightGreen}{rgb}{0.565,0.932,0.565}
\definecolor{LightGrey}{rgb}{0.828,0.828,0.828}
\definecolor{LightMustard}{rgb}{1.000,0.800,0.400}
\definecolor{LightOliveGreen}{rgb}{0.600,0.800,0.600}
\definecolor{LightOrchid}{rgb}{0.600,0.400,0.800}
\definecolor{LightPlum}{rgb}{0.800,0.600,0.800}
\definecolor{LightRose}{rgb}{1.000,0.600,0.800}
\definecolor{LightSalmon}{rgb}{1.000,0.628,0.480}
\definecolor{LightSandyBrown}{rgb}{1.000,0.800,0.600}
\definecolor{LightSeaGreen}{rgb}{0.125,0.698,0.668}
\definecolor{LightSienna}{rgb}{0.800,0.400,0.000}
\definecolor{LightSkyBlue}{rgb}{0.530,0.808,0.980}
\definecolor{LightSlateGray}{rgb}{0.468,0.532,0.600}
\definecolor{LightSlateGrey}{rgb}{0.468,0.532,0.600}
\definecolor{LightSteelBlue}{rgb}{0.690,0.770,0.870}
\definecolor{LightTurquoise}{rgb}{0.200,1.000,0.800}
\definecolor{LightYellow}{rgb}{1.000,1.000,0.880}
\definecolor{LightYellowGreen}{rgb}{0.800,0.800,0.200}
\definecolor{Lilac}{rgb}{0.800,0.600,1.000}
\definecolor{Lime}{rgb}{0.000,1.000,0.000}
\definecolor{LimeGreen}{rgb}{0.196,0.804,0.196}
\definecolor{Linen}{rgb}{0.980,0.940,0.900}
\definecolor{Magenta}{rgb}{1.000,0.000,1.000}
\definecolor{Maroon}{rgb}{0.500,0.000,0.000}
\definecolor{Mauve}{rgb}{0.800,0.200,0.400}
\definecolor{MediumAquamarine}{rgb}{0.400,0.804,0.668}
\definecolor{MediumBlue}{rgb}{0.000,0.000,0.804}
\definecolor{MediumGreen}{rgb}{0.000,0.600,0.000}
\definecolor{MediumOrange}{rgb}{1.000,0.400,0.000}
\definecolor{MediumOrchid}{rgb}{0.730,0.332,0.828}
\definecolor{MediumPurple}{rgb}{0.576,0.440,0.860}
\definecolor{MediumSeaGreen}{rgb}{0.235,0.700,0.444}
\definecolor{MediumSlateBlue}{rgb}{0.484,0.408,0.932}
\definecolor{MediumSpringGreen}{rgb}{0.000,0.980,0.604}
\definecolor{MediumTurquoise}{rgb}{0.284,0.820,0.800}
\definecolor{MediumVioletRed}{rgb}{0.780,0.084,0.520}
\definecolor{YellowGreen}{rgb}{0.800,0.800,0.000}
\definecolor{MidnightBlue}{rgb}{0.098,0.098,0.440}
\definecolor{MintCream}{rgb}{0.960,1.000,0.980}
\definecolor{MistyRose}{rgb}{1.000,0.894,0.884}
\definecolor{Moccasin}{rgb}{1.000,0.894,0.710}
\definecolor{MustardSeed}{rgb}{0.800,0.600,0.000}
\definecolor{NavajoWhite}{rgb}{1.000,0.870,0.680}
\definecolor{Navy}{rgb}{0.000,0.000,0.500}
\definecolor{OldLace}{rgb}{0.992,0.960,0.900}
\definecolor{Olive}{rgb}{0.500,0.500,0.000}
\definecolor{OliveDrab}{rgb}{0.420,0.556,0.136}
\definecolor{Orange}{rgb}{1.000,0.648,0.000}
\definecolor{OrangeRed}{rgb}{1.000,0.270,0.000}
\definecolor{Orchid}{rgb}{0.855,0.440,0.840}
\definecolor{PaleGoldenrod}{rgb}{0.932,0.910,0.668}
\definecolor{PaleGreen}{rgb}{0.596,0.985,0.596}
\definecolor{PaleTurquoise}{rgb}{0.688,0.932,0.932}
\definecolor{PaleVioletRed}{rgb}{0.860,0.440,0.576}
\definecolor{PapayaWhip}{rgb}{1.000,0.936,0.835}
\definecolor{PeachPuff}{rgb}{1.000,0.855,0.725}
\definecolor{Periwinkle}{rgb}{0.600,0.000,1.000}
\definecolor{Peru}{rgb}{0.804,0.520,0.248}
\definecolor{Pink}{rgb}{1.000,0.752,0.796}
\definecolor{Plum}{rgb}{0.868,0.628,0.868}
\definecolor{PowderBlue}{rgb}{0.690,0.880,0.900}
\definecolor{Pumpkin}{rgb}{1.000,0.600,0.200}
\definecolor{Purple}{rgb}{0.500,0.000,0.500}
\definecolor{PurpleBlue}{rgb}{0.400,0.200,0.800}
\definecolor{PurpleGray}{rgb}{0.600,0.600,0.800}
\definecolor{Red}{rgb}{1.000,0.000,0.000}
\definecolor{RedBrown}{rgb}{0.800,0.400,0.200}
\definecolor{RedOrange}{rgb}{0.800,0.200,0.000}
\definecolor{Rose}{rgb}{1.000,0.400,0.600}
\definecolor{RosyBrown}{rgb}{0.736,0.560,0.560}
\definecolor{RoyalBlue}{rgb}{0.255,0.410,0.884}
\definecolor{RoyalPurple}{rgb}{0.400,0.000,0.600}
\definecolor{SaddleBrown}{rgb}{0.545,0.270,0.075}
\definecolor{LightChartreuse}{rgb}{0.800,1.000,0.400}
\definecolor{Saffron}{rgb}{1.000,0.800,0.000}
\definecolor{Salmon}{rgb}{0.980,0.500,0.448}
\definecolor{SalmonRed}{rgb}{1.000,0.400,0.400}
\definecolor{SandyBrown}{rgb}{0.956,0.644,0.376}
\definecolor{SeaGreen}{rgb}{0.180,0.545,0.340}
\definecolor{Seashell}{rgb}{1.000,0.960,0.932}
\definecolor{Sienna}{rgb}{0.628,0.320,0.176}
\definecolor{Silver}{rgb}{0.752,0.752,0.752}
\definecolor{SkyBlue}{rgb}{0.530,0.808,0.920}
\definecolor{SlateBlue}{rgb}{0.415,0.352,0.804}
\definecolor{SlateGray}{rgb}{0.440,0.500,0.565}
\definecolor{SlateGrey}{rgb}{0.440,0.500,0.565}
\definecolor{Smoke}{rgb}{0.950,0.950,0.950}
\definecolor{Snow}{rgb}{1.000,0.980,0.980}
\definecolor{SoftYellow}{rgb}{1.000,1.000,0.400}
\definecolor{SpringGreen}{rgb}{0.000,1.000,0.498}
\definecolor{SteelBlue}{rgb}{0.275,0.510,0.705}
\definecolor{Tan}{rgb}{0.824,0.705,0.550}
\definecolor{Teal}{rgb}{0.000,0.500,0.500}
\definecolor{Thistle}{rgb}{0.848,0.750,0.848}
\definecolor{Tomato}{rgb}{1.000,0.390,0.280}
\definecolor{Turquoise}{rgb}{0.250,0.880,0.815}
\definecolor{Violet}{rgb}{0.932,0.510,0.932}
\definecolor{WarmGray}{rgb}{0.678,0.660,0.562}
\definecolor{Wheat}{rgb}{0.960,0.870,0.700}
\definecolor{White}{rgb}{1.000,1.000,1.000}
\definecolor{WhiteSmoke}{rgb}{0.970,0.970,0.970}
\definecolor{Yellow}{rgb}{1.000,1.000,0.000}
\definecolor{AliceBlue}{rgb}{0.940,0.972,1.000}
\definecolor{AntiqueWhite}{rgb}{0.980,0.920,0.844}
\definecolor{Aqua}{rgb}{0.000,1.000,1.000}
\definecolor{Aquamarine}{rgb}{0.498,1.000,0.830}
\definecolor{Avocado}{rgb}{0.600,0.600,0.000}
\definecolor{Azure}{rgb}{0.940,1.000,1.000}
\definecolor{Beige}{rgb}{0.960,0.960,0.864}
\definecolor{Bisque}{rgb}{1.000,0.894,0.770}
\definecolor{Black}{rgb}{0.000,0.000,0.000}
\definecolor{BlanchedAlmond}{rgb}{1.000,0.920,0.804}
\definecolor{Blue}{rgb}{0.000,0.000,1.000}
\definecolor{BlueGreen}{rgb}{0.000,0.600,0.400}
\definecolor{BlueViolet}{rgb}{0.540,0.170,0.888}
\definecolor{BrickRed}{rgb}{0.645,0.000,0.129}
\definecolor{BrightBlue}{rgb}{0.000,0.400,1.000}
\definecolor{BrightPink}{rgb}{1.000,0.400,0.800}
\definecolor{Brown}{rgb}{0.648,0.165,0.165}
\definecolor{Burgundy}{rgb}{0.600,0.000,0.200}
\definecolor{BurlyWood}{rgb}{0.870,0.720,0.530}
\definecolor{CadetBlue}{rgb}{0.372,0.620,0.628}
\definecolor{Cement}{rgb}{0.800,0.800,0.600}
\definecolor{Chartreuse}{rgb}{0.498,1.000,0.000}
\definecolor{Chiffon}{rgb}{0.980,0.980,0.824}
\definecolor{Chocolate}{rgb}{0.824,0.410,0.116}
\definecolor{Coral}{rgb}{1.000,0.498,0.312}
\definecolor{CornflowerBlue}{rgb}{0.392,0.585,0.930}
\definecolor{Cornsilk}{rgb}{1.000,0.972,0.864}
\definecolor{Crimson}{rgb}{0.800,0.000,0.200}
\definecolor{Cyan}{rgb}{0.000,1.000,1.000}
\definecolor{DarkBlue}{rgb}{0.000,0.000,0.545}
\definecolor{DarkChocolate}{rgb}{0.400,0.200,0.000}
\definecolor{DarkCyan}{rgb}{0.000,0.545,0.545}
\definecolor{DarkGoldenrod}{rgb}{0.720,0.525,0.044}
\definecolor{DarkGray}{rgb}{0.664,0.664,0.664}
\definecolor{DarkGreen}{rgb}{0.000,0.392,0.000}
\definecolor{DarkGrey}{rgb}{0.664,0.664,0.664}
\definecolor{DarkKhaki}{rgb}{0.740,0.716,0.420}
\definecolor{DarkLavender}{rgb}{0.400,0.200,0.600}
\definecolor{DarkMagenta}{rgb}{0.545,0.000,0.545}
\definecolor{DarkOliveGreen}{rgb}{0.332,0.420,0.185}
\definecolor{DarkOrange}{rgb}{1.000,0.550,0.000}
\definecolor{DarkOrchid}{rgb}{0.600,0.196,0.800}
\definecolor{DarkPeriwinkle}{rgb}{0.400,0.400,1.000}
\definecolor{DarkPurpleBlue}{rgb}{0.400,0.000,0.800}
\definecolor{DarkRed}{rgb}{0.545,0.000,0.000}
\definecolor{DarkRoyalBlue}{rgb}{0.000,0.200,0.800}
\definecolor{DarkSalmon}{rgb}{0.912,0.590,0.480}
\definecolor{DarkSeaGreen}{rgb}{0.560,0.736,0.560}
\definecolor{DarkSlateBlue}{rgb}{0.284,0.240,0.545}
\definecolor{DarkSlateGray}{rgb}{0.185,0.310,0.310}
\definecolor{DarkSlateGrey}{rgb}{0.185,0.310,0.310}
\definecolor{DarkSmoke}{rgb}{0.920,0.920,0.920}
\definecolor{DarkTurquoise}{rgb}{0.000,0.808,0.820}
\definecolor{DarkViolet}{rgb}{0.580,0.000,0.828}
\definecolor{DeepPink}{rgb}{1.000,0.080,0.576}
\definecolor{DeepSkyBlue}{rgb}{0.000,0.750,1.000}
\definecolor{DimGray}{rgb}{0.410,0.410,0.410}
\definecolor{DimGrey}{rgb}{0.410,0.410,0.410}
\definecolor{DodgerBlue}{rgb}{0.116,0.565,1.000}
\definecolor{FireBrick}{rgb}{0.698,0.132,0.132}
