The blopeps terminal

What is blopeps?
This is blop's first implemented terminal, which was designed to be used in LaTeX documents. This is an encapsulated postscript-like file (hence the eps in its name). But looking at it as a postscript file (using a postscript-viewer, like gv) would make you cry: it looks terribly. The reason is simple: the preamble of this file contains LaTeX-commands (preceded by a % so that the postscript interpreters treat them as comments), which are read by LaTeX when this file is included in your document (this is done by the \blopeps LaTeX-macro provided by the blopeps.sty package coming with blop). These clever commands put PostScript commands into the final output file before the inclusion of the plot file itself (like dimensions of text labels, etc), which will therefore be available for the plot file. (This is the reason why the blopeps file looks horrible when looking at it standalone: these dimensions are not set by the LaTeX commands).

The print function
The blopeps class provides the static print(const var &filename) function, which prints the current canvas into a file specified by its argument:
plot("datafile",_1,_2*_3);
blopeps::print("output.beps");


You will practically never need to know more about this class, so I don't write it down now.

The \blopeps LaTeX-macro
Once the plotfile is produced (as shown above), the file can be included into a LaTeX document using the \blopeps macro proided by the blopeps.sty LaTeX-package. So don't forget to put into the preamble of your LaTeX-source:
\usepackage{blopeps}

The syntax of the \blopeps macro is: \blopeps[optargs]{filename}. Here optargs are optional (you can simply write: \blopeps{filename}), and specify the size and other geometrical parameters of the included figure. These optional args are:

width=<dimen> or pw=<dimen>
Defines the width of the included figure. If omitted, the width of the figure will be the default value, which can be set by the macro \bloppw, so if you want to set the default width of the figures, use this, for example: \bloppw{7cm}. This macro in fact simply sets \blopPW. That is, the two are equivalent:
\bloppw{7cm}
\def\blopPW{7cm}
This also means, that you can obtain the width of your current figure as a LaTeX dimension, in any text within your figure. For example:
text::fdraw("\\begin{minipage}{\\blopPW}\\begin{center} first line \\\\ second line\\end{center}\\end{minipage}", 0.2, 0.3);
Note that you have to write every backslash duplicated (blop's interface language is C++, and backslash has to be 'escaped' by a backslash)
height=<dimen> or ph=<dimen>
Defines the height of the included figure. If omitted, the height of the figure will be the default one, which can be set by the macro \blopph, so if you want to set the default height of the figures, say this, for example: \blopph{7cm}
ps=<dimen>
Defines the value of the PS unit within the figure (that is, all objects which are sized to the multiples of this unit, can be scaled at the time of the inclusion of the figure into the document. The symbols for drawing graphs have by default this size, so they can also be scaled this way. If this argument is omitted, the default value is used, which can be set with the macro \blopps. Use this if you want to change the default for the whole document, for example: \blopps{3mm}
lw=<dimen>
Defines the vale of the LW unit within the plot, which is the default width of all lines drawn in a plot (you can of course change the width of any line in your blop-script, but then it will not be possible to scale it at the time of the inclusion of the figure to the document). The default value is can be set with \bloplw.
text=text-to-be-shown
Defines an annotation text to be shown on top of the figure (If it contains a comma, or maybe spaces, surround it with { } ) This possibility serves to better separate the logical content of a figure from its role in the document. For example, when creating a plot, one should only be concerned about what quantity is plotted (and how), and not about its final position in a document. Later, when included in a document, as a sub-figure of a large figure, one may want to label this figure as the a) subfigure. If the figure's position is changed later (it is not subfigure a) anymore, but subfigure b), then the figure does not need to be recreated.
textpos={xcoord,ycoord}
Defines the position of the text annotation. The coordinates can be LaTeX dimens (like 1cm, etc), or a simple number without unit (where 0,0 refers to the lower left corner of the picture, 1,1 refers to the top right corner)
textalign=xx
Alignment of the annotation text. xx should be replaced by the following letters: l (for left), r (for right), c (for center), t (for top), b (for bottom)
lon=<num>
Switch on layer number <num>. By default, all objects and graphs are put to layer 1, and this is the only layer switched on. If some objects or graphs are on different layers, they will by default not be visible, unless one switches on those layers.

My suggestion is that you don't change the pointsize of your graphs (from the default PS), or if you need points of different size in a plot, use the multiples of PS. This way you can scale the size of points in all of your figures in your document with one single LaTeX commandat the beginning of the document. The same holds for lines: don't change the width of lines, or if you need lines of different widths, use multiples of LW.

The \blopcmd macro can be used to specify LaTeX commands, which should be called before inserting any figure. For example if you want that text in all of your figures be typeset with slanted font, and with a smaller fontsize, call at the beginning of your document:
\blopcmd{\sf\scriptsize}
Otherwise, if you want it to have an effect only for one figure, include it in the following way:

{\sf\scriptsize \blopeps{figure.beps}}


Picking figures from PostScript documents
You often want to pick a figure from a PostScript document. You can very easily do this with blop's figures as well: since they are included into the LaTeX/PostScript document as a PostScript file (with some extra bookkeeping, as explained above), simply load your PostScript file into a text editor, searh for the text Creator: blop (this is about the 3rd row in the blopeps file, look for a line like %!PS-Adobe-2.0 EPSF-2.0 somewhat above it). Now look for a line like %--EndOfFile--. The text between these two lines (inclusive) was the content of the blopeps file, which was included into the document. Copy this content to a separate file, and it is ready to be included into a new LaTeX document with the \blopeps macro.

Source files:
blopeps.h
blopeps.cc