An ePiX input file is really source code for a C program that writes an .eepic file as output. If you do not speak C, the main things to remember (principally differences between LATEX and C syntaxes) are:
/*
and */
. One-line comments, similar to LATEX comments, are begun with //
(analogous to the LATEX %
)
and end with the next newline. A //
-style comment may appear
within a multiline comment, but a /*
*/
comment may not;
the C compiler will mistake the first */
it encounters as the
end of the current multiline comment.
Lines that begin with #include
or #define
are C
pre-processor directives, and do not end with a semicolon.
\
is an escape character
in C. To print a \
from C, you must use \\
, as in
/* Put label $y=\sin x$ at (2,1) */ /* Note single ^ backslash in output */ label(P(2,1), P(0,0), "$y=\\sin x$"); /* Double backslash ^^ in source */
*
to denote multiplication;
simple juxtaposition is not enough. C does not support the use of
^
for exponentiation, e.g., t^2
is invalid. Instead, you
must use t*t
or pow(t,2)
.
auto | double | int | struct |
break | else | long | switch |
case | enum | register | typedef |
char | extern | return | union |
const | float | short | unsigned |
continue | for | signed | void |
default | goto | sizeof | volatile |
do | if | static | while |
In addition, ePiX reserves the following variables:
x_min |
x_max |
y_min |
y_max |
h_size |
v_size |
h_offset |
v_offset |
x_size |
y_size |
pic_size |
pic_unit |
C is case-sensitive, so capitalized variants are valid (but discouraged).
The aspect ratio of the figure is controlled by adjusting the LATEX size of the figure and its Cartesian bounding box. The following length units may be used: cm, in, mm, pc, and pt. (One pica equals 12 pt.) Font-dependent units em and ex, and ``exotic'' units (Didot points, Ciceros, etc.) are not recognized. See lengths.cc to add support for other length units.
Aside from #include
and #define
statements, and variable
declarations, the preamble consists of function definitions, for
plotting functions you have specified. Functions may not be defined
inside other functions; in particular, all definitions of
user-specified functions must come in the preamble, before the
call to main.
C knows the following functions of one variable by name:
sqrt | sin | sinh | asin |
ceil | cos | cosh | acos |
floor | tan | tanh | atan |
exp | log | log10 | fabs (abs val) |
pow(x,y)
returns atan2(y,x)
returns
M_PI
, M_PI_2
,
and M_E
for
The GNU C library defines many other functions, including inverse
hyperbolic functions, log and exp with base 2, 10, or arbitrary ,
the error and gamma functions, and Bessel functions of first and
second kind.
You may use known functions in subsequent definitions. Functions of two (or more) variables are defined in direct analogy to functions of one variable:
double f(double t) { return t*t*log(t*t); // t^2 \ln(t^2) } double g(double s, double t) { return exp(2*s)*cosh(sin(M_PI*t)); }