为什么连接器中心的电线不位于该点(2.5,0)
?
\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{circuits.logic.IEC}
\tikzset{circuit declare symbol = ammeter}
\tikzset{set ammeter graphic ={draw,generic circle IEC, minimum size=5mm,info=center:A}}
\tikzset{circuit declare symbol = vmmeter}
\tikzset{set vmmeter graphic ={draw,generic circle IEC, minimum size=5mm,info=center:V}}
\begin{document}
\begin{tikzpicture}[circuit ee IEC,every info/.style=red,
set resistor graphic=var resistor IEC graphic]
\draw (0,0)
to[battery] (0,2) to [make contact](3,2)
to [ammeter] (3,0)--(2.5,0)
to [vmmeter] (.5,0)--(0,0);
\draw (0,0)--(.5,0) to[contact={at start}] (.5,-2) to[resistor={info={R ($\Omega$)}}] (2.5,-2) to[contact={at end}] (2.5,0)--(3,0);\end{tikzpicture}
\end{document}
答案1
不应该这样,但我不明白为什么。这里有一个解决方法。
\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}
%\usetikzlibrary{circuits.logic.IEC}
\tikzset{circuit declare symbol = ammeter}
\tikzset{set ammeter graphic ={draw,generic circle IEC, minimum size=5mm,info=center:A}}
\tikzset{circuit declare symbol = vmmeter}
\tikzset{set vmmeter graphic ={draw,generic circle IEC, minimum size=5mm,info=center:V}}
\begin{document}
\begin{tikzpicture}[circuit ee IEC,every info/.style=red,
set resistor graphic=var resistor IEC graphic]
\draw (0,0)
to[battery] (0,2) to [make contact](3,2)
to [ammeter] (3,0)--(2.5,0)
to [vmmeter] (.5,0)--(0,0);
\draw (0,0)--(.5,0) to[contact={at start}] (.5,-2) to[resistor={info={R ($\Omega$)}}] (2.5,-2) to (2.5,0)node[contact] {}--(3,0);
\end{tikzpicture}
\end{document}
答案2
PSTricks 解决方案:
\documentclass{article}
\usepackage{pst-circ}
\usepackage{siunitx}
\newcommand*\device[3]{%
\circledipole[labeloffset = 0](#1)(#2){\textcolor{red}{\si{#3}}}}
\begin{document}
\begin{pspicture}(-0.5,-0.25)(6.5,7.5)
\pnodes{P}(1,0)(5,0)(0,4)(1,4)(5,4)(6,4)(0,7)(6,7)
{\psset{arrows = -*}
\wire(P0)(P3)
\wire(P1)(P4)}
\resistor[dipolestyle = zigzag](P0)(P1){\textcolor{red}{$R$~(\si{\ohm})}}
\device{P3}{P4}{\V}
\device{P5}{P7}{\A}
\wire(P2)(P3)
\wire(P4)(P5)
\battery(P2)(P6){}
\newSwitch[ison = false](P6)(P7){}
\end{pspicture}
\end{document}