Package

v1.0ϵ last revised 1998/03/16

Sebastian Tannert^{∗} Andreas Tille^{†}

March 16, 1998

Abstract

The package CIRC is a tool for typesetting circuit diagrams and block schematics. It defines several electrical symbols such as resistors, capacitors, transistors etc. These symbols can be connected with wires in a very easy way.

To use CIRC you only need and L^{A}TEX 2ε. You do not need PostScript or any drawing tool. You can expand CIRC easily with your own symbols, written in .

∗macro code †documentation, optics

Contents

1 Introduction

In several sciences circuit diagrams are necessary in publications. Perhaps there are some PostScript tools for typesetting them or a drawing program has to be used. With CIRC it is now possible to typeset circuit diagrams using TEX commands. The commands describe the logical structure of the wiring scheme and TEX builds the connections according to this structure. CIRC defines several electrical symbols such as resistors, capacitors, transistors etc. These symbols can be connected with wires in a very easy way. To use CIRC you only need and L^{A}TEX 2ε. You do not need PostScript or any drawing tool. You can expand CIRC with your own symbols, written in . CIRC has been implemented as a turtle system. That means, there is a current position from where the symbols and wires are drawn. It is possible to choose the drawing direction and drawing position. CIRC consists of commands in order to draw symbols and wires into the scheme, justify symbols within the scheme, link symbols with wires, position symbols absolutely or relatively.

2 Installation

Run circ.ins through L^{A}TEX. You will get a couple of *.mf files. Use to create *.pk fonts from all these files. These steps depend on your installation. For example, type:

    mf \mode=localfont; input ciwidko.mf
    gftopk ciwidko.300

Do this with all the *.mf sources. Copy the resulting *.tfm and *.pk files into appropriate directories. Copy the *.sty, *.def files, obtained from circ.ins into appropriate directories in your TEXINPUT path. Read the documentation carefully. Enjoy CIRC. We added a Makefile which is tested only under Debian\GNU Linux (running teTeX). We would like to get comments whether it works under other environments. Use it at your own risk!. Type

    make

to get all files used by CIRC. Before you type

    make install

you should check the correct PATH names in the Makefile. (Make sure you run make install as root.) This will do the the following:

1. Delete old CIRC files in TEXINPUT and MFINPUT.

2. Move the new TEXINPUT and MFINPUT to the appropriate directories

3. Check the special.map file in the Fontname directory whether there ary CIRC related entries and create them if failed. (This will ensure that CIRC fonts will be copied into reasonable directories when using MakeTeXPK or MakeTeXTFM.)

4. Delete old PK and TFM files from CIRC. (Using old TFM or PK files is one of the "Top ten reasons" why failing CIRC.)

To get the documentation type

    make doc

(generally this is a good idea to create the needed fonts on the fly). Once more: Please report any bug concerning this Makefile, because this is the first test and not reliable at all.

3 System requirements

CIRC requires L^{A}TEX 2ε and .

4 Changes

Unfortunately a change of the parameters for symbol drawing commands had to be made. But now the rules are more consistent and easier to remember. Please have a look at section 5.3. Some new symbols were added and the font selection was modified to work together with the slides class. The appendix has a new design to be clearly arranged. Font names have changed too. The \< command is obsolete now and should NOT used anymore. A new \_ command was defined, see section 5.6.

5 Usage

5.1 Preambel

CIRC is divided into several parts. To use a part put the suitable option in the \usepackage command. All parts are included in the following example:

     \usepackage[basic,box,gate,oldgate,ic,optics,physics]{circ}

The parts contain: basic : a lot of symbols such as resistors, capacitors, switches, diodes, transistors,

etc., box : blackbox, oscilloscope, generator and amplifier, gate : several logical circuits, oldgate : old style logical gates, ic : integrated circuits (flip flops, etc.) and optics : the optical stuff with lenses, mirrors, etc. (see section ??), physics : some mechanics stuff. A complete list of available symbols is given in the appendix.

5.2 Starting a circuit diagram

It is recommended to draw a sketch with pen and paper before using CIRC. Every circuit diagram is enclosed in the circuit environment

     \begin{circuit}size

where size is an integer between 0 and 4 giving the size of symbols and describing text. A size of 4 is useful for overhead foils. All CIRC macros and the necessary parameters are separated by spaces (␣). For a clearly arranged CIRC diagram it is advisable to put every command in a separate line (a linebreak is interpreted as a blank as it is used in TEX).

5.3 Drawing symbols

The table in the appendix contains a complete list of all CIRC symbols available and corresponding drawing commands. The syntax of drawing commands is:

\symbolnamenumber␣inscription␣[specification_parameter]␣direction

or for more complex symbols:

\symbolnamenumber␣[further_parameters]

Note that you can leave out the blank between the symbol-command and the following number parameter. This parameter has to be unique in one drawing and is necessary for correct referring (see \atpin in section 5.6).

The symbols can be classified into a lot of different symmetries which are summarized in the appendix. There you will find more detailed information about the parameters you have to use. Generally the drawing direction of the symbol is given with the direction parameter which is l (left), r (right), u (up) or d (down). If there exist 2 different alignments of a symbol for one direction (e.g. if the LEDarrows show up or down) the second alignment is chosen by capitalization of the direction parameter (L, R, U or D). Symbols having two dissimilar or more connections may need a further specification parameter in front of the direction parameter. This specification parameter marks the pin that should be on the current drawing position (see variable resistor and several transistors). In the appendix text was used for the inscription and the necessary number was set to n. Note the position at the symbol where the inscription is set. The inscription can be suppressed by the \nv command in front of the symbol-command. By default every CIRC symbol is marked by a label. This label consists of an abbreviation of the symbol indexed by the number. To suppress this labeling use \nl in front of the symbol-command. Another command affecting the inscription of a symbol is \cc. It is also used in front of a symbol-command and causes the change of label-position and inscriptionposition. By default the inscription is typeset left or over the symbol while the labeling is done right or under the symbol depending on the vertical or horizontal orientation of the symbol. Some symbols need further_parameters. The usage is selfdocumenting in the appendix table. Junctions can be made by the \. command (\junction)^{1}. The syntax is:

\.number

Every junction needs a number argument for further referencing.

5.4 Referencing symbols and pins

Some commands use reference parameters to mark symbols or connections of symbols drawn before. The symbol_reference parameters consist of two parts:

symbolname number

The pin_reference parameters consist of three parts:

symbolname number pinname

These three parts form the reference parameter.

1Commands within parenthesis are synonyms for the last introduced command.

See the appendix for the pinnames, they are drawn nearby the pins. If the symbol has no pregiven ones the standard names l for the left connection, r for the right, t for the top and b for the bottom one will be chosen. Note that there is no blank between the parts! For example, to refer to the \underline{l}eft connection of the resistor with the number 1 the pin_reference parameter would be

     R1l

or to refer to the whole symbol the symbol_reference is

     R1 .

At least it is possible to set markers which work like pin references.

\Pnumber sets a marker which can be referred to by Pnumber.

5.5 Connecting symbols

Simple connections between the symbols can be made with the \- command, which is an abbreviation of the \wire command (see appendix). The syntax is

\-␣length␣direction. The parameter length is an integer giving the number of lengthsteps. In CIRC wires are build as a queue of characters 2.5 mm each. Thus the length of wire is measured in multiples of this length. The parameter direction determines the direction. Valid values are l for left, r for right, u for up and d for down. For instance, a wire is drawn to the left with a length of 1 cm (4 units) by typing

     \-␣4␣l

There are some other line types to connect symbols. The command

\dashed␣length␣direction draws a dashed line. It is written as the \- command. With

\bundle␣text␣length␣direction \wwire␣text␣length␣direction

a bundle of wire could be drawn or a pair of wire, respectively. You can use \= as an abbreviation of \wwire. The text may contain any comments. To connect the drawing position horizontally or vertically with a certain pin of a symbol by using a reference, the useful commands \htopin and \vtopin exist. The syntax is:

\htopin␣pin_reference \vtopin␣pin_reference

Provided that the resistor R1 defined before by a \R command, the command

     \vtopin␣R1l

draws a vertical wire up to this height, where the resistor numbered with 1 (R1) is situated. \htopin does the same but horizontally. The connection will be done by default with the \wire command. To change the type of the connection use the \by command. The syntax is:

\by{command}

where command can be one of the following: \wire (\-), \dashed, \bundle␣text, \wwire␣text or \oa (which is declared in the optics part, see section ??). For example, the command

     \by{\dashed}

changes the drawing style from \[hv]topin to a dashed lines. Do not forget to switch back to wires using

     \by{\wire}

to end the dashed lines. Note that it is usually necessary to combine the htopin- and vtopin commands, because these commands draw only horizontally or vertically to the x- or the y-coordinates of the given pin.

5.6 Positioning commands

Positioning commands are used to change the current drawing position. The direct positioning command \at (\from) sets the drawing position to an absolute coordinate.

     \at{x}␣{y}␣

sets the drawing position to the point (x,y) in the coordinate system, where x and y are integers counting the number of arbitrary units (2.5 mm). CIRC starts drawing at (0, 0). It is recommended to avoid the absolute positioning of symbols, because it tends to destroy the logical structure of the circuit diagram. The drawing position can be changed in relation to the current position with the indirect positioning command \moverel (\shift).

     \moverel{x}␣{y}␣

moves the drawing position x units to the right and y units upwards. The command \atpin (\frompin) sets the drawing position to a reference pin.

\atpin␣pin_reference allows further drawing starting from the reference pin. For example,

     \atpin C2r

sets the drawing position to the right pin of the capacitor numbered 2. In a lot of cases a command like \- is useful, but it should not draw the line. \_ satisfy this need. As you know from \- a length and a direction must be specified.

5.7 Justify commands

The command \hcenterto forces horizontal centering according to a symbol referred to. The command \vcenterto does the same but vertically. The command \centerto centers the following symbol according to the reference symbol horizontally or vertically depending on the drawing direction of the symbol beeing drawn. The syntax is:

\hcenterto␣symbol_reference \vcenterto␣symbol_reference \centerto␣symbol_reference

For example,

     \hcenterto L4

would force horizontal centering according to the coil numbered 4.

5.8 Text commands

The command

     \put{text}

puts text at the current drawing position. It can be used in the same way as the \put command of the L^{A}TEXpicture environment, but the coordinates have to be omitted (because they are given by the current drawing position). To comment something the commands

\Utext␣text␣from␣pin_reference1␣to␣pin_reference2 \centertext␣text␣from␣pin_reference1␣to␣pin_reference2

can be used. \centertext prints text centered between pin_reference1 and pin_reference2. \Utext additionally draws an arrow from pin_reference1 to pin_reference2. Note that the reference pins must have the same x- or ycoordinate. To write overlapping information like the TEX commands \rlap and \llap the following commands are used:

     \blap{text}
     \tlap{text}

They put text which overlap to the bottom or the top, respectively.

Please generate the fonts now. Then you will get a complete documentation.