This file shows diagrams in .svg format;
versions are also available.
The PDF equivalent can be found in examples.pdf of the distribution.
The diagrams shown below have been adapted from the Circuit_macros
examples in order to test the svg output of dpic. Generating svg line
art is relatively straightforward, but TeX, LaTeX, and related word
processors do not produce svg. Either less-sophisticated text formatting
must be employed or an
such as pdf can be
produced, followed by an additional processing step to convert to svg.
Two possibilities for the latter are
there may be font-related issues for some diagrams.
Many circuit and similar diagrams intended for the web do not
require sophisticated labels, however; the examples shown below might be representative.
Click on the link to view the source of each diagram.
There are a number of other issues:
Embedding .svg files in html documents with the <embed> or
<object> tag seems to be a perennial issue.
This file has been tested mainly by using Firefox.
The Adobe reader apparently requires a line of the form
<embed src="figure.svg" width="x" height="y" type="image/svg+xml"
This means that the html file has to contain dimension
information for each figure, whereas Firefox can
determine the figure size
from the <svg ... object. Currently, dpic includes a comment line
giving reasonable dimensions in pixels but this has to be insterted into
the <embed or <object line. A makefile does it easily but
otherwise this could be tedious.
The default font face is not specified in all of these diagrams but is
inherited from the enclosing document, so the appearance of labels can
differ depending on the browser. Some of these diagrams set the font at
the beginning of the diagram source.
The <svg tag may require modification
from the default used for this test. Dpic might be modified to
allow the generation of custom headers but that has not been done.
Diagrams such as these contain text labels
that have to be treated differently from the LaTeX-compatible versions.
Apparently there is no direct way to know the bounding box of arbitrary svg
Consequently, text placement is approximate and may require
Rather than patch the original source files for svg production, edited copies
have been used. The configuration file svg.m4 read by m4
prior to libcct.m4 contains the following macros defined for svg.
Others could be defined to exercise some of the media capabilties of svg.
They are subject to change:
Change font face, size, textratio and dpic textoffset parameters.
Change font face and dpic textht, dptextratio,
and textoffset parameters.
If arg4 is blank, the font is changed and
requires command "</g>" to cancel the font change.
Nominal height = text height in drawing units; actual height =
nominal ht x dptextratio.
Examples: svg_font(Times) svg_font(Times,14bp__) svg_font(sans-serif,14bp__:0.71) svg_font(Times,11bp__,1bp__,"text" at A) svg_font(font-family="Times") svg_font(font-family="Times" font-style="italic") svg_font(style="font-family:Times; font-style:italic")
Reasonable dptextratio value for common fonts, used
svg_tspan(text attributes, text);
e.g. svg_tspan(font-style="italic" font-size="75%",XYZ)
svg_it(text): for italics
svg_tt(text): for monospace (courier)
svg_norm(text): for normal text
svg_bf(text): for bold face
to set a smaller text size, default 66
for setting larger or smaller text size, default 100
svg_sub(text, size percent, y displ, x displ):
svg_sup(text, size percent, y displ, x displ):
svg_rot(degrees, "text" [at position]):
Rotate text degrees (default 90) ccw.
Requires svg_rot_init(filename) and the source
must be processed twice.
filename is the basename of the output of
dpic -v filename.pic > filename.svg
svgLink(URL, drawing object, [B]):
link to external file using
<a xlink:href=...>...</a> (default is
arg 3 = B)
svgLinkString as above but for strings attached to objects
Greek and other symbols:
Inkscape: It may be efficient to define elements by macro and to
place them using a wysiwyg graphics editor. A draft page intended
for Inkscape is included. A reasonable variety of elements is defined
but many more could be added and they should be customized for
Link experiments: Click on the resistor or source of quickSVG
to go to external
files in new windows. Click on "n-port" in NportSVG to replace the diagram
and then "back" to return.
Some of the assumptions used to create this draft may be
Comments are welcome.
The power supply of a Heathkit AR-15 (Now, that
was a receiver!) with custom transformer and other elements,
drawn on a grid (partially shown) to aid in placement:
A digital circuit of moderate size,
redrawn from M. P. Maclenan and G. M. Burns,
"An Approach to Drawing Circuit Diagrams for Text Books,"
Tugboat (12)1, March 1991, pp. 66-69:
Electron-tube diagrams: a few bottom-view base diagrams,
a generic triode test circuit, and a 25-watt audio amplifier adapted
from F. Langford-Smith, Radiotron Designers Handbook, fourth
edition, Harrison, NJ: Radio Corporation of America, 1952:
A 5-bit shift register drawn using a custom flip-flop:
A full adder and a cascade of n-bit adders:
A way of automatically drawing two-layer logic diagrams:
The Autologix(Boolean expression;
Boolean expression... , options)
macro automatically draws Boolean expressions in function notation.
The function tree is drawn, then a row or column of inputs, then
the connections. The default result is on the left,
a custom element at the top, and a tree of gates only is shown
on the right.:
The Autologix macro can draw inputs on the left but
the added drawing complexity may require hand tuning with
second-argument options: L puts the inputs on the left,
reverses their order, V scans the input arguments
in reverse order, and offset=value displaces
the array of inputs)
Realizations of the XOR function using Autologix:
A draft palette of a few elements for Inkscape using
a 1 mm grid:
Illustrating the macro
dimension_(linespec, offset, label,
H|W|D|blank width, tic offset, <-|->).
A negative second argument implies an offset to the right of the
linespec direction. A label starting with
sprintf is copied literally. If label is an
s_box(...) then setting argument 4 to H,
or D tailors the blank width to the s_box height,
width, or diagonal respectively; i.e., W is equivalent to
The macro arcdimension_ is similar but the first argument
specifies the arc to be dimensioned and the second argument is
the outward radial offset of the dimension arrow arc.:
Conestoga Sailing Club (illustrating the filling of arbitrary
Redrawn from a detail of the set design for the musical
Dracula, used for testing dpic. This diagram
consumes much LaTeX main memory but can be produced
directly as pdf using dpic -d,
as svg using dpic -g,
or as postscript using dpic -r
since no text formatting is required:
Variations on M. Goossens, S. Rahtz, and F. Mittelbach,
The LaTeX Graphics Companion, Addison-Wesley 1997, pp. 57-58:
An exercise in calculating RGB colours: