diff options
author | Norbert Preining <norbert@preining.info> | 2020-12-21 03:01:35 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-12-21 03:01:35 +0000 |
commit | 4cc7922324b7a08ba0418e8f245cf1dcfa1891ac (patch) | |
tree | cd90cb6c072285e779f7555a85966b81a8757e15 /graphics/circuit_macros/doc/body.tex | |
parent | 2d9d44100d72263a7df34c12aaa89dbe6ee6fe0c (diff) |
CTAN sync 202012210301
Diffstat (limited to 'graphics/circuit_macros/doc/body.tex')
-rw-r--r-- | graphics/circuit_macros/doc/body.tex | 357 |
1 files changed, 189 insertions, 168 deletions
diff --git a/graphics/circuit_macros/doc/body.tex b/graphics/circuit_macros/doc/body.tex index cbb2fdb058..ac8db93ef5 100644 --- a/graphics/circuit_macros/doc/body.tex +++ b/graphics/circuit_macros/doc/body.tex @@ -92,7 +92,7 @@ The result is passed through a \pic interpreter to produce {\tt .tex} output that can be inserted into a {\tt .tex} document using the \verb|\input| command. -\begin{figure}[hbt] +\begin{figure}[ht] \pdftooltip{\input Flowdiag }{Flow diagram for the inclusion of figures} \caption{Inclusion of figures and macros in the \latex document. \label{Flowdiag}} @@ -193,7 +193,7 @@ A configuration file ({\tt pstricks.m4} and {\tt pgf.m4} in the above examples) is {\em always} the first file to be given to \Mfour. Put the following or its equivalent in the document body: \begin{verbatim} -\begin{figure}[hbt] +\begin{figure}[ht] \centering \input quick \caption{Customized caption for the figure.} @@ -218,7 +218,7 @@ to be read, thereby defining the macro {\tt cct\_init}. The diagram source file is then read and the circuit-element macros in {\tt libcct.m4} are defined during expansion of {\tt cct\_init}. -\begin{figure}[hbt] +\begin{figure}[ht] \input ConfigA \caption{The command {\tt m4 pstricks.m4 quick.m4 > quick.pic}. @@ -239,7 +239,7 @@ the commands are \noindent and the figure inclusion statements are as shown: \begin{verbatim} -\begin{figure}[hbt] +\begin{figure}[ht] \input quick \centerline{\box\graph} \caption{Customized caption for the figure.} @@ -470,7 +470,7 @@ The construction \noindent truncates the line at each end by {\tt x} (which may be negative) or, if {\tt x} is omitted, by -the current circle radius, which is convenient when A and B are +the current circle radius, a convenience when A and B are circular graph nodes, for example. Otherwise {\tt line from A to B chop x chop y} @@ -728,7 +728,11 @@ operating-system commands, \pic macros, and external file inclusion. There is a fundamental difference between the two-terminal elements, each of which is drawn along an invisible straight-line segment, and other elements, which are compound objects mentioned -in \SR{Compoundobjects:}. The two-terminal element macros follow a +in \SR{Compoundobjects:}. +% Specifying the straight-line segment requires four numbers, the coordinates +% of the start and end, or equivalent, but default values are used if +% not specified. +The two-terminal element macros follow a set of conventions described in this section, and other elements will be described in \SR{Composite:}. @@ -745,7 +749,7 @@ The first part of the source file for this figure is %as follows: on the left: -\begin{figure}[hbt] +\begin{figure}[ht] \parbox{2in}{\tt .PS\\ \hbox{}\quad cct\_init\\ \hbox{}\quad linewid = 2.0\\ \hbox{}\quad linethick\_(2.0)\\ R1: resistor} \raisebox{-0.3in}{\hbox{\input{BigResistor.tex}}} @@ -829,7 +833,8 @@ were added after the previously shown source: \subsection{The two-terminal elements\label{Twoterminal:}} The two-terminal elements are shown in \FRS{CctTable} % to~\REF{Diodes} and \FRS{Fuses} -to~\REF{Switches}. +%to~\REF{Switches}. +to~\REF{Arresters}. Several elements are included more than once to illustrate some of their arguments, which are listed in \SR{defines}. \enlargethispage{\baselineskip} @@ -846,12 +851,13 @@ If the argument is blank, the element is drawn from the current position in the current drawing direction along a default length. The other arguments produce variants of the default elements. -\begin{figure}[hbt] +\begin{figure}[ht] \input AmpTableMan \caption{Amplifier, delay, and integrator.} \label{AmpTable} \end{figure} +\pagebreak Thus, for example, \par {\tt resistor(up\_ 1.25,7)} @@ -862,7 +868,7 @@ vertices per side. The macro {\tt up\_} evaluates to {\tt up} but also resets the current directional parameters to point up. -\begin{figure}[hbt] +\begin{figure}[ht] \input SourcesMan % \ifpdf\vspace*{-0.5\baselineskip}\fi% \caption{Sources and source-like elements.} @@ -875,11 +881,16 @@ to draw a single cycle of a sinusoid or approximate sinusoid. As a convenience, the macro {\tt ACsymbol(at {\sl position, length, height,} [A]U|D|L|R|{\sl degrees})} is included as an interface to -the {\tt sinusoid} macro. For example to add the sumbol to an ebox: +the {\tt sinusoid} macro. For example to add the sumbol +(\input{ACsymbol.tex}) to an ebox: \par {\tt ebox; $\lbrace$\ ACsymbol(at last [],{,},dimen\_/8) $\rbrace$} -\begin{figure}[hbt] +\noindent +For direct current (\input{DCsymbol.tex}), there is also +{\tt DCsymbol(at {\sl position, length, height,} U|D|L|R|{\sl degrees})}. + +\begin{figure}[ht] \input DiodesMan \caption{The macro {\tt diode(\linespec,B|CR|D|L|LE[R]|P[R]|S|T|V|v|w|Z|{\sl chars},[R][E])}. @@ -923,6 +934,8 @@ The first argument of the macro \noindent is the name of a two-terminal element in quotes, followed by the element arguments. The element is drawn with reversed direction. + +\pagebreak Thus, \par {\tt diode(right\_ 0.4); reversed(`diode',right\_ 0.4)} @@ -930,11 +943,6 @@ Thus, \noindent draws two diodes to the right, but the second one points left. -\begin{figure}[bt] - \input EmarrowsMan - \caption{Radiation arrows: {\tt em\_arrows({\sl type, angle, length})}} - \label{Emarrows} - \end{figure} Similarly, the macro \par {\tt resized(}{\sl factor},`{\sl macro name}',{\sl macro arguments}{\tt )} @@ -949,12 +957,31 @@ by 1.8, for example {\tt resized(1.8,`diode',right\_ 0.4);} {\tt resized(1.8,`reversed',`diode',right\_ 0.4)} +\pagebreak +\FR{Arresters} shows a collection of surge-protection devices, or arresters, +of which the {\tt E} and {\tt S} types may be either 2-terminal or as +3-terminal (composite) elements described in \SR{Composite:}. +\begin{figure}[ht] + \input ArrestersMan + \caption{Variations of the {\tt arrester({\sl linespec, chars,} + {\sl wid}[{\tt :}{\sl arrowhead ht}], {\sl ht}[{\tt :}{\sl arrowhead wid})} + macro. Putting {\tt D} in argument 2 for the {\tt S} or {\tt E} + configuration creates a 3-terminal composite element + with terminals {\sl A, B}, and {\sl G.}} + \label{Arresters} + \end{figure} + \FR{Emarrows} contains radiation-effect arrows for embellishing two-terminal and other macros. The arrow stems are named {\sl A1}, {\sl A2}, and each pair is drawn in a \verb|[]| block, with the names {\sl Head} and {\sl Tail} defined to aid placement near another device. The second argument specifies +\begin{figure}[ht] + \input EmarrowsMan + \caption{Radiation arrows: {\tt em\_arrows({\sl type, angle, length})}} + \label{Emarrows} + \end{figure} absolute angle in degrees (default 135 degrees). The arrows are drawn relative to the diode direction by the {\tt LE} option in \FR{Diodes}. For absolute arrow directions, one can @@ -979,7 +1006,7 @@ thus, the following line draws the resistor in \FR{Variable}: \par {\tt resistor(down\_ dimen\_); variable(,uN)} -\begin{figure}[h!t] +\begin{figure}[ht] \vspace*{-\baselineskip} \input VariableMan \caption{Illustrating @@ -1011,7 +1038,7 @@ The macro \noindent draws an arrow from the start of the last-drawn two-terminal element {\sl frac} of the way toward the body. -\begin{figure}[h!t] +\begin{figure}[ht] % \ifpdf\vspace*{-0.5\baselineskip}\fi% \input currents \caption{Illustrating {\tt b\_current, larrow,} and {\tt rarrow}. @@ -1153,7 +1180,7 @@ The macro {\tt eleminit\_} in the two-terminal elements invokes to establish element length and direction. As shown in \FR{Oblique}, -\begin{figure}[h!b] +\begin{figure}[ht] \vspace{-\baselineskip} \parbox{4.5in}{\small \verbatiminput{Oblique.m4}}% \hfill\raise-0.7in\llap{\hbox{\input Oblique }}% @@ -1196,7 +1223,7 @@ makes some geometries particularly simple. Thus, \noindent draws three elements in series as shown in the top line of \FR{Series}. -\begin{figure}[h!t] +\begin{figure}[ht] \vspace{-\baselineskip} \input Series \caption{Three ways of drawing basic elements in series.} @@ -1247,7 +1274,7 @@ producing the left circuit in \FR{ParSeries}: line from L.end to C.end \end{verbatim} -\begin{figure}[h!t] +\begin{figure}[ht] % \vspace*{-\baselineskip} \input ParSeries \vspace*{-\baselineskip} @@ -1305,7 +1332,7 @@ first draws a resistor along the specified line, then adds arrows for taps at fractional positions along the body, with default or specified length. A negative length draws the arrow from the right of the current drawing direction. -\begin{figure}[h!t] +\begin{figure}[ht!] \input Potentiometers \caption{Default and multiple-tap potentiometer.} \label{Potentiometers} @@ -1317,7 +1344,7 @@ The macro {\tt $\ldots$)}, shown in \FR{Taps}, will add taps to the immediately preceding two-terminal element. -\begin{figure}[h!t] +\begin{figure}[ht] \input Taps \caption{Macros for adding taps to two-terminal elements.} \label{Taps} @@ -1338,7 +1365,17 @@ drawn elements. A few composite symbols derived from two-terminal elements are shown in \FR{Composite}. +\begin{figure}[h!b] + \vspace*{-0.5ex} +% \vspace*{-\baselineskip} + \input Composite + \vspace*{-0.5ex} + \caption{Composite elements {\tt KelvinR({\sl cycles},[R],{\sl cycle wid})} + and {\tt FTcap({\sl chars})} .} + \label{Composite} + \end{figure} +\enlargethispage{\baselineskip} The ground symbol is shown in \FR{Grounds}. The first argument specifies position; for example, the two lines shown have identical effect: @@ -1347,15 +1384,6 @@ have identical effect: \par ground(at (1.5,2)) } -\begin{figure}[h!t] - \vspace*{-0.5ex} - \input Composite - \vspace*{-0.5ex} - \caption{Composite elements {\tt KelvinR({\sl cycles},[R],{\sl cycle wid})} - and {\tt FTcap({\sl chars})} .} - \label{Composite} - \end{figure} - %\noindent The second argument truncates the stem, and the third defines the symbol type. @@ -1369,26 +1397,27 @@ macro and reset at the end using {\tt resetdir\_}. \input GroundsMan \caption{The {\tt ground( at }{\sl position}{\tt, - T, N|F|S|L|P[A]|E, U|D|L|R|{\sl degrees} )} + T|{\sl stem length}, N|F|S|L|P[A]|E, U|D|L|R|{\sl degrees} )} macro.} \label{Grounds} \end{figure} -The arguments of the macro -{\tt antenna( at }{\sl position}{\tt, - T, A|L|T|S|D|P|F, U|D|L|R|{\sl degrees} )} +The arguments of +{\tt antenna(at }{\sl position}{\tt, + T|{\sl stem length}, A|L|T|S|D|P|F, U|D|L|R|{\sl degrees})} shown in \FR{Antennas} are similar to those of {\tt ground}. -\begin{figure}[h!t] +\begin{figure}[h!] \input AntennasMan \caption{Antenna symbols, with macro arguments shown above and terminal names below.} \label{Antennas} \end{figure} -\pagebreak \FR{Opamp} illustrates the macro {\tt opamp({\sl\linespec, - label, + label, size, chars})\label{OPAMP}}. -\begin{figure}[h!t] +The element is enclosed in a block +containing the predefined internal locations shown. +\begin{figure}[ht] % \ifpdf\vspace*{-0.5\baselineskip}\fi% \input OpampMan \caption{Operational amplifiers. The {\tt P} option adds @@ -1396,8 +1425,6 @@ shown in \FR{Antennas} are similar to those of {\tt ground}. to place and rotate arbitrary text at {\tt In1} and {\tt In2}.} \label{Opamp} \end{figure} -The element is enclosed in a block -containing the predefined internal locations shown. These locations can be referenced in later commands, for example as ``{\tt last [].Out}.'' The first argument defines the direction and length of the opamp, but the @@ -1418,7 +1445,7 @@ using postprocessor commands (for example \PSTricks \verb|\rput|) as second and third arguments. The code in \FR{oax} places an opamp with three connections. -\begin{figure}[h!t] +\begin{figure}[h!b] \parbox{4in}{\small \verbatiminput{oaxbody.m4}}% \quad\raise-0.2in\hbox{\input oax }% % \vspace{-\baselineskip} @@ -1430,6 +1457,14 @@ The code in \FR{oax} places an opamp with three connections. \FR{Xform} shows variants of the transformer macro, which has predefined internal locations {\sl P1,} {\sl P2,} {\sl S1,} {\sl S2,} {\sl TP,} and {\sl TS.} +\begin{figure}[h!t] + \input XformMan + \caption{The {\tt transformer(\linespec,L|R,{\sl np},% +[A|P][W|L][D1|D2|D12|D21],{\sl ns})} + macro (drawing direction {\tt down}), showing predefined terminal + and centre-tap points.} + \label{Xform} + \end{figure} The first argument specifies the direction and distance from {\sl P1} to {\sl P2}, with position determined by the enclosing block as for opamps. The second @@ -1442,21 +1477,18 @@ if a {\tt P}, the core is dashed (powder); and if it contains a {\tt W}, wide windings are drawn. A {\tt D1} puts phase dots at the {\sl P1, S1} end, {\tt D2} at the {\sl P2, S2} ends, and {\tt D12} or {\tt D21} puts dots at opposite ends. -\begin{figure}[h!t] -% \ifpdf\vspace*{-\baselineskip}\fi% - \input XformMan -% \vspace{-\baselineskip} - \caption{The {\tt transformer(\linespec,L|R,{\sl np},% -[A|P][W|L][D1|D2|D12|D21],{\sl ns})} - macro (drawing direction {\tt down}), showing predefined terminal - and centre-tap points.} - \label{Xform} - \end{figure} -\pagebreak \FR{Audio} shows some audio devices, defined in {\tt []} blocks, with predefined internal locations as shown. -\begin{figure}[h!t] +The first argument specifies the device orientation. +Thus, +\par +{\tt S: speaker(U) with .In2 at Here} + +\noindent +places an upward-facing speaker with input {\sl In2} at the +current location. +\begin{figure}[ht] % \ifpdf\vspace*{-\baselineskip}\fi% \input AudioMan % \ifpdf\vspace*{-\baselineskip}\fi% @@ -1466,20 +1498,11 @@ with predefined internal locations as shown. earphone}, with their internally named positions and components.} \label{Audio} \end{figure} -The first argument specifies the device orientation. - -Thus, - -{\tt S: speaker(U) with .In2 at Here} - -\noindent -places an upward-facing speaker with input {\sl In2} at the -current location. The {\tt nport({\sl box specs {\tt[;} other commands{\tt]}, nw, nn, ne, ns, space ratio, pin lgth, style})} macro is shown in \FR{Nport}. -\begin{figure}[h!t] +\begin{figure}[ht] % \ifpdf\vspace*{-\baselineskip}\fi \input NportMan % \ifpdf\vspace*{-\baselineskip}\fi @@ -1520,7 +1543,6 @@ immediately after drawing it but within the enclosing block: If this trick were to be used extensively, then the following custom wrapper would save typing, add the labels, and pass all arguments to {\tt nport}: -\pagebreak \begin{verbatim} define(`nullor',`nport(`$1' @@ -1529,33 +1551,21 @@ define(`nullor',`nport(`$1' \end{verbatim} The above example and the related gyrator macro are illustrated in -\FR{NLG}. -% \ifpdf\vspace*{\baselineskip}\fi% -\begin{figure}[h!t] +\FR{NLG}.\hfill\break + +\begin{figure}[ht] \input NLGMan \caption{The {\tt nullor} example and the {\tt gyrator} macro are customizations of the {\tt nport} macro.} \label{NLG} \end{figure} -The double-throw switches shown in \FR{NPDT} are drawn in the -current drawing direction like the two-terminal elements, but are -composite elements that must be placed accordingly. -\begin{figure}[h!t] -% \ifpdf\vspace*{-0.5\baselineskip}\fi% - \input NPDTMan -% \ifpdf\vspace*{-0.5\baselineskip}\fi% - \caption{Multipole double-throw switches drawn by - {\tt NPDT({\sl npoles}, [R])}.} - \label{NPDT} - \end{figure} - \FR{Contact} shows the macro {\tt contact({\sl chars})}, which contains predefined locations {\sl P, C, O} for the armature and normally closed and normally open terminals. An {\tt I} in the first argument draws open circles for contacts. -\begin{figure}[h!t] +\begin{figure}[ht] % \ifpdf\vspace*{-\baselineskip}\else\vspace*{-0.5\baselineskip}\fi% \input ContactMan \vspace{-1ex} @@ -1565,11 +1575,9 @@ An {\tt I} in the first argument draws open circles for contacts. \label{Contact} \end{figure} -\pagebreak The {\tt contacts({\sl poles, chars})} macro in \FR{Contacts} draws multiple contacts. -\begin{figure}[h!t] -% \ifpdf\vspace*{-\baselineskip}\else\vspace*{-0.5\baselineskip}\fi% +\begin{figure}[ht] \input ContactsMan \vspace{-1ex} \caption{The {\tt contacts({\sl poles, chars})} @@ -1581,7 +1589,9 @@ For drawing relays, the macro {\tt relaycoil({\sl chars, wid, ht,} {\tt U|D|L|R|}{\sl degrees})} shown in \FR{relaycoil} provides a choice of connection points and actuator types. -\begin{figure}[h!t] + +\pagebreak +\begin{figure}[ht] % \ifpdf\vspace*{-\baselineskip}\else\vspace*{-0.5\baselineskip}\fi% \input relaycoilMan \vspace{-1ex} @@ -1591,9 +1601,8 @@ actuator types. The {\tt relay({\sl poles, chars})} macro in \FR{Relay} defines coil terminals {\sl V1, V2} and contact -terminals {\sl P$_i$, C$_i$, O$_i$.} -\begin{figure}[h!t] -% \ifpdf\vspace*{-\baselineskip}\else\vspace*{-0.5\baselineskip}\fi% +terminals {\sl P$_i$, C$_i$, O$_i$.} +\begin{figure}[ht] \input RelayMan \vspace{-1ex} \caption{The {\tt relay({\sl poles, chars})} @@ -1602,14 +1611,14 @@ terminals {\sl P$_i$, C$_i$, O$_i$.} \end{figure} The {\tt jack} and {\tt plug} macros and their defined points are - illustrated in \FR{Jack}. - The first argument of both macros establishes the drawing direction. -\begin{figure}[h!t] +illustrated in \FR{Jack}. +The first argument of both macros establishes the drawing direction. +\begin{figure}[h!] \input JackMan \vspace{-1ex} \caption{The {\tt jack(U|D|L|R|{\sl degrees}, {\sl chars})} - and {\tt plug(U|D|L|R|{\sl degrees},[2|3][R])} components - and their defined points.} + and {\tt plug(U|D|L|R|{\sl degrees},[2|3][R])} components + and their defined points.} \label{Jack} \end{figure} The second argument is a string of characters defining drawn components. @@ -1628,14 +1637,14 @@ A macro for drawing headers is in \FR{Headers}, and some experimental connectors are shown in \FR{Conn} and \FR{Pconn}. The {\tt tstrip} macro allows ``{\sl key}{\tt =}{\sl value}{\tt ;}'' arguments for width and height. -\begin{figure}[h!t] +\begin{figure}[ht] % \ifpdf\vspace*{-0.5\baselineskip}\fi% \input HeadersMan % \ifpdf{\vspace*{-0.5ex}}\fi% \caption{Macro {\tt Header(1|2, {\sl rows, wid, ht, type})}.} \label{Headers} \end{figure} -\begin{figure}[h!t] +\begin{figure}[ht] \input ConnMan % \ifpdf{\vspace*{-0.5ex}}\fi% \caption{Macros {\tt tstrip(R|L|U|D|{\sl degrees}, {\sl chars})}, @@ -1645,7 +1654,7 @@ for width and height. \label{Conn} % \ifpdf{\vspace*{-1ex}}\fi% \end{figure} -\begin{figure}[h!t] +\begin{figure}[ht] % \ifpdf{\vspace*{-1ex}}\fi% \input PconnMan % \ifpdf{\vspace*{-0.5ex}}\fi% @@ -1655,13 +1664,23 @@ for width and height. \label{Pconn} \end{figure} -\pagebreak +The double-throw switches shown in \FR{NPDT} are drawn in the +current drawing direction like the two-terminal elements, but are +composite elements that must be placed accordingly. +\begin{figure}[h!b] + \ifpdf{\vspace*{-1ex}}\fi% + \input NPDTMan + \caption{Multipole double-throw switches drawn by + {\tt NPDT({\sl npoles}, [R])}.} + \label{NPDT} + \end{figure} + A basic winding macro for magnetic-circuit sketches and similar figures is shown in \FR{Windings}. For simplicity, the complete spline is first drawn and then blanked in appropriate places using the background (core) color (\verb!lightgray! for example, default \verb!white!). -\begin{figure}[h!t] +\begin{figure}[h!b] \vspace*{-\baselineskip}% % \ifpdf\vspace*{-2\baselineskip}\else \vspace{-\baselineskip}\fi \input WindingsMan @@ -1679,7 +1698,7 @@ is first drawn and then blanked in appropriate places using the background which contains predefined internal locations {\sl E}, {\sl B}, {\sl C}. The first argument defines the distance and direction from {\sl E} -\begin{figure}[h!t] +\begin{figure}[ht] % \ifpdf\vspace*{-0.5\baselineskip}\fi% \input BipMan % \ifpdf\vspace*{-0.5\baselineskip}\fi% @@ -1694,7 +1713,7 @@ current drawing direction according to the second argument. Setting the third argument to {\tt P} creates a PNP device instead of NPN, and setting the fourth to {\tt E} draws an envelope around the device. \FR{Darlington} shows a composite macro with several optional internal elements. -\begin{figure}[h!t] +\begin{figure}[ht] \input Darlington \caption{Macro {\tt Darlington(L|R,[E][P][B1][E1|R1][E2|R2][D][Z])}, drawing direction {\tt up\_}.} @@ -1703,8 +1722,8 @@ fourth to {\tt E} draws an envelope around the device. The code fragment example in \FR{bitr} places a bipolar transistor, connects a ground to the emitter, and connects a resistor to the collector. -\begin{figure}[h!t] -\vspace*{-\baselineskip} +\begin{figure}[ht] +%\vspace*{-\baselineskip} \quad\quad\parbox{4in}{\small \verbatiminput{bitrbody.m4}}% \quad\raise-0.4in\hbox{\input bitr }% \vspace{-\baselineskip} @@ -1717,8 +1736,8 @@ the macro {\tt bi\_trans(\linespec, L|R, {\sl chars}, E)}, which draws the components of the transistor according to the characters in its third argument. For example, multiple emitters and collectors can be specified as shown in \FR{bitrans}. -\begin{figure}[h!t] -\vspace*{-0.5\baselineskip} +\begin{figure}[ht] +%\vspace*{-0.5\baselineskip} \input bi_trans \caption{The {\tt bi\_trans(\linespec,L|R,{\sl chars},E)} macro. The sub-elements are specified by the third argument. The substring @@ -1734,7 +1753,7 @@ and a thyristor macro with predefined internal locations {\sl G} and {\sl T1,} {\sl T2,} or {\sl A,} {\sl K} is in \FR{thyristor}. Except for the {\sl G} terminal, a thyristor (the {\tt IEC} variant excluded) -\begin{figure}[h!t] +\begin{figure}[ht] % \ifpdf\vspace*{-\baselineskip}\else\vspace*{-0.5\baselineskip}\fi% \input ujtMan % \ifpdf\vspace*{-0.5\baselineskip}\fi% @@ -1768,7 +1787,7 @@ draws the element from position {\sl A} to position {\sl B} with label Some FETs with predefined internal locations {\sl S,} {\sl D,} and {\sl G} are also included, with similar arguments to those of {\tt bi\_tr,} as shown in \FR{fet}. -\begin{figure}[h!t] +\begin{figure}[ht] % \ifpdf\vspace*{-\baselineskip}\fi% \input fetMan % \ifpdf\vspace*{-\baselineskip}\fi% @@ -1806,7 +1825,7 @@ the {\tt thyristor(\linespec, {\sl chars})} macro illustrated in \FR{thyristor} is derived from the diode and bipolar transistor macros. Another example is the {\tt tgate} macro shown in \FR{Tgate}, which also shows a pass transistor. -\begin{figure}[h!t] +\begin{figure}[ht] % \ifpdf\vspace*{-\baselineskip}\fi% \input TgateMan \caption{The {\tt tgate({\sl linespec,} [B][R|L])} element, derived from @@ -1824,7 +1843,7 @@ optional argument ``{\tt at} {\sl location}'', the line-thickness macros, the {\tt fill\_} macro, and {\tt crossover}, which is a useful if archaic method to show non-touching conductor crossovers, as in \FR{bistable}. -\begin{figure}[h!t] +\begin{figure}[ht] \input bistableMan % \vspace{-1ex} \caption{Bipolar transistor circuit, illustrating {\tt crossover} @@ -1936,7 +1955,7 @@ two-terminal element. Input locations retain their positions relative to the gate body regardless of gate orientation, as in \FR{FF}. -\begin{figure}[h!t] +\begin{figure}[ht] \vspace*{-\baselineskip} \parbox{4.75in}{\small \verbatiminput{FF.m4}}% \input FF @@ -1944,7 +1963,7 @@ regardless of gate orientation, as in \FR{FF}. \caption{$SR$ flip-flop.} \label{FF} \end{figure} -\begin{figure}[h!t] +\begin{figure}[ht] \input mplex \caption{Eight-input multiplexer, showing a gate with wings.} \label{exVIII} @@ -2018,7 +2037,7 @@ If the first argument is non-blank however, then the buffer is drawn along an invisible line like a two-terminal element, which is convenient sometimes but requires internal locations of the block to be referenced using {\tt last []}, as shown in \FR{Buffer}. -\begin{figure}[h!t] +\begin{figure}[ht] \input Buffer \caption{The {\tt BUFFER\_gate} and {\tt BUFFER\_gen} macros. The bottom two examples show how the gate can be drawn as a two-terminal @@ -2027,28 +2046,12 @@ but requires internal locations of the block to be referenced using \label{Buffer} \end{figure} -\FR{Multiplexer} shows a multiplexer block with variations, and - \FR{Demultiplexer} shows -the very similar demultiplexer. -\begin{figure}[h!t] - \input MultiplexerMan - \caption{The {\tt Mux({\sl input count}, {\sl label}, - [L][B|H|X][N[$n$]|S[$n$]][[N]OE],{\sl wid},{\sl ht})} macro.} - \label{Multiplexer} - \end{figure} -\begin{figure}[h!t] - \input DemultiplexerMan - \caption{The {\tt Demux({\sl input count}, {\sl label}, - [L][B|H|X][N[$n$]|S[$n$]][[N]OE],{\sl wid},{\sl ht})} macro.} - \label{Demultiplexer} - \end{figure} - \FR{FlipFlops} shows the macro {\tt FlipFlop(D|T|RS|JK, {\sl label, boxspec, pinlength})}, which is a wrapper for the more general macro {\tt FlipFlopX(}{\sl boxspec, label, leftpins, toppins, rightpins, bottompins, pinlength}{\tt )}. -\begin{figure}[h!t] +\begin{figure}[ht] \input FlipFlop \caption{The {\tt FlipFlop} and {\tt FlipFlopX} macros, with variations.} \label{FlipFlops} @@ -2070,27 +2073,45 @@ a label, use {\tt lg\_bartxt(}{\sl label}{\tt)}. The {\sl pinopts} are {\tt [L|M|I|O][N][E]} as for the \verb|lg_pin| macro. Optional argument 7 is the pin length in drawing units. +\pagebreak +\FR{Multiplexer} shows a multiplexer block with variations, and + \FR{Demultiplexer} shows +the very similar demultiplexer. +\begin{figure}[h!t] + \input MultiplexerMan + \caption{The {\tt Mux({\sl input count}, {\sl label}, + [L][B|H|X][N[$n$]|S[$n$]][[N]OE],{\sl wid},{\sl ht})} macro.} + \label{Multiplexer} + \end{figure} +\begin{figure}[h!t] + \input DemultiplexerMan + \caption{The {\tt Demux({\sl input count}, {\sl label}, + [L][B|H|X][N[$n$]|S[$n$]][[N]OE],{\sl wid},{\sl ht})} macro.} + \label{Demultiplexer} + \end{figure} + Customized gates can be defined simply. For example, the following code defines the custom flipflops in \FR{ShiftR}. +\begin{verbatim} +define(`customFF',`FlipFlopX(wid 10*L_unit ht FF_ht*L_unit,, + :S;NE:CK;:R, N:PR, :Q;;ifelse(`$1',1,:lg_bartxt(Q)), N:CLR) ') +\end{verbatim} \begin{figure}[h!t] \input ShiftRMan \caption{A 5-bit shift register.} \label{ShiftR} \end{figure} -\begin{verbatim} -define(`customFF',`FlipFlopX(wid 10*L_unit ht FF_ht*L_unit,, - :S;NE:CK;:R, N:PR, :Q;;ifelse(`$1',1,:lg_bartxt(Q)), N:CLR) ') -\end{verbatim} This definition makes use of macros \verb|L_unit| and \verb|FF_ht| that predefine default dimensions. -There are three pins on the right side; the centre pin is null and +There are three pins on the right; the centre pin is null and the bottom is null if the first macro argument is 1. +\pagebreak For hybrid applications, the \verb|dac| and \verb|adc| macros are illustrated in \FR{Dac}. The figure shows the default and predefined internal locations, the number of which can be specified as macro arguments. -\begin{figure}[h!t] +\begin{figure}[ht] % \ifpdf\vspace*{-\baselineskip}\fi% \input Dac % \ifpdf\vspace*{-\baselineskip}\fi% @@ -2145,7 +2166,7 @@ can be given to the \char96{}{\sl actions}\char39, {\sl value1, value2, $\ldots$})} which executes the given actions successively with - {\sl variable} = {\sl value1}, {\sl value2} $ldots$ and the + {\sl variable} = {\sl value1}, {\sl value2} $\ldots$ and the counter {\tt m4Lx} set to 1, 2, $\ldots$ as in the diagram. \xection{Element and diagram scaling\label{Scaling:}} @@ -2291,7 +2312,7 @@ A few examples will be given. Custom two-terminal elements can often be defined by writing a wrapper for an existing element. For example, an enclosed thermal switch can be defined as shown in \FR{Thermal}. -\begin{figure}[h!t] +\begin{figure}[ht] \parbox{4.2in}{\tt define(`thermalsw',\hfill\break \hbox{}\space`dswitch(`\$1',`\$2',WDdBTh)\hfill\break \hbox{}\space\space circle rad distance(M4T,last line.c) @@ -2360,7 +2381,7 @@ define(`hybrid_PI_BJT', `"$\mathrm{r_o}$"' at Ro.c+vec_(hunit/4,0) `$2' ] ') \end{verbatim} -\begin{figure}[h!t] +\begin{figure}[ht] \vspace*{-0.5ex} \input HybridPi \vspace*{-0.5ex} @@ -2368,10 +2389,10 @@ define(`hybrid_PI_BJT', \label{HybridPi} \end{figure} +%\enlargethispage{\baselineskip} \Example{4} A number of elements have arguments meant explicitly for customization. -\FR{Sinus} customizes the {\tt source} macro to show a cycle of a horizontal -sinusoid with adjustable phase given by argument 2 in degrees, +\FR{Sinus} customizes the {\tt source} macro to show a cycle of a horizontal sinusoid with adjustable phase given by argument 2 in degrees, as might be wanted for a 3-phase circuit: \begin{figure}[ht] \hfill\input Sinus @@ -2391,14 +2412,13 @@ $3,$4,$5)') \end{figure} \Example{5} -Repeated subcircuits might have different orientations -that -include only the element and its mirror image, for example, so the +Repeated subcircuits might appear only +as the subcircuit and its mirror image, for example, so the power of the \verb|vec_()| and \verb|rvec_()| macros is not required. Suppose that an optoisolator is to be drawn with left-right or right-left orientation as shown in \FR{Opto}. %\vspace*{-0.5em} -\begin{figure}[h!t] +\begin{figure}[h!b] \input Opto \caption{Showing {\tt opto} and {\tt opto(BR)} with defined labels.} \label{Opto} @@ -2423,6 +2443,7 @@ for readability; this usage is made possible by testing the argument string using the {\tt ifinstr()} macro rather than requiring an exact match. A draft of the macro follows, and the file {\tt Optoiso.m4} in the examples directory adds a third type option. + \begin{verbatim} # `opto([R|L][A|B])' define(`opto',`[{u = dimen_/2 @@ -2470,7 +2491,7 @@ F2: fbfilter(L,R,K_2,C_{23},R_3) with .In at F1.In ground(at F2.G) \end{verbatim} \vspace*{-0.5em} -\begin{figure}[h!t] +\begin{figure}[ht] \input fbfilter \caption{Showing the result of two invocations of the {\tt fbfilter} macro, with labels.} @@ -2546,8 +2567,8 @@ main document source is \latex{}ed to input the diagram and format the text, and also to write the text dimensions into a supplementary file. Then the diagram source is processed again, reading the required dimensions from the supplementary file and producing a diagram ready -for final \latex{}ing. This hackery is summarized below, with an example -in \FR{stringdim}. +for final \latex{}ing. +This hackery is summarized below, with an example in \FR{stringdim}. \begin{itemize} \item Put \verb|\usepackage{boxdims}| into the document source. \item Insert the following at the beginning of the diagram source, @@ -2558,9 +2579,9 @@ in \FR{stringdim}. typeset text of known size, or alternatively, invoke the macros \verb|\boxdims| and \verb|boxdim| described later. The argument of {\tt s\_box} need not be text exclusively; it can - be anything that produces a \TeX\ box. + be anything that produces a \TeX\ box, for example, \verb|\includegraphics|. \end{itemize} -\begin{figure}[h!t] +\begin{figure}[ht] \parbox{3.5in}{\small\tt.PS\\ gen\_init\\ sinclude(Circuit\_macros.dim)\\ @@ -2649,6 +2670,8 @@ for the second time: Here is a second small example. Suppose that the file {\tt tsbox.m4} contains the following: + +\pagebreak \begin{verbatim} \documentclass{article} \usepackage{boxdims,ifpstricks(pstricks,tikz)} @@ -2682,7 +2705,7 @@ Objects can be taylored to their attached text by invoking The small source file in \FR{boxdims}, for example, produces the box in the figure. %\vspace*{-\baselineskip}% -\begin{figure}[h!t] +\begin{figure}[ht] \parbox{4.2in}{\small \input eboxdims.verb }% \hfill\llap{\raise-0.35in\hbox{\input eboxdims }}% \vspace{-\baselineskip} @@ -2736,13 +2759,12 @@ More tricks can be played. The example \noindent shows a nice way of including eps graphics in a diagram. The included picture (named {\tt Picture} in the example) has known position and dimensions, which can be used to add vector graphics or text to the -picture. To aid in overlaying objects, the macro {\tt boxcoord(}{\sl -object name, x-fraction, y-fraction}{\tt)} evaluates to a position, -with {\tt boxcoord(}{\sl object name}{\tt,0,0)} at the lower left -corner of the object, and {\tt boxcoord(}{\sl object name}{\tt,1,1)} at -its upper right. +picture. To aid in overlaying objects, the macro +{\tt boxcoord(}{\sl object name, x-fraction, y-fraction}{\tt)} +evaluates to a position, with {\tt boxcoord(}{\sl object name}{\tt,0,0)} +at the lower left corner of the object, and {\tt boxcoord(}{\sl object +name}{\tt,1,1)} at its upper right. -\pagebreak \xection{\PSTricks and other tricks\label{Pstricks:}} This section applies only to a \pic processor (\dpic) that is capable of producing output compatible with @@ -2764,7 +2786,7 @@ which contains both horizontal text and text rotated $90^\circ$ along the vertical line. This rotation of text is also implemented by the macro {\tt rs\_box}, which is similar -to {\tt s\_box} but rotates its text argument by $90^\circ,$ a default angle +to {\tt s\_box} but rotates its argument by~$90^\circ,$ a default angle that can be changed by preceding invocation with \verb|define(`text_ang',|{\sl degrees}{\tt )}. The {\tt rs\_box} macro requires either \PSTricks or \TPGF and, like {\tt s\_box}, it calculates the @@ -2814,15 +2836,6 @@ macros such as {\tt rs\_box}, {\tt shade}, and {\tt rgbfill} mentioned previously can be used to hide code differences. \subsection{\Tikz\ with pic}\label{Tikzwithpic:} -%The line -% -%\vspace{\parsep} -%\noindent{\tt command "}{\sl string}{\tt "} -%\vspace{\parsep} -% -%\noindent -%allows arbitrary postprocessor code to be embedded in \pic output. However, -%one can also embed Arbitrary \pic output can be inserted into a {\tt \bsl{}tikzpicture} environment. The trick is to keep the \pic and \Tikz coordinate systems the same. @@ -2830,14 +2843,14 @@ The lines \vspace{\parsep} \noindent\verb|\begin{tikzpicture}[scale=2.54]|\\ -\noindent\verb|\end{tikzpicture}| +\noindent\verb|\end{tikzpicture}%| \vspace{\parsep} \noindent in the {\tt dpic -g} output must be changed to \vspace{\parsep} \noindent\verb|\begin{scope}[scale=2.54]|\\ -\noindent\verb|\end{scope}| +\noindent\verb|\end{scope}%| \vspace{\parsep} This is accomplished, for example, by adapting the {\tt \bsl{}mtotex} @@ -3010,6 +3023,7 @@ With raw \Postscript, \PDF, and \SVG output, the user is responsible for ensuring that the correct fonts are provided and for formatting the text. +\pagebreak Many thanks to the people who continue to send comments, questions, and, occasionally, bug fixes. What began as a tool for my own use changed into a hobby that has persisted, thanks to your help and advice. @@ -3181,6 +3195,8 @@ repaired by using an \Mfour loop: {\tt for\_(1,5,1,`s\_box(A[m4x]); move')} +Note that the loop index variable {\tt m4x} is automatically defined. + \item \bflistitem{Quotes}{quotes} Single quote characters are stripped in pairs by \Mfour, so the string @@ -3201,6 +3217,11 @@ repaired by using an \Mfour loop: not optimal or where the quotes could be omitted, and there are rare exceptions such as the {\tt parallel\_} macro. + To keep track of paired single quotes, parentheses ``{\tt (}, {\tt)},'' + braces ``\lbr, \rbr,'' and brackets ``{\tt [}, {\tt ]},'' use an editor + that highlights these pairs. For example, the vim editor highlights + single quotes with the command \verb|:set mps+=`:'|. + \item \bflistitem{Dollar signs}{dollarsigns} The $i$-th argument of an \Mfour macro is {\tt \$}$i,$ where $i$ is |