“标准”tikz
电路库是否circuitikz
不兼容?
考虑以下 MWE:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{pgfplots}\pgfplotsset{compat=1.9}
\usepackage[siunitx]{circuitikz}
\usetikzlibrary{positioning, shapes, fadings, calc,
% circuits, circuits.ee.IEC
}
\begin{document}
%Standard libraries battery:
%
%\begin{tikzpicture}[baseline, huge circuit symbols, circuit ee IEC,
% elec/.style={circle, inner sep=2pt, draw=blue, fill=blue},
% ]
% \node (E) [battery, info=135:$E$] at (0,3.4) {};
% \end{tikzpicture}
tikz circuit:
\begin{circuitikz}[
american,
]
\draw (0,0) to[R] (0,2);
\end{circuitikz}
\end{document}
输出符合预期:
但如果我取消注释注释部分,则会出现:
...例如,如果我添加标签,我经常会在两个环境中的其中一个中出错。有没有办法在同一文档中使用这两个电路设施,而我只需选择其中一个?
谢谢!
答案1
实际上,可以使用此技巧来临时加载任何 tikzlibrary。
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}\pgfplotsset{compat=1.9}
\usepackage[siunitx]{circuitikz}
\begin{document}
circuit ee IEC
\bgroup% local definitions
\usetikzlibrary{circuits.ee.IEC}
\begin{circuitikz}[circuit ee IEC]
\node (E) [battery, info=135:$E$] at (0,3.4) {};
\end{circuitikz}
\egroup
circuitikz components
\begin{tikzpicture}[american]
\draw (0,0) to[R] (0,2);
\end{tikzpicture}
\end{document}