Drawing Circuit Diagrams For Text Books

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

An Approach to Drawing Circuit Diagrams for Text Books

M.P.Maclenan & G.M.Burns


South Bank Polytechnic, Borough Road, London
email: burnsmQvax .southbank-poly .ac .uk

Abstract
The development of a library of pictograms is described. The
pictograms are defined using macros embodied in and
used to create an application to enable high definition circuit
diagrams to be easily included in m d o c u m e n t s .

Introduction l p t as the base dimension of the space. From these


The problems of including pictures within a m simple objects, small pictograms are defined and
from these pictograms, complete circuit diagrams
document have been considered by several people
can be drawn. Thus
e.g. Norris et al and recently by Rogers and by
Childs et al . Norris imports a Postscript file,
Roger's paper suggests creating a mini-graphics
package while Childs argues for a specialised hard-
I and I are used to make 63
ware. Textures which we use on Apple hardware Section 9.2 of The Manual discusses
provides a \specialCpicture#) to be included the use of \setdimensionmode to \put objects in
which allows for such combinations of pictures and an absolute space with respect to a given origin.
text to be created as However, by working consistently with l p t as the
base dimension. co-ordinate space was eventually
preferred. There are two possible approaches to
defining the objects and pictograms. in particular:
TWICKENHAM 1. to define the objects in terms of the absolute
RUGBY coefficients (x,y ) of the final diagram
FOOTBALL 2. to build up a box using co-ordinates relative
CLUB to a given origin within the box and then to
\put {box) at x y
where (x,y) is now absolute within the final
This facility is excellent if mere representation diagram.
is all that is required, but there is little flexibility In the final version of C I R ~ both
, approaches
once the picture is imported to and making are used. It was initially decided to relate all objects
changes becomes tedious. We consider here a use and pictograms to an origin at their bottom left
of to create an application, referred to as hand corner, but eventually it was realised that it
C I R for ~ brevity, which might be used to produce was convenient if the origin of some of them was
electronic circuit diagrams. The use of F'ICTE,X was logical rather than predefined in this way.
considered to have the following advantages: For example, consider a simple vertical rect-
it maintains device independence angle used. according to BS3939, to represent a
it allows a mixture of good graphic pictograms resistor.
with the elegance of TEX typesetting, ideal for
circuit diagrams
compositors need only be conversant with TEX
and the simple process of creating diagrams
embodied in C I R W to produce diagrams. Using approach A, \Rv can be defined by
\def\Rv#l#2C% #I=$x$,#2=$y$
Concepts Used in C I R W \cxone=#l \advance\cxone by 6
\cyone=#2 \advance\cyone by 18
The simple principle adopted is that small, recurring \putrectangle corners at
objects are defined in a co-ordinate system using C#l){cyone) and Ccxone)C#2))

Proceedings
Drawing Circuit Diagrams for Text Books

It is then used simply as \Rv{x){y) where x,y Initially, the inversion bubble that converts a
are absolute coordinates in the space of the final buffer to an inverter was constructed using \circu-
diagram. lararc, which took a long time to compile and used
Approach B follows the suggestion made in considerable amounts of memory. It was noticed
Section 8.2 of the PICI'EX manual on how to include that a lower case o in courier font is circular. and at
pictures in pictures. Thus \Rv can be defined by lOpt, of a perfect size to be used as \bubble which
\def \RvC\% can be \put immediately!
\putrectangle corners at 0 18 and 6 0
1 b and I are used to make H
\Rv is subsequently placed in the final picture using
Infill of shapes proved to be difficult. The diode
\put {\Rv) [bl] at x y. In this case. approach
triangle is constructed by successively \puting on
B is preferred because it is simpler and use of
a centerline vertical rules of diminishing height and
\put allows for an x,h,ft and/or a y,h,ft so that
offset 0.4pt to each other. The down arrow of the
the resistor can be located at the known end of a
npn transistor is drawn similarly by \plotting a
vertical line and offset 3pt to place the origin. Note
series of lines radiating from the tip of the arrow.
that we found that the inclusion of \beginpicture
Labels of some signals are drawn with a bar
. . \endpicture as suggested in Section 8.2 was over the symbol to indicate that the signals are
found to be unnecessary in the definition.
active low. Given that the symbols are of unknown
An example of logical placement is
length, this was solved by
\label#1#2#3#4{% #l=$x$ #2=$y$
\def\actlow#l~\hbox~#l~
% #3=pin number #4=label $\cdots$
\setboxl=\hbox{#l3\kern-\wd1
used to draw this IC. \raise5.5pt\hbox{%
\vrule height 0.4pt width \wdl
)3

Problems
It must be stressed that problems discussed here
relate to our use of Q m in trying to create an
application for which it was not intended and not
GSD
to QCl&X itself.
\linethickness has no effect on Q w
macros producing curves so that. for exam-
Here, each label is placed as ple, the circular outline used to draw the
transistor could not be changed.
\loop . . . \repeat does not seem to work
within any of our defined macros which involve
use of Q w .
The parameter #4 can contain any text, includ- During development, variable names were cho-
ing symbols, so that the depth of this sub-box is sen which by chance coincided with names used
in Q w . To avoid repetition of the problems
unknown. Since its depth will define the depth of
this caused. all CIRTEX variables now start
\label, logical placement is essential to maintain
alignment. with a c e.g. \cxone
Once these concepts were understood, a library Our initial use of \setbox1 gave very odd
of objects and pictograms was developed. results until the valuable advice to always
use \newbox was remembered (which produced
\box22!).
Tricks Our attempt at object-orientated development
implies deeper and deeper grouping which may
D and o are used to make b contribute to greater use of memory than is
necessary.

Proceedings of m 9 0
M.P.Maclenan and G.M. Burns

Conclusion
The extent of development now allows us to quickly
draw diagrams like these,

_I:-
0

which can be totally integrated into a TEX doc-


ument. Indeed, it is now possible to produce
diagrams such as that in the Appendix, but this
takes 37 kbytes of memory and over 6 minutes to
compile on a Macintosh II! The reason for this is
simple, that PI- must calculate many of the
basic shapes of the objects. A tantalising reference
is made on page 389 of the The m b o o k to a font
\qc which contains four quarter circles as charac-
ters but no hint is given as to its availability. If
a font which contains all the basic object shapes
which we use could be developed and combined
with the computational power implied in the use of
w,
\ p u t within then as Rogers suggests, we
would be able to produce a package capable of easy
production of circuit diagrams of suitable quality to
be included in text books.

Bibliography
Norris & Oakley. 1988. "Electronic Publishing,"
m 88 Exeter Proceedings.
Rogers, David. 1988. TUGboat 10(1), April.

Proceedings of m 9 0
CA 1
NMI PA7

SYNC

RESET PA3
PA2
PA 1
PA0

35
RS3 (A3)
RS2 (A2)
RS1 (Al)
RSO (AO)

23
CS2
c-

PB2

PBO
I

/
1
/ / / /
/ \ \

K v a .
(Em0 FFFF)
-
6GI Y7 o7 GI Y7 07
g (COO0 OFFFJ
- 9
Y6 0- Y6 C+-
10 ( A m - BFFF)
Y5 * y5 &
11 (8000 - 9FFF)
Y4 e Y4 &
12 (€000 - 7FFF)
\'A Y3 y 3 011-
~ ( 4 0 0 0SFFF)
-
Y2 0- y2 &
14 (2000 JFFF) 14
G2b Y1 0-
(0000- IFFF)

You might also like