I am typing an awful lot of electrical circuits, and when I used LaTeX I used the circuitikz library, which has a simple and concise syntax. Now that I switched to ConTeXt, I have to use the TikZ circuit, which is almost perfect in terms of capabilities, but is also a lot more verbose.
I would like to define aliases (like R
for resistor
, l
for label, V
for a voltage arrow and so on). I found this thread, as well as this example in the TikZ manual:
\tikzset{r/.style={radius=#1},rx/.style={x radius=#1},ry/.style={y radius=#1}}
My first problem is that I can't find how to make subkeys work as well ; I don't know how to clearly explain it, so here is a MWE that describes the problem :
\usemodule[tikz]
\usetikzlibrary[circuits.ee.IEC]
\tikzset{
R/.style={resistor},
l/.style={info}
}
\starttext
Basic usage \blank
\starttikzpicture[circuit ee IEC]
\draw (0,0) to [resistor={near start}] ++(2,0);
\draw (3,0) to [resistor={info=$a$}] ++(2,0);
\stoptikzpicture
\hairline
My tests
\blank
\starttikzpicture[circuit ee IEC]
\draw (0,0) to [R={near start}] ++(2,0);
\draw (3,0) to [R={info=$a$}] ++(2,0);
\draw (6,0) to [R={l=$a$}] ++(2,0);
\draw (9,0) to [R] ++(2,0);
\stoptikzpicture
\stoptext
As soon as I use my abbreviation, all the keys I can specify as optional are not read, whether I use my abbreviation l
for the option or not.
My second problem is that I tried to define a voltage arrow that suits me, and I found the circuit declare annotation
key in the pgf manual, with the following example :
\tikzset{circuit declare annotation=
{circular annotation}
{9pt}
{(0pt,8pt) arc (-270:80:3.5pt)}
}
However, I can't find how to make an arrow which size is linked to the node's size ; I tried using (north east) -- (north west)
, but it appeared to me that there is no node name here, and should write something like (this node.north west)
... Is there a way to specify something as "this node" ?
R/.style={resistor}, l/.style={info}
try withR/.style={resistor={#1}}, l/.style={info={#1}}