^
2" will write x-squared as we are used to seeing it, with a superscript 2. This mode is selected by default when you set the terminal, but may be toggled afterward using "set termoption [no]enhanced", or by marking individual strings as in "set label 'x_2' noenhanced". Enhanced Text Control Codes | |||
Control | Example | Result | Explanation |
^ | a^x | ax | superscript |
_ | a_x | ax | subscript |
@ | a@^b_{cd} | abcd | phantom box (occupies no width) |
& | d&{space}b | db | inserts space of specified length |
~ | ~a{.8-} | 2#2 | overprints '-' on 'a', raised by .8 |
times the current fontsize | |||
{/Times abc} | abc | print abc in font Times at current size | |
{/Times*2 abc} | abc | print abc in font Times at twice current size | |
{/Times:Italic abc} | abc | print abc in font Times with style italic | |
{/Arial:Bold=20 abc} | abc | print abc in boldface Arial font size 20 |
The markup control characers act on the following single character or bracketed clause. The bracketed clause may contain a string of characters with no additional markup, e.g. 2^
{10}, or it may contain additional markup that changes font properties. Font specifiers MUST be preceded by a '/' character that immediately follows the opening '{'. If a font name contains spaces it must be enclosed in single or double quotes.
Examples: The first example illustrates nesting one bracketed clause inside another to produce a boldface A with an italic subscript i, all in the current font. If the clause introduced by :Normal were omitted the subscript would be both italic and boldface. The second example illustrates the same markup applied to font "Times New Roman" at 20 point size.
{/:Bold A_{/:Normal{/:Italic i}}} {/"Times New Roman":Bold=20 A_{/:Normal{/:Italic i}}}
The phantom box is useful for a@^
b_c to align superscripts and subscripts but does not work well for overwriting an accent on a letter. For the latter, it is much better to use an encoding (e.g. iso_8859_1 or utf8) that contains a large variety of letters with accents or other diacritical marks. See set encoding. Since the box is non-spacing, it is sensible to put the shorter of the subscript or superscript in the box (that is, after the @).
Space equal in length to a string can be inserted using the '&' character. Thus
'abc&{def}ghi'would produce
'abc ghi'.
The '~ ' character causes the next character or bracketed text to be overprinted by the following character or bracketed text. The second text will be horizontally centered on the first. Thus '~ a/' will result in an 'a' with a slash through it. You can also shift the second text vertically by preceding the second text with a number, which will define the fraction of the current fontsize by which the text will be raised or lowered. In this case the number and text must be enclosed in brackets because more than one character is necessary. If the overprinted text begins with a number, put a space between the vertical offset and the text ('~ {abc}{.5 000}'); otherwise no space is needed ('~ {abc}{.5 — }'). You can change the font for one or both strings ('~ a{.5 /*.2 o}' — an 'a' with a one-fifth-size 'o' on top — and the space between the number and the slash is necessary), but you can't change it after the beginning of the string. Neither can you use any other special syntax within either string. You can, of course, use control characters by escaping them (see below), such as '~ a{ \^
}'
You can specify special symbols numerically by giving a character code in octal, e.g. {/Symbol \245} is the symbol for infinity in the Adobe Symbol font. This does not work for multibyte encodings like UTF-8, however. In a UTF-8 environment, you should be able to enter multibyte sequences implicitly by typing or otherwise selecting the character you want.
You can escape control characters using \, e.g., \ \, \{, and so on.
Note that strings in double-quotes are parsed differently than those enclosed in single-quotes. The major difference is that backslashes may need to be doubled when in double-quoted strings.
The file "ps_guide.ps" in the /docs/psdoc subdirectory of the gnuplot source distribution contains more examples of the enhanced syntax, as does the demo enhanced_utf8.dem
Copyright 1986 - 1993, 1998, 2004 Thomas Williams, Colin Kelley
Distributed under the gnuplot license (rights to distribute modified versions are withheld).