Prev: printer.html Up Next: video.html
Multi-page PostScript and PDF (mpps, mppdf) terminals

Practical Guide: In these examples and documentation, mpps can be substituted everywhere by mppdf, in which case a multi-page pdf file is produced instead, and not a postscript file.
mpps out("");
mpps.papersize("a3");      // set larger papersize instead of default a4

plot(...);                 // plot something 
out.print();               // and print this figure to the output terminal

plot(...);                 // plot  something else  
out.print("height=18cm");  // and print this to the file,  also specifying the optional arguments to the \blopeps latex-macro

out.options("height=10cm,width=10cm");  // from  now  on, all  figures will be printed with these options,
                                        // unless explicitely specified by the argument of  the 'print(...)'  function 
out.print();               // this figure will be printed  in 10x10 cm size 

out.flush();               // flush it (.. compile with latex; file remains open)

out.close();               // flush and close the file (also compile with  latex) 
                           // now you can reuse this variable, via the open("filename")

If you want to put several figures into a multi-page postscript(PDF) file, then the mpps(mppdf) terminal is your right choice. It is nothing else than a .tex file. When a figure is printed to this terminal, a separate blopeps file is created, and automatically included into this LaTeX document (using the \blopeps macro). This way it can accomodate several figures. It is automatically compiled by latex if you call the flush() function of it, or when you call close(), or when its destructor is called.

You can initialize it with a filename (this will be the final postscript/PDF file):
mpps out("")
or if you want to postpone the specification of the filename, you can use the open member function:
mpps out;"");

The current canvas can be printed to it using the print member function of mpps. This print(...) function has an optional argument, which specifies the optional arguments to be given to the \blopeps macro when including this figure. In the following example the first figure (containing a sine) is included with the default settings, for the second (containig a cosine) the linewidth and height of the figure is changed.

mpps out("");



system("gv &");

The mpps terminal is derived not only from blop::terminal, but also from std::ofstream, so you can also treat it as an output file (which is your LaTeX document source), and write directly to it. It automatically writes a default LaTeX document header (beginning from \documentclass{article} up to \begin{document}, and additionally also a \LARGE macro) into the file, but not before the first output of a figure into this terminal. This has the following consequences:

The mpps terminal has 3 verbosity levels (to be set via the verbose(int) member function):

Souce files:

Prev: printer.html Up Next: video.html