EEPIC Extensions to epic and LaTEX Picture Environment Version 1.1

Conrad Kwok Department of Electrical Engineering and Computer Science University of California, Davis

Febrary 2, 1988

1 Introduction

LaTEX provides a basic but limited picture drawing capability. epic^{1} is an enhancement to the picture environment of LaTEX which provides a simpler and more powerful interface. It introduces new commands for drawing solid lines, dotted lines, dash lines and new environments suitable for plotting graphs.

However, epic still inherits many of the limitations of LaTEX in picture drawing and hence some of the functions either take a long time to accomplish or the output is not very nice looking.

tpic is preprocessor program for use with TEX. It uses a set of \specials graphics commands for drawing pictures. More and more DVI driver programs supports those specials. They are becoming a standard set of \specials for DVI files. However, the major disadvantage of tpic is that the tpic preprocessor itself is not readily available on most machines. It is written in yacc and C language. It is mainly for UNIX or similar system.

eepic, as an extension to both LaTEX and epic, tries to alleviate some of the limitations in LaTEX, epic and tpic by generating tpic specials using TEX commands instead of any preprocessor program, but at the same time provides compatibility with the original commands such that when a DVI driver which understands tpic specials are not available, the documents can still be formatted using standard LaTEX and epic. However, the output probably will not be as good as originally intended.

Currently, eepic extends LaTEX and epic in the following ways:

• Draws lines in any slopes.

• Draws circles and discs (filled circle) in any radii.

• Draws dotted lines and dash lines in a much faster way and requires much less TEX internal memory.

• Provides more line thickness options.

1epic is a LaTEX macro package written by Sunil Podar at S.U.N.Y at Stony Brook. Please read the section on installation for more information

Furthermore, eepic introduces several new commands for:

• drawing of ellipsis and filled ellipsis

• drawing of arcs

• drawing of splines (cubic splines using control points)

• drawing of polylines

All the affected commands in LaTEX and epic will be discussed in the subsequent sections. The compatibility issues will be described in the section 7.

In version 1.1, several bugs are fixed, and several commands for area filled are added.

2 Extension to LaTEX

In LaTEX, drawing of lines and circles are done using special fonts. Therefore only limited functions are provided. The extensions in eepic allow users to draw lines in any slope and to draw circles in any sizes. However, the limitation of slopes for vectors remains the same in the mean time. That is the slope that can be handled is \frac{x}{y} where x and y are integers in the range [−4, 4]. Please read LaTEX manual for details.

2.1 \line

The syntax of \line is the same as that in LaTEX:

     \line(x,y){length}

But now x and y can be any integer values within the limit of TEX. Furthermore, there is no more lower limit for length parameter.

2.2 \circle

The syntax of \circle is the same as that in LaTEX:

     \circle{diameter}

or

     \circle*{diameter}

But now the diameter parameter can be any number acceptable by TEX and a circle with the specified diameter (exactly) will be drawn.

2.3 \oval

The \oval command is changed such that the maximum diameter of the quarter circles at the corners can be set to any values. This is done by setting the variable \maxovaldiam to the desire TEX dimension. The default is 40pt.

3 Extension to EPIC

epic is an enhancement to the Picture Environment of LaTEX. epic generates standard DVI files and requires only standard LaTEX fonts. Some of the functions it provides are:

                       \multiputlist  \dottedline  \putfile
                       \matrixput     \dashline
                       \grid          \drawline

Details can be found in the epic manual.

Extensions to epic in eepic include better line drawing output, faster operation and less memory requirement. The commands affected are:

  1. \drawline
  2. \dashline
  3. \dottedline

And the three “*join” environments are indirectly affected also.

3.1 \drawline

The syntax of \drawline is:

\drawline[stretch](x_{1},y_{1})(x_{2},y_{2})… (x_{n},y_{n})

where stretch is an integer between −100 and infinity. However any number greater than 0 are the same. An negative stretch in \drawline will call \dashline.

The thickness of the line is affected by \thinlines, \thicklines and \Thicklines declarations. Horizontal and vertical lines are drawn using rules.

3.2 \dottedline

The syntax of \dottedline is:

\dottedline[dot character]{dotgap}(x_{1},y_{1})(x_{2},y_{2})… (x_{n},y_{n})

where dot character is the character used in drawing the “dotted” line. dotgap is the interdot gap in terms of \unitlength. \specials will only be generated if no optional dot character is specified.

The size of the dots are affected by \thinlines, \thicklines and \Thicklines declarations.

3.3 \dashline

The syntax of \dashline is:

\dashline[stretch]{dash-length}[inter-dot-gap](x_{1},y_{1})(x_{2},y_{2})… (x_{n},y_{n})

where stretch is an integer between −100 and infinity. If inter-dot-gap is not specified, dashes are drawn in solid lines, otherwise, dashes are drawn using dotted lines.

The thickness of the line is affected by \thinlines, \thicklines and \Thicklines declarations.

4 New Commands

eepic introduces a number of new commands. Except the \path commands, all other new commands do not have any equivalents in LaTEX and epic. Please read section 7 about the compatibility issues.

4.1 \allinethickness

Set the line thickness of all line drawing commands including lines in any slopes, circles, ellipsis, arcs, ovals and splines. Note there are only two ‘l’ in the command. The syntax is:

     \allinethickness{dimension}.
4.2 \Thicklines

The syntax is:

     \Thicklines

With the \Thicklines declaration, thickness of lines drawn will be about 1.5 times of \thicklines.

4.3 \path

\path is a fast version of \drawline. Optional stretch argument is not allowed and so it always draw solid lines. The syntax is:

\path(x_{1},y_{1})(x_{2},y_{2})… (x_{n},y_{n}) \path is mainly used in drawing complex paths.

4.4 \spline

Syntax of \spline is the same as \path.

     \spline(x_{1},y_{1})(x_{2},y_{2}). . . (x_{n},y_{n})

\spline draws an Chaikin’s curve which passes through only the first and last point. All other points are control points only.

4.5 \ellipse

The command \ellipse draws an ellipse by specifying the x-diameter and y-diameter.

\ellipse{x-diameter}{y-diameter} or

\ellipse*{x-diameter}{y-diameter} When x-diameter is equal to y-diameter, the command is equivalent to \circle or \circle*.

4.6 \arc

\arc draws an circular arc. The syntax is

\arc{diameter}{start-angle}{end-angle}

diameter is specified in \unitlength and both start-angle and end-angle are in radian. start-angle must be within 0 and 2π and end-angle can be any value between start-angle and start-angle + 2π. Arcs are drawn in clockwise direction with angle 0 pointing to the right on the paper.

4.7 \filltype{....}

The command specifies the type of area fill for \circle* and \ellipse*. The command itself does not draw anything. It only changes the interpretation of * in the two commands specified above. The syntax of the command is:

\filltype{area-fill-type}

The legal area fill type are:

• black (default)

• white

• shade

For example, to change area fill type to white fill, the following command should be used.

        \filltype{white}

These commands are only intended for advance users (those who know what they are doing). They are included mainly because fig2epic^{2} generate these commands. The commands are:

commands  Description

\blacken Black fill the next figure \whiten White fill the next figure \shade Shade the interior next figure \texture Specify the pattern used for the next shade command. The pat-

tern will remain effective until it is changed by another \texture command. The syntax is:

\texture{ 32 32-bit hexadecimal numbers}

An example (the default) is:

                       \texture{cccccccc 0 0 0 cccccccc 0 0 0
                                cccccccc 0 0 0 cccccccc 0 0 0
                                cccccccc 0 0 0 cccccccc 0 0 0
                                cccccccc 0 0 0 cccccccc 0 0 0}

2Another program written by me to convert Fig output file to eepic format.

The exact interpretation of the above commands are probably device driver dependent. I did most of tests using iptex (imagen1) and several tests using dvips. The description below may not apply to other device drivers.

The commands that can be specified after \blacken, \whiten and \shade include \path, \circle (without *), \ellipse (again without *) and \arc. The drawings do not have to be closed. The imagen printer will automatically draw an imaginary line from the starting point to the end point, and then fill the figure. When using iptex, the outline of the figures are drawn but not in dvips. In another words, when using iptex, the command:

     \shade\circle{10}

will draw a circle will the circumference in solid line and the interior is filled in the pattern active at that time. However, when using dvips, the circle will not have the circumference drawn in sold line.

5 Examples

I shamelessly stole two examples from the epic manual so that you can compare the results. The third and fourth examples are created by FIG and then converted to eepic using fig2epic which is also written by me.

5.1 Example 1

0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100  0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100

Figure 1: An example of Various Line Drawing Commands

5.2 Example 2

⊗ ⊗  ⊗ ⊗  ^{(60,3)}^{(-60,3)}  _{(60,-3)}_{(-60,-3)}  ⊗ ⊗  ⊗ ⊗  ^{(60,13)}^{(-60,13)}  _{(60,-13)}_{(-60,-13)}  ⊗ ⊗  ⊗ ⊗  ^{(60,23)}^{(-60,23)}  _{(60,-23)}_{(-60,-23)}  ⊗ ⊗  ⊗ ⊗  ^{(60,33)}^{(-60,33)}  _{(60,-33)}_{(-60,-33)}  ⊗ ⊗  ⊗ ⊗  ^{(60,43)}^{(-60,43)}  _{(60,-43)}_{(-60,-43)}  ⊗ ⊗  ⊗ ⊗  ^{(60,53)}^{(-60,53)}  _{(60,-53)}_{(-60,-53)}  ⊗ ⊗ ⊗ ⊗^{(3,60)}^{(-3,60)}_{(3,-60)}_{(-3,-60)}  ⊗ ⊗  ⊗ ⊗  ^{(13,60)}^{(-13,60)}  _{(13,-60)}_{(-13,-60)}  ⊗ ⊗  ⊗ ⊗  ^{(23,60)}^{(-23,60)}  _{(23,-60)}_{(-23,-60)}  ⊗ ⊗  ⊗ ⊗  ^{(33,60)}^{(-33,60)}  _{(33,-60)}_{(-33,-60)}  ⊗ ⊗  ⊗ ⊗  ^{(43,60)}^{(-43,60)}  _{(43,-60)}_{(-43,-60)}  ⊗ ⊗  ⊗ ⊗  ^{(53,60)}^{(-53,60)}  _{(53,-60)}_{(-53,-60)}

Figure 2: Test Sample: Lines of various slopes with thinlines

5.3 Example 3

C B B A      A C A C B A C B Start                1         2         3         4         *

Figure 3: The finite automaton to detect occurrences of P =‘AABC’.

5.4 Example 4

       7 6 5                 4      3 2           1 I          H G F          E             D           C B A

Figure 4: Breath-first search beginning at A

6 Bugs

• The \circle* and \ellipse* may not work on all DVI drivers especially some previewers. If you have any problem, you should remove the related code in eepic.sty and use the LaTEX \cirlce* commands. To find the related codes, search for \special{bk} in the file.

• The alignment of the quarter circles and the lines in \oval command may not be correct on all printers because the command relies on the precise interpretation of the tpic specials which are not defined clearly. If you have any problem, you should either fixed that by changing the position of the quarter circles or remove the whole extended \oval command

  from eepic.sty.

• The area fill commands probably will not work on most previewers, and different device drivers may produce slightly different results.

7 Compatibility

If you want your TEX file to be compatible with LaTEX and epic but at the same time you want a better print out by using eepic, you must avoid several features in eepic.

• Try not to use \line commands and use \drawline instead because \line in LaTEX only supports a limited set of slope.

• Do not use \arc command. Use \spline if a curve is really necessary.

• Avoid using solid or small inter-dot gap in drawing long dash lines. They used up a lot of TEX memory in original epic. You should use \drawline with negative stretch to draw the dash lines.

If you want to use any of the extended commands in eepic, you must include the eepic emulation macros (eepicemu) in the file. The extended commands are emulated in the following ways.

• Circles larger than 40pt will be drawn using \oval.

• Ellipsis will be drawn using \oval.

• Spline will be approximated by \drawline.

• \path will be substituted by \drawline.

• \Thicklines will be substituted by \thicklines.
• \allinethickness will be substituted by \thicklines and \linethickness.

8 Installation

There are two possible ways of installing eepic. If your DVI printer driver program supports the tpic specials, you should use the standard eepic.sty file. If your DVI printer driver does not supports the tpic specials or you want to generate a standard DVI file without any special commands, you should use the file eepicemu.sty.

EPIC is available on cs.rochester.edu and sun.soe.clarkson.edu for anonymous ftp and e-mail request.

8.1 Use tpic Specials

First of all, you have to put a copy of epic.sty and eepic.sty in a place where LaTEX can find it. See section 4 of epic manual for more information.

Both epic and eepic have been implemented as document style options epic and eepic. When using epic and eepic, eepic must come after epic in the \documentstyle command. For example:

     \documentstyle[epic,eepic]{article}

If you only need the extended LaTEX commands and the new eepic commands, you may include only eepic in the \documentstyle command. But then the eepic emulation package will not work. I strongly recommend you to use eepic with epic all the time.

8.2 No tpic Specials

If you want to get a standard DVI file but you need the extended eepic commands, you should rename eepicemu.sty to eepic.sty and put that in a place where LaTEX can find it. Remember \arc command is not supported and the output will not be as good as standard eepic. Furthermore, you cannot use the emulation package with LaTEX alone. You have to include epic also.