Epslatex

The epslatex driver generates output for further processing by LaTeX.

Syntax:

     set terminal epslatex   {default}
     set terminal epslatex   {standalone | input}
                             {oldstyle | newstyle}
                             {level1 | leveldefault | level3}
                             {color | colour | monochrome}
                             {background <rgbcolor> | nobackground}
                             {dashlength | dl <DL>}
                             {linewidth | lw <LW>} {pointscale | ps <PS>}
                             {rounded | butt}
                             {clip | noclip}
                             {palfuncparam <samples>{,<maxdeviation>}}
                             {size <XX>{unit},<YY>{unit}}
                             {header <header> | noheader}
                             {blacktext | colortext | colourtext}
                             {{font} "fontname{,fontsize}" {<fontsize>}}
                             {fontscale <scale>}

The epslatex terminal prints a plot as terminal postscript eps but transfers the texts to LaTeX instead of including in the PostScript code. Thus, many options are the same as in the postscript terminal.

The appearance of the epslatex terminal changed between versions 4.0 and 4.2 to reach better consistency with the postscript terminal: The plot size has been changed from 5 x 3 inches to 5 x 3.5 inches; the character width is now estimated to be 60% of the font size while the old epslatex terminal used 50%; now, the larger number of postscript linetypes and symbols are used. To reach an appearance that is nearly identical to the old one specify the option oldstyle. (In fact some small differences remain: the symbol sizes are slightly different, the tics are half as large as in the old terminal which can be changed using set tics scale, and the arrows have all features as in the postscript terminal.)

If you see the error message

     "Can't find PostScript prologue file ... "
Please see and follow the instructions in postscript prologue (p. [*]).

The option color enables color, while monochrome prefers black and white drawing elements. Further, monochrome uses gray palette but it does not change color of objects specified with an explicit colorspec. dashlength or dl scales the length of dashed-line segments by 4#4DL5#5, which is a floating-point number greater than zero. linewidth or lw scales all linewidths by 4#4LW5#5.

By default the generated PostScript code uses language features that were introduced in PostScript Level 2, notably filters and pattern-fill of irregular objects such as filledcurves. PostScript Level 2 features are conditionally protected so that PostScript Level 1 interpreters do not issue errors but, rather, display a message or a PostScript Level 1 approximation. The level1 option substitutes PostScript Level 1 approximations of these features and uses no PostScript Level 2 code. This may be required by some old printers and old versions of Adobe Illustrator. The flag level1 can be toggled later by editing a single line in the PostScript output file to force PostScript Level 1 interpretation. In the case of files containing level 2 code, the above features will not appear or will be replaced by a note when this flag is set or when the interpreting program does not indicate that it understands level 2 PostScript or higher. The flag level3 enables PNG encoding for bitmapped images, which can reduce the output size considerably.

rounded sets line caps and line joins to be rounded; butt is the default, butt caps and mitered joins.

clip tells PostScript to clip all output to the bounding box; noclip is the default.

palfuncparam controls how set palette functions are encoded as gradients in the output. Analytic color component functions (set via set palette functions) are encoded as linear interpolated gradients in the postscript output: The color component functions are sampled at 4#4samples5#5 points and all points are removed from this gradient which can be removed without changing the resulting colors by more than 4#4maxdeviation5#5. For almost every useful palette you may safely leave the defaults of 4#4samples5#5=2000 and 4#4maxdeviation5#5=0.003 untouched.

The default size for postscript output is 10 inches x 7 inches. The default for eps output is 5 x 3.5 inches. The size option changes this to whatever the user requests. By default the X and Y sizes are taken to be in inches, but other units are possibly (currently only cm). The BoundingBox of the plot is correctly adjusted to contain the resized image. Screen coordinates always run from 0.0 to 1.0 along the full length of the plot edges as specified by the size option. NB: this is a change from the previously recommended method of using the set size command prior to setting the terminal type. The old method left the BoundingBox unchanged and screen coordinates did not correspond to the actual limits of the plot.

blacktext forces all text to be written in black even in color mode;

The epslatex driver offers a special way of controlling text positioning: (a) If any text string begins with '{', you also need to include a '}' at the end of the text, and the whole text will be centered both horizontally and vertically by LaTeX. (b) If the text string begins with '[', you need to continue it with: a position specification (up to two out of t,b,l,r,c), ']{', the text itself, and finally, '}'. The text itself may be anything LaTeX can typeset as an LR-box. 2#2rule{}{}'s may help for best positioning. See also the documentation for the pslatex (p. [*]) terminal driver. To create multiline labels, use 2#2shortstack, for example

  set ylabel '[r]{\shortstack{first line \\ second line}}'

The back option of set label commands is handled slightly different than in other terminals. Labels using 'back' are printed behind all other elements of the plot while labels using 'front' are printed above everything else.

The driver produces two different files, one for the eps part of the figure and one for the LaTeX part. The name of the LaTeX file is taken from the set output command. The name of the eps file is derived by replacing the file extension (normally .tex) with .eps instead. There is no LaTeX output if no output file is given! Remember to close the output file before next plot unless in multiplot mode.

In your LaTeX documents use '2#2input{filename}' to include the figure. The .eps file is included by the command 2#2includegraphics{...}, so you must also include 2#2usepackage{graphicx} in the LaTeX preamble. If you want to use coloured text (option textcolour) you also have to include 2#2usepackage{color} in the LaTeX preamble.

Pdf files can be made from the eps file using 'epstopdf'. If the graphics package is properly configured, the LaTeX files can also be processed by pdflatex without changes, using the pdf files instead of the eps files. The behaviour concerning font selection depends on the header mode. In all cases, the given font size is used for the calculation of proper spacing. When not using the standalone mode the actual LaTeX font and font size at the point of inclusion is taken, so use LaTeX commands for changing fonts. If you use e.g. 12pt as font size for your LaTeX document, use '"" 12' as options. The font name is ignored. If using standalone the given font and font size are used, see below for a detailed description.

If text is printed coloured is controlled by the TeX booleans 2#2ifGPcolor and 2#2ifGPblacktext. Only if 2#2ifGPcolor is true and 2#2ifGPblacktext is false, text is printed coloured. You may either change them in the generated TeX file or provide them globally in your TeX file, for example by using

  \newif\ifGPblacktext
  \GPblacktexttrue
in the preamble of your document. The local assignment is only done if no global value is given.

When using the epslatex terminal give the name of the TeX file in the set output command including the file extension (normally ".tex"). The eps filename is generated by replacing the extension by ".eps".

If using the standalone mode a complete LaTeX header is added to the LaTeX file; and "-inc" is added to the filename of the eps file. The standalone mode generates a TeX file that produces output with the correct size when using dvips, pdfTeX, or VTeX. The default, input, generates a file that has to be included into a LaTeX document using the 2#2input command.

If a font other than "" or "default" is given it is interpreted as LaTeX font name. It contains up to three parts, separated by a comma: 'fontname,fontseries,fontshape'. If the default fontshape or fontseries are requested, they can be omitted. Thus, the real syntax for the fontname is '[fontname][,fontseries][,fontshape]'. The naming convention for all parts is given by the LaTeX font scheme. The fontname is 3 to 4 characters long and is built as follows: One character for the font vendor, two characters for the name of the font, and optionally one additional character for special fonts, e.g., 'j' for fonts with old-style numerals or 'x' for expert fonts. The names of many fonts is described in http://www.tug.org/fontname/fontname.pdfhttp://www.tug.org/fontname/fontname.pdf

For example, 'cmr' stands for Computer Modern Roman, 'ptm' for Times-Roman, and 'phv' for Helvetica. The font series denotes the thickness of the glyphs, in most cases 'm' for normal ("medium") and 'bx' or 'b' for bold fonts. The font shape is 'n' for upright, 'it' for italics, 'sl' for slanted, or 'sc' for small caps, in general. Some fonts may provide different font series or shapes.

Examples:

Use Times-Roman boldface (with the same shape as in the surrounding text):

     set terminal epslatex 'ptm,bx'
Use Helvetica, boldface, italics:
     set terminal epslatex 'phv,bx,it'
Continue to use the surrounding font in slanted shape:
     set terminal epslatex ',,sl'
Use small capitals:
     set terminal epslatex ',,sc'

By this method, only text fonts are changed. If you also want to change the math fonts you have to use the "gnuplot.cfg" file or the header option, described below.

In standalone mode, the font size is taken from the given font size in the set terminal command. To be able to use a specified font size, a file "size4#4size5#5.clo" has to reside in the LaTeX search path. By default, 10pt, 11pt, and 12pt are supported. If the package "extsizes" is installed, 8pt, 9pt, 14pt, 17pt, and 20pt are added.

The header option takes a string as argument. This string is written into the generated LaTeX file. If using the standalone mode, it is written into the preamble, directly before the 2#2begin{document} command. In the input mode, it is placed directly after the 2#2begingroup command to ensure that all settings are local to the plot.

Examples:

Use T1 fontencoding, change the text and math font to Times-Roman as well as the sans-serif font to Helvetica:

   set terminal epslatex standalone header \
   "\\usepackage[T1]{fontenc}\n\\usepackage{mathptmx}\n\\usepackage{helvet}"
Use a boldface font in the plot, not influencing the text outside the plot:
   set terminal epslatex input header "\\bfseries"

If the file "gnuplot.cfg" is found by LaTeX it is input in the preamble the LaTeX document, when using standalone mode. It can be used for further settings, e.g., changing the document font to Times-Roman, Helvetica, and Courier, including math fonts (handled by "mathptmx.sty"):

     \usepackage{mathptmx}
     \usepackage[scaled=0.92]{helvet}
     \usepackage{courier}
The file "gnuplot.cfg" is loaded before the header information given by the header command. Thus, you can use header to overwrite some of settings performed using "gnuplot.cfg"