m-circuitikz.mkiv /size: 3893 b    last modification: 2024-01-16 10:22
1%D \module
2%D   [       file=m-circuitikz,
3%D        version=2021.12.03,
4%D          title=\CONTEXT\ Extra Modules,
5%D       subtitle=CURCUITIKZ support,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14%D A fixed variant of the t-curcuitikz module distributed with tikz. This one
15%D is for \LMTX.
16
17\usemodule[m][tikz]
18
19\startmodule[circuitikz]
20
21\usetikzlibrary[calc]
22\usetikzlibrary[arrows.meta]
23\usetikzlibrary[bending]
24\usetikzlibrary[fpu] % may be needed for use fpu reciprocal (v1.0.1)
25
26\tikzinputfile{pgfcirc.defines.tex}
27\tikzinputfile{pgfcircutils.tex}
28\tikzinputfile{pgfcircpath.tex}
29
30\tikzinputfile{pgfcircshapes.tex}
31\tikzinputfile{pgfcircmonopoles.tex}
32\tikzinputfile{pgfcircbipoles.tex}
33\tikzinputfile{pgfcirctripoles.tex}
34\tikzinputfile{pgfcircquadpoles.tex}
35\tikzinputfile{pgfcircmultipoles.tex}
36
37\tikzinputfile{pgfcirclabel.tex}
38\tikzinputfile{pgfcircvoltage.tex}
39\tikzinputfile{pgfcirccurrent.tex}
40\tikzinputfile{pgfcircflow.tex}
41
42\ifdefined\pgfcircversion     \else \def\pgfcircversion     {0.0.0}      \fi
43\ifdefined\pgfcircversiondate \else \def\pgfcircversiondate {1010/01/01} \fi
44
45% defaults
46
47\setupmodule
48  [current=european,
49   voltage=european,
50   resistor=american,
51   inductor=cute,
52   logic=american,
53  %siunitx=true,
54   arrowmos=false]
55
56% can be done nicer ... todo
57
58\processaction
59  [\currentmoduleparameter{voltage}]
60  [european=>\ctikzset{voltage=european},
61   american=>\ctikzset{voltage=american}]
62
63\processaction
64  [\currentmoduleparameter{current}]
65  [european=>\ctikzset{current=european},
66   american=>\ctikzset{current=american}]
67
68\processaction
69  [\currentmoduleparameter{label}]
70  [straight=>\ctikzset{label/align=straight},
71      align=>\ctikzset{label/align=rotate},
72      smart=>\ctikzset{label/align=smart}]
73
74\processaction
75  [\currentmoduleparameter{resistor}]
76  [european=>\ctikzset{resistor=european},
77   american=>\ctikzset{resistor=american}]
78
79\processaction
80  [\currentmoduleparameter{inductor}]
81  [european=>\ctikzset{inductor=european},
82   american=>\ctikzset{inductor=american},
83       cute=>\ctikzset{inductor=cute}]
84
85\processaction
86  [\currentmoduleparameter{diode}]
87  [ full=>\ctikzset{diode=full},
88   empty=>\ctikzset{diode=empty}]
89
90\processaction
91  [\currentmoduleparameter{logic}]
92  [european=>\ctikzset{logic ports=european},
93   american=>\ctikzset{logic ports=american}]
94
95% hm, we have units since '97 so one can load the units module in mkii or
96% assume it is present (mkiv and therefore lmtx)
97%
98% \processaction
99%   [\currentmoduleparameter{siunitx}]
100%   [true=>\def\SI    #1#2{#1\,#2}
101%          \def\ampere    {\rm{A}}
102%          \def\volt      {\rm{V}}
103%          \def\ohm       {\Omega}
104%          \def\siemens   {\rm{S}}
105%          \def\farad     {\rm{F}}
106%          \def\henry     {\rm{H}}
107%          \def\second    {\rm{s}}
108%          \def\coulomb   {\rm{C}}
109%          \def\siemens   {\rm{S}}
110%          \def\radians   {\rm{rad}}
111%          \def\milli     {\rm{m}}
112%          \def\micro     {\mu}
113%          \def\nano      {\rm{n}}
114%          \def\pico      {\rm{p}}
115%          \def\kilo      {\rm{k}}
116%          \def\mega      {\rm{M}}
117%          \def\giga      {\rm{G}}
118%          \def\tera      {\rm{T}}]
119
120\unprotect
121
122\processaction
123  [\currentmoduleparameter{arrowmos}]
124  [true=>\pgf@circuit@mos@arrowstrue,
125   false=>\pgf@circuit@mos@arrowsfalse]
126
127\protect
128
129\ctikzset{tripoles/op amp/font/.initial=\switchtobodyfont[small]}
130
131\aliased\let\stopcircuitikz\relax
132
133% \permanent\protected\def\startcircuitikz#1\stopcircuitikz
134%   {\starttikzpicture#1\stoptikzpicture}
135
136\permanent\protected\def\startcircuitikz{\starttikzpicture}
137\permanent\protected\def\stopcircuitikz {\stoptikzpicture}
138
139\stopmodule
140
141\endinput
142