Debian Codegraph @

texmf-dist/tex/context/third/circuitikz/t-circuitikz.tex

raw
1 % Copyright 2018-2026 by Romano Giannetti
2 % Copyright 2015-2026 by Stefan Lindner
3 % Copyright 2013-2026 by Stefan Erhardt
4 % Copyright 2007-2026 by Massimo Redaelli
5 %
6 % This file may be distributed and/or modified
7 %
8 % 1. under the LaTeX Project Public License and/or
9 % 2. under the GNU Public License.
10 %
11 % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details.
12 %
13 % This module file is normally overriden by the provided m-circuitikz.tex
14 % in the newer ConTeXt distributions.
15 %
16 \startmodule[circuitikz]
17 \usemodule[tikz]
18
19 \def\pgfcircversion{1.8.6}
20 \def\pgfcircversiondate{2026/05/24}
21 \writestatus{loading}{\pgfcircversiondate{} The CircuiTikz circuit drawing package version \pgfcircversion}
22
23
24 \usetikzlibrary[calc]
25 \usetikzlibrary[arrows.meta, bending]
26 \usetikzlibrary[fpu] % may be needed for use fpu reciprocal (v1.0.1)
27
28 \unprotect
29
30 \edef\tikzatcode{\the\catcode`\@}
31 \edef\tikzbarcode{\the\catcode`\|}
32 \edef\tikzexclaimcode{\the\catcode`\!}
33 \catcode`\@=11
34 \catcode`\|=12
35 \catcode`\!=12
36
37 \input pgfcirc.defines.tex
38 \input pgfcircutils.tex
39 \input pgfcircpath.tex
40
41 \input pgfcircshapes.tex
42 \input pgfcircmonopoles.tex
43 \input pgfcircbipoles.tex
44 \input pgfcirctripoles.tex
45 \input pgfcircquadpoles.tex
46 \input pgfcircmultipoles.tex
47
48 \input pgfcirclabel.tex
49 \input pgfcircvoltage.tex
50 \input pgfcirccurrent.tex
51 \input pgfcircflow.tex
52
53 % defaults
54
55 \setupmodule
56 [current=european,
57 voltage=european,
58 resistor=american,
59 inductor=cute,
60 logic=american,
61 siunitx=true,
62 arrowmos=false]
63
64 \processaction
65 [\currentmoduleparameter{voltage}]
66 [european=>\ctikzset{voltage=european},
67 american=>\ctikzset{voltage=american}]
68
69 \processaction
70 [\currentmoduleparameter{current}]
71 [european=>\ctikzset{ current=european},
72 american=>\ctikzset{ current=american}]
73
74 \processaction
75 [\currentmoduleparameter{label}]
76 [straight=>\ctikzset{label/align = straight},
77 align=>\ctikzset{label/align = rotate},
78 smart=>\ctikzset{label/align = smart}]
79
80 \processaction
81 [\currentmoduleparameter{resistor}]
82 [european=>\ctikzset{ resistor=european},
83 american=>\ctikzset{ resistor=american}]
84
85 \processaction
86 [\currentmoduleparameter{inductor}]
87 [european=>\ctikzset{ inductor=european},
88 american=>\ctikzset{ inductor=american},
89 cute=>\ctikzset{ inductor=cute}]
90
91 \processaction
92 [\currentmoduleparameter{diode}]
93 [full=>\ctikzset{ diode=full},
94 empty=>\ctikzset{ diode=empty}]
95
96 \processaction
97 [\currentmoduleparameter{logic}]
98 [european=>\ctikzset{ logic ports=european},
99 american=>\ctikzset{ logic ports=american}]
100
101 % This tiny siunitx emulation layer (REALLY tiny) is practically never
102 % enabled because recent ConTeXt releases override this file with
103 % m-circuitikz.tex and in that file it has been removed.
104
105 \processaction
106 [\currentmoduleparameter{siunitx}]
107 [true=>\def\SI#1#2{#1\,#2}
108 \def\ampere{\rm{A}}
109 \def\volt{\rm{V}}
110 \def\ohm{\Omega}
111 \def\siemens{\rm{S}}
112 \def\farad{\rm{F}}
113 \def\henry{\rm{H}}
114 \def\second{\rm{s}}
115 \def\coulomb{\rm{C}}
116 \def\siemens{\rm{S}}
117 \def\radians{\rm{rad}}
118 \def\milli{\rm{m}}
119 \def\micro{\mu}
120 \def\nano{\rm{n}}
121 \def\pico{\rm{p}}
122 \def\kilo{\rm{k}}
123 \def\mega{\rm{M}}
124 \def\giga{\rm{G}}
125 \def\tera{\rm{T}},
126 false=>]
127 % \s!default=>\pgf@circ@siunitxtrue,
128
129 \processaction
130 [\currentmoduleparameter{arrowmos}]
131 [true=>\pgf@circuit@mos@arrowstrue,
132 false=>\pgf@circuit@mos@arrowsfalse]
133 % \s!default=>\pgf@circuit@mos@arrowstrue,
134
135
136 \ifpgf@circ@siunitx
137 % nothing! siunitx and xstrings don't work in context
138 \fi
139
140
141 % Context specific
142
143 \ctikzset{tripoles/op amp/font/.initial=\switchtobodyfont[small]}
144
145
146 \catcode`\@=\tikzatcode
147 \catcode`\|=\tikzbarcode
148 \catcode`\!=\tikzexclaimcode
149
150 % define the environment
151 % thanks to Max Chernoff https://tex.stackexchange.com/a/705683/38080
152 \let\startcircuitikz\starttikzpicture
153 \let\stopcircuitikz\stoptikzpicture
154
155 \protect
156
157 \stopmodule
158
159 \endinput