
我發現 Circuitikz 在 ConTeXt 中可用,並且由於它比 Circuits.ee.IEC tikz 庫更完整,因此我正在考慮切換到它。但是,我無法顯示變壓器核心(今天早上我更新了我的上下文分佈以確保沒有更新)。這是我的 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
的需求transformer core
導致以下錯誤
Control sequence expected instead of undefined
當然,我可以使用變壓器錨點重新創建核心符號,但這似乎很愚蠢,因為它已經在庫中定義了......這個問題有一個簡單的解決方案嗎?
先感謝您
答案1
電路鈦kZ 嘗試使用\pgfmoveto
自 2005 年以來已棄用的巨集pgf
。嚴格來說,這個錯誤並不是 ConTeXt 獨有的,因為以下 LaTeX 文件給了相同的錯誤:
\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}
要解決此問題,您只需為\pgfmoveto
和提供適當的定義\pgflineto
:
\usemodule[circuitikz]
\let\pgfmoveto=\pgfpathmoveto % Added
\let\pgflineto=\pgfpathlineto % Added
\startTEXpage
\starttikzpicture
\node [transformer core] {};
\stoptikzpicture
\stopTEXpage