Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/dpv/tstDPV.htmx

raw
1 <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
2 <HTML>
3 <HEAD>
4 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <!--meta http-equiv="Content-Script-Type" content="text/javascript"-->
7 <TITLE>SVG Examples: Circuit_macros Version XXX</TITLE>
8 <meta name="keywords" content="HTML"
9 content='Circuit elements, basic circuits, logic circuits and other diagrams,
10 electric circuits, resistor, capacitor, inductor, diode, sources, amplifier,
11 integrator, fuse, switch, antenna, opamp, transformer, relay, contact, jack,
12 plug, FET, UJT, thyristor, bipolar transistor, nport, windings, timer,
13 optical isolator, rectifier, bistable, oscillator, CMOS, MOSFET, power supply,
14 NAND gate, controlled source, synchronous machine, digital circuit, signal-flow
15 graph, latch, decoder, flipflop, full adder, logic diagram, crossbar switch,
16 dimensioning, control system, graph, RGB colors, recursion, binary tree,
17 flowcharts, picture overlay, ASME Y14.5' >
18
19 <style type="text/css">
20 </style>
21 <link rel="shortcut icon" href="../Circuit_macros.ico" type="image/x-icon" />
22 </HEAD>
23
24 `<!-- Google tag (gtag.js) -->
25 <script async src="https://www.googletagmanager.com/gtag/js?id=G-HRS8TQGRE8"></script>
26 <script>
27 window.dataLayer = window.dataLayer || [];
28 function gtag(){dataLayer.push(arguments);}
29 gtag('js', new Date());
30
31 gtag('config', 'G-HRS8TQGRE8');
32 </script>'
33
34
35 <!-- m4 macros: ------------------------------------------------------------
36 define(`ifinstr',`ifelse(`$2',,`$1',index(`$1',`$2'),-1,
37 `ifinstr(shift(shift(shift($@))))',`$3')')
38
39 define(`m4tt',`<g style="font-family:monospace">')
40
41 dnl cfig( svg filename, [textfile], [y], [OBJECT] )
42 define(`cfig',`
43 <p>
44 dnl The object type is needed for the overlay
45 dnl example
46 ifelse(`$4',OBJECT,
47 `<object data="$1.svg" type="image/svg+xml" class="img"></object>',
48 `<IMG SRC="$1.svg">')
49 dnl
50 ifelse(`$2',,,`<br><br>
51 <a href="$1.txt" TYPE="text/plain" TARGET="_blank" alt="$1">$1.m4:</a>
52 `$2' changecom(,)&`#'8194;changecom(`#')')
53 </p>
54 ifinstr(`$3',y,,`<hr>')')
55
56 --------------------------------------------------------------------- -->
57
58 <BODY>
59 <table cellpadding="0" cellspacing="0"
60 width="700px" border="0" align="center" ><tr><td>
61
62 <H2>SVG Circuit_macros examples, Version XXX</H2>
63
64 <A HREF="../../index.html">Home</A>
65 &#62;
66 <A HREF="examples.html">Examples</A>
67 &#62;
68 <A HREF="examplesDPV.html">SVG</A>
69
70 <hr>
71
72 <p>
73 This file shows diagrams in .svg format produced without the use of
74 LaTeX or equivalent.
75 <!--
76 <A HREF="examples.html">png</A>
77 versions are also available.
78 The PDF equivalent can be found in examples.pdf of the distribution.
79 </p>
80
81 <p>
82 -->
83 The diagrams have been adapted from the Circuit_macros
84 examples in order to test the svg output of dpic. Generating svg line
85 art is straightforward but formatting text is not because TeX, LaTeX,
86 and related word processors do not produce svg directly. Either
87 less-sophisticated text formatting must be employed for svg or an
88 <A HREF="https://en.wikibooks.org/wiki/LaTeX/Export_To_Other_Formats">
89 intermediate format</A>
90 such as pdf can be
91 produced, followed by an additional processing step to convert to svg.
92 Two possibilities for the latter are
93 <A HREF="https://www.ctan.org/pkg/dvisvgm">dvisvgm</A>
94 and
95 <A HREF="https://github.com/dawbarton/pdf2svg">pdf2svg</A>.
96 However, many circuit and similar diagrams intended for the web do not
97 require sophisticated labels; the examples shown below might
98 be representative.
99 </p>
100 <p>
101 Click on the link to view the source of each diagram.
102 </p>
103 <hr>
104 <p>
105 There are other issues:
106 <ul>
107 <li> The default font face is not specified in all of these diagrams but is
108 inherited from the enclosing document, so the appearance of labels can
109 differ depending on the browser. Some of these diagrams set the font at
110 the beginning of the diagram source.
111 <li> The &lt;svg tag may require modification
112 from the default used for this test.
113 <!-- Dpic might be modified to
114 allow the generation of custom headers but that has not been done. -->
115 <li> Diagrams such as these contain text labels
116 that have to be treated differently from the LaTeX-compatible versions.
117 Apparently there is no direct way to know the bounding box of arbitrary svg
118 text.
119 <!-- text, as discussed
120 <a href="http://www.aditus.nu/jpgraph/jpg_svg.php" TARGET="_blank">here,</a>
121 for example. -->
122 Consequently, text placement is approximate and may require
123 manual adjustment.
124 Rather than patch the original source files for svg production, edited copies
125 have been used. The configuration file svg.m4 read by m4
126 prior to libcct.m4 contains the following macros defined for svg.
127 Others could be defined to exercise some of the media capabilties of svg.
128 They are subject to change:
129 <ul>
130 <li>
131 m4tt`'svg_font(</g>font-face,nominal size[:dptextratio],textoffset,
132 dpic commands`'m4tt)</g>:
133 Change font face and dpic m4tt`'textht</g>, m4tt`'dptextratio</g>,
134 and m4tt`'textoffset</g> parameters.
135 If arg4 is blank, the font is changed and
136 requires m4tt`'command "&lt;/g&gt;"</g> to cancel the font change.
137 <br>
138 Note:
139 Nominal height = text height in drawing units; actual height =
140 nominal ht x m4tt`'dptextratio</g>.
141 <br>
142 Examples: <br>
143 m4tt`'svg_font(Times)</g><br>
144 m4tt`'svg_font(Times,14bp__)</g><br>
145 m4tt`'svg_font(sans-serif,14bp__:0.71)</g><br>
146 m4tt`'svg_font(Times,11bp__,1bp__,"text" at A)</g><br>
147 m4tt`'svg_font(font-family="Times")</g><br>
148 m4tt`'svg_font(font-family="Times" font-style="italic")</g><br>
149 m4tt`'svg_font(style="font-family:Times; font-style:italic")</g>
150 <li>m4tt svgfontratio(</g>font name`'m4tt)</g>;
151 Reasonable m4tt`'dptextratio</g> value for common fonts, used
152 by m4tt`'svg_font</g>.
153 <li>m4tt svg_tspan(</g>text attributes, text`'m4tt)</g>;
154 e.g. m4tt`'svg_tspan(font-style="italic" font-size="75%",XYZ)</g>
155 <li>m4tt svg_it(</g>text`'m4tt)</g>: for italics
156 <li>m4tt svg_tt(</g>text`'m4tt)</g>: for monospace (courier)
157 <li>m4tt svg_sf(</g>text`'m4tt)</g>: sans-serif (Helvetica)
158 <li>m4tt svg_norm(</g>text`'m4tt)</g>: for normal text
159 <li>m4tt svg_bf(</g>text`'m4tt)</g>: for bold face
160 <li>m4tt svg_small(</g>text, percent`'m4tt)</g>:
161 to set a smaller text size, default 66
162 <li>m4tt svg_fsize(</g>text, percent`'m4tt)</g>:
163 for setting larger or smaller text size, default 100
164 <li>m4tt svg_sub(</g>text, size percent, y displ, x displ`'m4tt)</g>:
165 subscript
166 <li>m4tt svg_ul(</g>text`'m4tt)</g>: underlined text
167 <li>m4tt svg_ol(</g>text`'m4tt)</g>: overlined text
168 <li>m4tt svg_sup(</g>text, size percent, y displ, x displ`'m4tt)</g>:
169 superscript
170 <li>m4tt svg_hat(</g>character`'m4tt)</g>: circumflex-accented character
171 <li>m4tt svg_frac(</g>numerator[:wid], denominator[:wid]`'m4tt)</g>:
172 basic fraction, wid in drawing units
173 <li>m4tt svg_rot(</g>degrees, "text" [at position]`'m4tt)</g>:
174 Rotate text degrees (default 90) ccw.
175 Requires m4tt`'svg_rot_init(</g>filename`'m4tt)</g> and the source
176 must be processed twice.
177 <li>m4tt svg_rot_init(</g>filename`'m4tt)</g>:
178 filename is the basename of the output of
179 m4tt`'dpic -v filename.pic > filename.svg`'m4tt
180 <li>m4tt svg_symbol(</g>text`'m4tt)</g>: allow quoted pound sign in text,
181 e.g., m4tt`'svg_symbol(10&&#96;&#35;&#39;176;)</g> produces 10&#176;
182 <li>m4tt svgLink(</g>URL, drawing object, m4tt[B])</g>:
183 link to external file using
184 &lt;a xlink:href=...&gt;...&lt;/a&gt; (default is
185 m4tt`'target="_blank"</g> unless
186 arg 3 = B)
187 <li>m4tt svgLinkString</g> as above but for strings attached to objects
188 <li> Greek and other symbols:
189
190 <!--
191 Reference:
192 https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
193 and
194 https://www.toptal.com/designers/htmlarrows/math/
195 -->
196 <table cellpadding="2" cellspacing="0" width="75%" >
197 <tr>
198 <td width="10%"> m4tt svg_alpha</g> <td align="left"> changecom(,)&`#'945;changecom(`#')
199 <td width="10%"> m4tt svg_beta</g> <td align="left"> changecom(,)&`#'946;changecom(`#')
200 <td width="10%"> m4tt svg_Gamma</g> <td align="left"> changecom(,)&`#'915;changecom(`#')
201 <td width="10%"> m4tt svg_gamma</g> <td align="left"> changecom(,)&`#'947;changecom(`#')
202 <td width="10%"> m4tt svg_Delta</g> <td align="left"> changecom(,)&`#'916;changecom(`#')
203 <td width="10%"> m4tt svg_delta</g> <td align="left"> changecom(,)&`#'948;changecom(`#')
204 <td width="10%"> m4tt svg_epsilon</g> <td align="left"> changecom(,)&`#'949;changecom(`#')
205 <td width="10%"> m4tt svg_zeta</g> <td align="left"> changecom(,)&`#'950;changecom(`#')
206 </tr>
207 <tr>
208 <td width="10%"> m4tt svg_eta</g> <td align="left"> changecom(,)&`#'951;changecom(`#')
209 <td width="10%"> m4tt svg_Theta</g> <td align="left"> changecom(,)&`#'920;changecom(`#')
210 <td width="10%"> m4tt svg_theta</g> <td align="left"> changecom(,)&`#'952;changecom(`#')
211 <td width="10%"> m4tt svg_iota</g> <td align="left"> changecom(,)&`#'953;changecom(`#')
212 <td width="10%"> m4tt svg_kappa</g> <td align="left"> changecom(,)&`#'954;changecom(`#')
213 <td width="10%"> m4tt svg_Lambda</g> <td align="left"> changecom(,)&`#'923;changecom(`#')
214 <td width="10%"> m4tt svg_lambda</g> <td align="left"> changecom(,)&`#'955;changecom(`#')
215 <td width="10%"> m4tt svg_mu</g> <td align="left"> changecom(,)&`#'956;changecom(`#')
216 </tr>
217 <tr>
218 <td width="10%"> m4tt svg_nu</g> <td align="left"> changecom(,)&`#'957;changecom(`#')
219 <td width="10%"> m4tt svg_Xi</g> <td align="left"> changecom(,)&`#'926;changecom(`#')
220 <td width="10%"> m4tt svg_xi</g> <td align="left"> changecom(,)&`#'958;changecom(`#')
221 <td width="10%"> m4tt svg_Pi</g> <td align="left"> changecom(,)&`#'928;changecom(`#')
222 <td width="10%"> m4tt svg_pi</g> <td align="left"> changecom(,)&`#'960;changecom(`#')
223 <td width="10%"> m4tt svg_rho</g> <td align="left"> changecom(,)&`#'961;changecom(`#')
224 <td width="10%"> m4tt svg_Sigma</g> <td align="left"> changecom(,)&`#'931;changecom(`#')
225 <td width="10%"> m4tt svg_sigma</g> <td align="left"> changecom(,)&`#'963;changecom(`#')
226 </tr>
227 <tr>
228 <td width="10%"> m4tt svg_tau</g> <td align="left"> changecom(,)&`#'964;changecom(`#')
229 <td width="10%"> m4tt svg_upsilon</g> <td align="left"> changecom(,)&`#'965;changecom(`#')
230 <td width="10%"> m4tt svg_Phi</g> <td align="left"> changecom(,)&`#'934;changecom(`#')
231 <td width="10%"> m4tt svg_phi</g> <td align="left"> changecom(,)&`#'966;changecom(`#')
232 <td width="10%"> m4tt svg_chi</g> <td align="left"> changecom(,)&`#'967;changecom(`#')
233 <td width="10%"> m4tt svg_Psi</g> <td align="left"> changecom(,)&`#'936;changecom(`#')
234 <td width="10%"> m4tt svg_psi</g> <td align="left"> changecom(,)&`#'968;changecom(`#')
235 <td width="10%"> m4tt svg_Omega</g> <td align="left"> changecom(,)&`#'937;changecom(`#')
236 </tr>
237 <tr>
238 <td width="10%"> m4tt svg_omega</g> <td align="left"> changecom(,)&`#'969;changecom(`#')
239 <td width="10%"> m4tt svg_micro</g> <td align="left"> changecom(,)&`#'956;changecom(`#')
240 <td width="10%"> m4tt svg_ohm</g> <td align="left"> changecom(,)&`#'937;changecom(`#')
241 <td width="10%"> m4tt svg_lt</g> <td align="left"> changecom(,)&`#'60;changecom(`#')
242 <td width="10%"> m4tt svg_gt</g> <td align="left"> changecom(,)&`#'62;changecom(`#')
243 <td width="10%"> m4tt svg_leq</g> <td align="left"> changecom(,)&`#'8804;changecom(`#')
244 <td width="10%"> m4tt svg_geq</g> <td align="left"> changecom(,)&`#'8805;changecom(`#')
245 <td width="10%"> m4tt svg_prime</g> <td align="left"> changecom(,)&`#'8242;changecom(`#')
246 </tr>
247 <tr>
248 <td width="10%"> m4tt svg_backsl</g> <td align="left"> changecom(,)&`#'92;changecom(`#')
249 <td width="10%"> m4tt svg_pound</g> <td align="left"> changecom(,)&`#'35;changecom(`#')
250 <td width="10%"> m4tt svg_comma</g> <td align="left"> changecom(,)&`#'44;changecom(`#')
251 <td width="10%"> m4tt svg_lparen</g> <td align="left"> changecom(,)&`#'40;changecom(`#')
252 <td width="10%"> m4tt svg_rparen</g> <td align="left"> changecom(,)&`#'41;changecom(`#')
253 <td width="10%"> m4tt svg_circ</g> <td align="left"> changecom(,)&`#'710;changecom(`#')
254 <td width="10%"> m4tt svg_deg</g> <td align="left"> changecom(,)&`#'176;changecom(`#')
255 <td width="10%"> m4tt svg_grave</g> <td align="left"> changecom(,)&`#'96;changecom(`#')
256 </tr>
257 </table>
258 <table cellpadding="2" cellspacing="0" width="75%" >
259 <tr>
260 <td width="15%"> m4tt svg_amp</g> <td align="left"> changecom(,)&`#'38;changecom(`#')
261 <td width="8%"> m4tt svg_emsp</g> <td width="50px" align="left"> |changecom(,)&`#'8195;changecom(`#')|
262 <td width="8%"> m4tt svg_ensp</g> <td width="50px" align="left"> |changecom(,)&`#'8194;changecom(`#')|
263 <td width="8%"> m4tt svg_thinsp</g> <td width="50px" align="left"> |changecom(,)&`#'8201;changecom(`#')|
264 <td width="10%"> m4tt svg_equiv</g> <td align="left"> changecom(,)&`#'8801;changecom(`#')
265 <td width="10%"> m4tt svg_tilde</g> <td align="left"> changecom(,)&`#'126;changecom(`#')
266 <td width="10%"> m4tt svg_uscore</g> <td align="left"> changecom(,)&`#'95;changecom(`#')
267 </tr>
268 </table>
269
270 </ul>
271 <li> Inkscape: It may be efficient to define elements by macro and to
272 place them using a wysiwyg graphics editor. A draft page intended
273 for Inkscape is included. A reasonable variety of elements is defined
274 but many more could be added and they should be customized for
275 particular applications. Adjustments may also have to be made to
276 obtain the proper snap-to actions.
277 <!--
278 <li> Link experiments: Click on the resistor or source of quickDPV
279 to go to external
280 files in new windows. Click on "n-port" in NportDPV to replace the diagram
281 and then "back" to return.
282 -->
283 <li> Some of the assumptions used to create this draft may be
284 na&`#'239;ve.
285 Comments are welcome.
286 </ul>
287
288 <hr>
289
290 cfig(XXXXX)
291
292 </td>
293 </tr>
294 </table>
295 </BODY>
296 </HTML>