1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
|
% Copyright 2018-2020 by Romano Giannetti
% Copyright 2015-2020 by Stefan Lindner
% Copyright 2013-2020 by Stefan Erhardt
% Copyright 2007-2020 by Massimo Redaelli
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
\NeedsTeXFormat{LaTeX2e}
\def\pgfcircversion{1.2.6}
\def\pgfcircversiondate{2020/12/16}
\ProvidesPackage{circuitikz}%
[\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion]
%% Version 3.0 of pgf/TikZ is required
\RequirePackage{tikz}
\usetikzlibrary{calc}
%
% "arrows" library is deprecated, and behave badly with
% arrows on short paths. Change to the new arrows.meta
% In pfgcirc.define, we will add the old definition of
% latex' which we have lost in the transition
%
\usetikzlibrary{arrows.meta, bending}
\usetikzlibrary{fpu} % may be needed for use fpu reciprocal (v1.0.1)
%
% global of options (better use styles!)
%
\DeclareOption{european}{
\ctikzset{voltage=european} \ctikzset{current=european} \ctikzset{inductor=european}
\ctikzset{resistor=european} \ctikzset{logic ports=european} \ctikzset{gas filled surge arrester choice = european}
}
\DeclareOption{american}{
\ctikzset{voltage=american} \ctikzset{current=american} \ctikzset{resistor=american} \ctikzset{inductor=american} \ctikzset{gas filled surge arrester choice = american}
\ctikzset{logic ports = american}
}
\DeclareOption{siunitx}{
\pgf@circ@siunitxtrue
}
\DeclareOption{nosiunitx}{
\pgf@circ@siunitxfalse
}
\DeclareOption{compatibility}{
\pgf@circuit@compattrue
}
%
% voltages
%
\DeclareOption{europeanvoltage}{
\ctikzset{voltage=european}
}
\DeclareOption{straightvoltages}{
\ctikzset{voltage=straight}
}
\DeclareOption{americanvoltage}{
\ctikzset{voltage=american}
}
\DeclareOption{europeanvoltages}{
\ctikzset{voltage=european}
}
\DeclareOption{americanvoltages}{
\ctikzset{voltage=american}
}
% Voltage directions
\DeclareOption{oldvoltagedirection}{
\pgf@circ@oldvoltagedirectiontrue
\pgf@circ@explicitvdirtrue
\pgf@circ@fixbatteriesfalse
}
\DeclareOption{nooldvoltagedirection}{
\pgf@circ@oldvoltagedirectionfalse
\pgf@circ@explicitvdirtrue
\pgf@circ@fixbatteriesfalse
}
\DeclareOption{RPvoltages}{
\pgf@circ@oldvoltagedirectiontrue
\pgf@circ@explicitvdirtrue
\pgf@circ@fixbatteriestrue
}
\DeclareOption{EFvoltages}{
\pgf@circ@oldvoltagedirectionfalse
\pgf@circ@explicitvdirtrue
\pgf@circ@fixbatteriestrue
}
%
% currents
%
\DeclareOption{europeancurrent}{
\ctikzset{current = european}
}
\DeclareOption{americancurrent}{
\ctikzset{current = american}
}
\DeclareOption{europeancurrents}{
\ctikzset{current = european}
}
\DeclareOption{americancurrents}{
\ctikzset{current = american}
}
%
% resistors
%
\DeclareOption{americanresistor}{
\ctikzset{resistor = american}
}
\DeclareOption{europeanresistor}{
\ctikzset{resistor = european}
}
\DeclareOption{americanresistors}{
\ctikzset{resistor = american}
}
\DeclareOption{europeanresistors}{
\ctikzset{resistor = european}
}
%
% inductors
%
\DeclareOption{americaninductor}{
\ctikzset{inductor = american}
}
\DeclareOption{europeaninductor}{
\ctikzset{inductor = european}
}
\DeclareOption{cuteinductor}{
\ctikzset{inductor = cute}
}
\DeclareOption{americaninductors}{
\ctikzset{inductor = american}
}
\DeclareOption{europeaninductors}{
\ctikzset{inductor = european}
}
\DeclareOption{cuteinductors}{
\ctikzset{inductor = cute}
}
%
% logic ports
%
\DeclareOption{americanport}{
\ctikzset{logic ports = american}
}
\DeclareOption{europeanport}{
\ctikzset{logic ports = european}
}
\DeclareOption{americanports}{
\ctikzset{logic ports = american}
}
\DeclareOption{europeanports}{
\ctikzset{logic ports = european}
}
%
% surge arresters (really?)
%
\DeclareOption{americangfsurgearrester}{
\ctikzset{gas filled surge arrester choice = american}
}
\DeclareOption{europeangfsurgearrester}{
\ctikzset{gas filled surge arrester choice = european}
}
%
% diodes
%
\DeclareOption{fulldiodes}{
\ctikzset{diode = full}
}
\DeclareOption{emptydiodes}{
\ctikzset{diode = empty}
}
\DeclareOption{strokediodes}{
\ctikzset{diode = stroke}
}
\DeclareOption{fulldiode}{
\ctikzset{diode = full}
}
\DeclareOption{emptydiode}{
\ctikzset{diode = empty}
}
\DeclareOption{strokediode}{
\ctikzset{diode = stroke}
}
%
% MOSes and FETs
%
\DeclareOption{arrowmos}{
\pgf@circuit@mos@arrowstrue
}
\DeclareOption{noarrowmos}{
\pgf@circuit@mos@arrowsfalse
}
\DeclareOption{fetbodydiode}{
\pgf@circuit@fet@bodydiodetrue
}
\DeclareOption{nofetbodydiode}{
\pgf@circuit@fet@bodydiodefalse
}
\DeclareOption{fetsolderdot}{
\pgf@circuit@fet@solderdottrue
}
\DeclareOption{nofetsolderdot}{
\pgf@circuit@fet@solderdotfalse
}
\DeclareOption{emptypmoscircle}{
\pgf@circuit@pmos@emptycircletrue
}
\DeclareOption{lazymos}{
\ctikzset{tripoles/nmos/width=.5}
\ctikzset{tripoles/nmos/gate height=.35}
\ctikzset{tripoles/nmos/base height=.35}
\ctikzset{tripoles/nmos/height/.initial=1.2}
\ctikzset{tripoles/nmos/base width=.5}
\ctikzset{tripoles/nmos/gate width=.65}
\ctikzset{tripoles/pmos/width=.5}
\ctikzset{tripoles/pmos/gate height=.35}
\ctikzset{tripoles/pmos/base height=.35}
\ctikzset{tripoles/pmos/height/.initial=1.2}
\ctikzset{tripoles/pmos/base width=.5}
\ctikzset{tripoles/pmos/gate width=.65}
\pgf@circuit@pmos@emptycircletrue
}
%
% BJTs labels
%
\DeclareOption{legacytransistorstext}{
\pgf@circuit@transisors@fixlabelsfalse
}
\DeclareOption{nolegacytransistorstext}{
\pgf@circuit@transisors@fixlabelstrue
}
\DeclareOption{centertransistorstext}{
\pgf@circuit@transisors@fixlabelstrue
}
%
% labels
%
\DeclareOption{straightlabels}{
\ctikzset{label/align = straight}
}
\DeclareOption{rotatelabels}{
\ctikzset{label/align = rotate}
}
\DeclareOption{smartlabels}{
\ctikzset{label/align = smart}
}
%
% Several options (better use styles)
%
\DeclareOption{betterproportions}{
\ctikzset{monopoles/ground/width/.initial=.15}
\ctikzset{bipoles/resistor/height/.initial=.23}
\ctikzset{bipoles/resistor/width/.initial=.6}
\ctikzset{bipoles/capacitor/height/.initial=.4}
\ctikzset{bipoles/capacitor/width/.initial=.1}
\ctikzset{bipoles/potentiometer/height/.initial=.6}
\ctikzset{bipoles/potentiometer/height 2/.initial=.23}
\ctikzset{bipoles/potentiometer/width/.initial=.6}
\ctikzset{bipoles/photoresistor/height/.initial=.6}
\ctikzset{bipoles/photoresistor/height 2/.initial=.23}
\ctikzset{bipoles/photoresistor/width/.initial=.6}
\ctikzset{bipoles/thermistor/main/.initial=.7}
\ctikzset{bipoles/thermistor/height/.initial=.328}%.23/.7
\ctikzset{bipoles/thermistor/width/.initial=.6}
\ctikzset{bipoles/thermistorntc/width/.initial=.6}
\ctikzset{bipoles/thermistorntc/main/.initial=.7}
\ctikzset{bipoles/thermistorntc/height/.initial=.328}%.23/.7
\ctikzset{bipoles/thermistorntc/height 2/.initial=.75}%.23/.7
\ctikzset{bipoles/thermistorptc/width/.initial=.6}
\ctikzset{bipoles/thermistorptc/main/.initial=.7}
\ctikzset{bipoles/thermistorptc/height/.initial=.328}%.23/.7
\ctikzset{bipoles/varistor/main/.initial=.7}
\ctikzset{bipoles/varistor/height/.initial=.328}%.23/.7
\ctikzset{bipoles/varistor/width/.initial=.6}
\ctikzset{bipoles/vresistor/height/.initial=.45}
\ctikzset{bipoles/vresistor/width/.initial=.6}
\ctikzset{bipoles/generic/height/.initial=.23}
\ctikzset{bipoles/generic/width/.initial=.6}
\ctikzset{bipoles/generic potentiometer/height/.initial=.6}
\ctikzset{bipoles/generic potentiometer/height 2/.initial=.23}
\ctikzset{bipoles/generic potentiometer/width/.initial=.6}
\ctikzset{bipoles/ageneric/height/.initial=.23}
\ctikzset{bipoles/ageneric/width/.initial=.6}
\ctikzset{bipoles/memristor/height/.initial=.23}
\ctikzset{bipoles/memristor/wave height/.initial=.375}
\ctikzset{bipoles/memristor/width/.initial=.60}
\ctikzset{bipoles/tgeneric/height/.initial=.525}
\ctikzset{bipoles/tgeneric/width/.initial=.6}
\ctikzset{bipoles/tfullgeneric/height/.initial=.525}
\ctikzset{bipoles/tfullgeneric/width/.initial=.60}
\ctikzset{bipoles/fullgeneric/height/.initial=.23}
\ctikzset{bipoles/fullgeneric/width/.initial=.6}
\ctikzset{bipoles/diode/height/.initial=.3}
\ctikzset{bipoles/diode/width/.initial=.25}
\ctikzset{bipoles/bidirectionaldiode/height/.initial=.66}
\ctikzset{bipoles/bidirectionaldiode/width/.initial=.6}
\ctikzset{bipoles/bidirectionaldiode/diode width left/.initial=.3}
\ctikzset{bipoles/bidirectionaldiode/diode width right/.initial=.3}
\ctikzset{tripoles/thyristor/height/.initial=.66}
\ctikzset{tripoles/thyristor/height 2/.initial=.3}
\ctikzset{tripoles/thyristor/width/.initial=.6}
\ctikzset{tripoles/thyristor/diode height/.initial=.3}
\ctikzset{tripoles/thyristor/diode width left/.initial=.4}
\ctikzset{tripoles/thyristor/diode width right/.initial=.3}
\ctikzset{tripoles/triac/height/.initial=.66}
\ctikzset{tripoles/triac/width/.initial=.6}
\ctikzset{tripoles/triac/diode width left/.initial=.3}
\ctikzset{tripoles/triac/diode width right/.initial=.3}
}
% This is a nice hack that prints all the shapes declared
% by the package. Very useful for coverage testing and debugging.
%
% \let\origpgfdeclareshape=\pgfdeclareshape
% \def\pgfdeclareshape#1{%
% \typeout{SHAPE:\space"#1"}%
% \origpgfdeclareshape{#1}
% }
%
%
%%%%%%%%%
\input pgfcirc.defines.tex
\input pgfcircutils.tex
\input pgfcircshapes.tex
\input pgfcircmonopoles.tex
\input pgfcircbipoles.tex
\input pgfcirctripoles.tex
\input pgfcircquadpoles.tex
\input pgfcircmultipoles.tex
\input pgfcirclabel.tex
\input pgfcircvoltage.tex
\input pgfcirccurrent.tex
\input pgfcircflow.tex
% notice that the default is nooldvoltagedirection; it's not explicitly set to allow for the warning
\ExecuteOptions{nofetbodydiode, nofetsolderdot, europeancurrents, europeanvoltages, americanports, americanresistors, cuteinductors ,europeangfsurgearrester, nosiunitx, noarrowmos, smartlabels}
\ProcessOptions\relax
\input pgfcircpath.tex
\ifpgf@circ@siunitx
\RequirePackage{xstring}[2009/03/13]
%\expandafter\let\csname angstrom\endcsname\relax
\RequirePackage{siunitx}
\fi
\ifpgf@circ@explicitvdir\else
\PackageWarningNoLine{circuitikz}{%
You did not specify one of the voltage directions:\MessageBreak
\space\space oldvoltagedirection, nooldvoltagedirection, \MessageBreak
\space\space RPvoltages or EFvoltages \MessageBreak
Default directions may have changed, \MessageBreak
please check the manual%
}
\fi
\newenvironment{circuitikz}{\begin{tikzpicture}}{\end{tikzpicture}}
%override (unused) circuitikz environment for compability to externalization)
\let\circuitikz\tikzpicture
\let\endcircuitikz\endtikzpicture
\endinput
|