#### 9.1.3 Bsave(), Esave() and TegWrite() macros

the macro Bsave is automatically executed before the current graphic is exported, while the macro Esave is automatically executed after the current graphic is exported.

Those two macros are more likely to be used within the macro files because we have to take count of its existence before redefening them. In fact, they are already defined in the file TeXgraph.mac. The first is only calling the macro UserBsave(), the second calls UserEsave(). The two last do not exist, and can be created by the user in his source file.

The constant ExportMode shows the exporting mode, with the following constants: tex, pgf , tkz, pst, eps, psf , epsc, pdf , pdfc, svg or teg.

The TegWrite macro is a very particular one: It is never executed ! More precisely, at saving stage, it is successively saving:

• The window.
• The margins.
• $\theta$ and $\phi$ values (for the 3D).
• The global variables.
• The macro files to be loaded.
• The macros.
• The graphical elements.

Right before saving the global variables, it is tested if exists a macro called TegWrite. If yes, then the command defining the macro is stored in the saved file in the form of a command. Then, at opening of that file, this command will be executed before reading the global variables and all the rest of the code.