### 12.2 The texgraph environment

Once declared with: \usepackage{texgraph}, the following environment can be used:

\begin{texgraph}[<options>]
<TeXgraph code>
\end{texgraph}

At the compilation stage, the code is copied in a file named <name>.teg (TeXgraph source file) as a User graphical element (by default), then the program TeXgraphCmd is called, it loads the file <nom>.teg, exports the results in the asked format, and finally, the LATEX compiler gets the hand and the resulting file is loaded with \input or \includegraphics according to the requested export.

To be fully precise, this is a script that is called: CmdTeXgraph.

Possible options are:

• name = < name >: give a name to the image (without extension), this is by default the current file name followed by the order of appearance in the environment (file1, file2, ...). That parameter must be given at first place if not omitted
• export = < none/pst/pgf/tkz/eps/psf/pdf/epsc/pdfc/teg/texsrc >: That parameter can take the following values: none (no file is exported), pst (pstricks, default option), pgf , tkz (pgf code in a tikzpicture environment thus allowing to add tikz intructions), eps, psf (eps+psfrag), pdf , epsc (compiled eps), pdfc (compiled pdf), teg (texgraph source file) or texsrc (coloured texgraph source file for TEX). The export type is automatically determined and also the inclusion mode (input or includegraphics or nothing).
• call = < true/false >: that boolean is by default true. It shows if TeXgraph is really called, if not, the TeXgraph code is ignored, thus avoiding useless calls in case of multiple compilations, the image file is though included, according to the parameter auto. If call value is true, a <fichier>.teg file is created, compiled using TeXgraphCmd that is then exporting an image file and a log file.
• auto = < true/false >: that boolean is true by default, it shows if the image file has to be automatically included using macros “input” or “includegraphics”. If not, the image file is not loaded. If this option is not omitted, that option has to be put after the export option.
• commandchars = < true/false >: that boolean is false by default. If its value is true, the environment can contain TEX commands but the $\$ before each command has to be replaced by # , eg: #command{...}. If that command is containing macros that must to be not developed, they will be preceeded by \noexpand.
• src = < true/false >: that boolean is false by default, If the value is true, TeXgraph will export, added to the graphic, the source file coloured for TEX (file with the extension src), and this is the source file that is included, replacing the environment, like in all the examples that can be seen in this document. All the colors are predefined in the file texgraph.sty and can be changed by the user in his document. Here are the definitions:
\newcommand*{\TegSrcFontSize}{small}%font size
\definecolor{TegIdentifier}{rgb}{0.5451,0.2706,0.0745}%
\definecolor{TegComment}{rgb}{0.502,0.502,0.502}%
\definecolor{TegNumeric}{rgb}{0.0000,0.5020,0.5020}%
\definecolor{TegConstant}{rgb}{0.5020,0.5020,0.0000}%
\definecolor{TegString}{rgb}{0,0,1}%
\definecolor{TegSymbol}{rgb}{1,0,0}%
\definecolor{TegKeyWord}{rgb}{0,0,0}%
\definecolor{TegVarGlob}{rgb}{0.0000,0.0000,0.5020}%
\definecolor{TegMacUser}{rgb}{0.5020,0.0000,0.5020}%
\definecolor{TegVarPredef}{rgb}{0.0000,0.3922,0.0000}%
\definecolor{TegMacPredef}{rgb}{0.5020,0.0000,0.0000}%
\definecolor{TegParam}{rgb}{1.0000,0.0000,1.0000}%
\definecolor{TegGraphElem}{rgb}{0.4392,0.5020,0.5647}%

• file = < true/false >: that boolean is false by default, it shows if the inside of the environment is a full TeXgraph source file (file=true), or only a User graphical element (file=false).
• preload = < {"<file1>";"<file2>";...} >: load one or several packages before creating the graphic, eg:
• cmdi = < command >: import the graphic within the command, eg: cmdi={\raisebox{-2cm}}
• cmdii = < command >: applies a second command over the first one(cmdi).
The package provides three global options:
• nocall: that options redefines the default value of the option call to the value false, then texgraph environments will call the program TeXgraphCmd only if the option call (or call=true) is mentioned.
• src: changes the default value of the option src and set it to the value true for all the texgraph environments.
• export = < pst/pgf/tkz/eps/psf/pdf/epsc/pdfc >: that option redefines the default export.
• server: that option is allowing TeXgraph to be launched in server mode, and close the program at the end of the compilation. Then the program is executed only once for the whole document.

Exemples: \usepackage[nocall]{texgraph} or \usepackage[export=pgf,server]{texgraph}.

WARNING

• Commands related to the graphic interface (the mouse, the menu, buttons, items, the timer, ...) are ignored.
• When a line is starting with a comment between braces an error will occur if the option commandchars is activated. Though, beginning a line with a comment is done like the following: //blablabla (The whole line is then a comment).