3

I discover that circuitikz is available in ConTeXt, and since it is way more complete than the circuits.ee.IEC tikz library, I am considering switching to it. However, I can't display a transformer core (I updated my context distribution this morning to be sure there wasn't an update). Here is my MWE :

\usemodule[tikz]

\usemodule[circuitikz]
\ctikzset{current=european, voltage=straight, resistor=european, inductor=american}

\starttext
\starttikzpicture
  \draw (0, 0) node [transformer core] (T) {};  % asking for node[transformer] (T) {} works
\stoptikzpicture
\stoptext

The demand for transformer core leads to the following error

Control sequence expected instead of undefined

Of course I can recreate the core symbol using the transformer anchors, but it seems silly since it is already defined in the library… Is there a simple fix for this problem ?

Thank you in advance

1

1 Answer 1

7

CircuiTikZ attempts to use the \pgfmoveto macro which has been deprecated since 2005. pgf loads the compatibility packages by default under LaTeX, but not under ConTeXt. So strictly speaking, this bug isn't exclusive to ConTeXt as the following LaTeX document gives the same error:

\documentclass{article}

\usepackage[version=latest]{pgf}  % Works if this line is removed

\usepackage{circuitikz}

\begin{document}
\begin{tikzpicture}
  \draw (0, 0) node [transformer core] (T) {};
\end{tikzpicture}
\end{document}

To fix this problem, you just need to provide appropriate definitions for \pgfmoveto and \pgflineto:

\usemodule[circuitikz]

\let\pgfmoveto=\pgfpathmoveto  % Added
\let\pgflineto=\pgfpathlineto  % Added

\startTEXpage
\starttikzpicture
    \node [transformer core] {};
\stoptikzpicture
\stopTEXpage

output

3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .