next up previous contents index
Next: 5.6.4 Postscript by Using Up: 5.6 Printing and Inserting LATEX Previous: 5.6.2 Creating a Postscript

5.6.3 Including a Postscript File in LATEX

The Blatexpr Unix shell and the programs Batexpr2 and Blatexprs are provided in order to help inserting Scilab graphics in LATEX.

Taking the previous file and typing the following statement under a Unix shell :

Blatexpr 1.0 1.0
creates two files foo.epsf and foo.tex. The original Postscript file is left unchanged. To include the figure in a LATEX  document you should insert the following LATEX  code in your LATEX  document :

\input foo.tex
\dessin{The caption of your picture}{The-label}

You can also see your figure by using the Postscript previewer ghostview.

The program Blatexprs does the same thing: it is used to insert a set of Postscript figures in one LATEXpicture.

In the following example, we begin by using the Postscript driver Pos and then initialize successively 4 Postscript files, ..., for 4 different plots and at the end return to the driver Rec (X11 driver with record).

-->//multiple Postscript files for Latex
-->title=['plot3d and contour '];
-->xtitle(title,' ',' ');

Then we execute the command :

  Blatexprs multi

and we get 2 files multi.tex and and you can include the result in a LATEX  source file by :

\input multi.tex
\dessin{The caption of your picture}{The-label}

Note that the second line dessin... is absolutely necessary and you have of course to give the absolute path for the input file if you are working in another directory (see below). The file multi.tex is only the definition of the command dessin with 2 parameters : the caption and the label; the command dessin can be used with one or two empty arguments `` `` if you want to avoid the caption or the label.

The Postscipt files are inserted in LATEX  with the help of the \special command and with a syntax that works with the dvips program.

The program Blatexpr2 is used when you want two pictures side by side.

  Blatexpr2 Fileres

Figure 5.14: Blatexp2 Example

It is sometimes convenient to have a main LATEX  document in a directory and to store all the figures in a subdirectory. The proper way to insert a picture file in the main document, when the picture is stored in the subdirectory figures, is the following :

\def\Figdir{figures/} % My figures are in the {\tt figures/ } subdirectory.
\dessin{The caption of you picture}{The-label}

The declaration \def\Figdir{figures/} is used twice, first to find the file fig.tex (when you use latex), and second to produce a correct pathname for the special LATEX  command found in fig.tex. (used at dvips level).

-WARNING : the default driver is Rec, i.e. all the graphic commands are recorded, one record corresponding to one window. The xbasc() command erases the plot on the active window and all the records corresponding to this window. The clear button has the same effect; the xclear command erases the plot but the record is preserved. So you almost never need to use the xbasc() or clear commands. If you use such a command and if you re-do a plot you may have a surprising result (if you forget that the environment is wiped out); the scale only is preserved and so you may have the ``window-plot'' and the ``paper-plot'' completely different.

next up previous contents index
Next: 5.6.4 Postscript by Using Up: 5.6 Printing and Inserting LATEX Previous: 5.6.2 Creating a Postscript
Scilab Group