这是我的代码:
\documentclass[]{article}
\usepackage{circuitikz}
\begin{document}
\begin{figure}
\centering
\begin{circuitikz}
\draw (0,0)
to[short,o-](2,0)
to[short,*-](4,0)
to[D](4,2)
to[D](4,4)
to[short,-*](2,4)
to[short,-o](0,4);
\draw (4,0)
to[short,*-](8,0)
to[D](8,2)
to[D](8,4)
to[short,-*](4,4);
\draw (2,0)
to[Tnpn,n=q2](2,2)
to[Tnpn,n=q1](2,4);
\draw (8,0)
to[short,*-](10,0)
to[Tnpn,n=q4,mirror](10,2)
to[Tnpn,n=q3,mirror](10,4)
to[short,-*](8,4);
\draw
(q1.B) to[short,-o](1,3) node[left]{$Q_1$}
(q2.B) to[short,-o](1,1) node[left]{$Q_2$}
(q3.B) to[short,-o](11,3) node[right]{$Q_3$}
(q4.B) to[short,-o](11,1) node[right]{$Q_4$};
\draw (2,2) to[short,*-*](4,2) to[Telmech=M](8,2) to[short,*-*](10,2);
\end{circuitikz}
\caption{Chopper E}
\end{figure}
\end{document}
我想知道是否有可能使用circuitikz
绘制电流和一般电位线的路径(一般而言,它们不必指特定的双极子,而是指两个一般点)。
此外,当前路径可能是在后面电路?
笔记:我正在寻找circuitikz
包的功能。但如果没有,使用 tikz 的解决方案也可以,但最好不要加载circuit
tikz 库,否则我必须出于兼容性原因修改大量图形。
答案1
\documentclass[]{article}
\usepackage{circuitikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{figure}
\centering
\begin{circuitikz}
\draw (0,0) node (N5){}
to [short,o-](2,0)
to[short,*-](4,0)
to[D](4,2)
to[D](4,4)
to[short,-*](2,4) node (N1){}
to[short,-o](0,4) node (O){};
\draw (4,0)
to[short,*-](8,0)
to[D](8,2)
to[D](8,4)
to[short,-*](4,4);
\draw (2,0)
to[Tnpn,n=q2](2,2) node(N2){}
to[Tnpn,n=q1](2,4);
\draw (8,0)
to[short,*-](10,0) node(N4){}
to[Tnpn,n=q4,mirror](10,2)
to[Tnpn,n=q3,mirror](10,4)
to[short,-*](8,4);
\draw
(q1.B) to[short,-o](1,3) node[left]{$Q_1$}
(q2.B) to[short,-o](1,1) node[left]{$Q_2$}
(q3.B) to[short,-o](11,3) node[right]{$Q_3$}
(q4.B) to[short,-o](11,1) node[right]{$Q_4$};
\draw (2,2) to[short,*-*](4,2) to[Telmech=M](8,2) to[short,*-*](10,2) node(N3){};
% adding current
\begin{scope}[very thick,decoration = {
markings,
mark = at position 0.05 with {\arrow{>}}}
]
\draw[line width = 3pt, red, opacity = 0.4, postaction = {decorate}] (O.north) --
(N1.north east) node[above, midway, opacity = 1]{$i$} -- (N2.north east)
-- (N3.north west) -- (N4.north west) -- (N5.north) ;
\end{scope}
% adding voltage
\draw[line width = 3pt, red, opacity = 0.4, ->] (N5) to[out = 150, in = 210] (O) node[left, opacity = 1]{$V$};
\end{circuitikz}
\caption{Chopper E}
\end{figure}
\end{document}
编辑
要将当前放置在背景层上,请添加\usetikzlibrary{backgrounds}
序言,并将其on background layer
作为环境选项scope
。还根据@Kpym的建议更改了路径
\documentclass[]{article}
\usepackage{circuitikz}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{backgrounds}
\begin{document}
\begin{figure}
\centering
\begin{circuitikz}
\draw (0,0) node (N5){}
to [short,o-](2,0)
to[short,*-](4,0)
to[D](4,2)
to[D](4,4)
to[short,-*](2,4) node (N1){}
to[short,-o](0,4) node (O){};
\draw (4,0)
to[short,*-](8,0)
to[D](8,2)
to[D](8,4)
to[short,-*](4,4);
\draw (2,0)
to[Tnpn,n=q2](2,2) node(N2){}
to[Tnpn,n=q1](2,4);
\draw (8,0)
to[short,*-](10,0) node(N4){}
to[Tnpn,n=q4,mirror](10,2)
to[Tnpn,n=q3,mirror](10,4)
to[short,-*](8,4);
\draw
(q1.B) to[short,-o](1,3) node[left]{$Q_1$}
(q2.B) to[short,-o](1,1) node[left]{$Q_2$}
(q3.B) to[short,-o](11,3) node[right]{$Q_3$}
(q4.B) to[short,-o](11,1) node[right]{$Q_4$};
\draw (2,2) to[short,*-*](4,2) to[Telmech=M](8,2) to[short,*-*](10,2) node(N3){};
% adding current
\begin{scope}[on background layer, very thick,decoration = {
markings,
mark = at position 0.05 with {\arrow{>}}}
]
\draw[line width = 3pt, red!40, postaction = {decorate}] (O.north)
-- node[above, red]{$i$} (N1.north east) |- (N3.north west) |-
(N5.north);
\end{scope}
% adding voltage
\draw[line width = 3pt, red!40, ->] (N5) to[out = 150, in = 210]
(O) node[left, red]{$V$};
\end{circuitikz}
\caption{Chopper E}
\end{figure}
\end{document}
答案2
这里实现了几乎 90% 的circuitikz
宏,具有所有样式选项,电流线是 tikz 宏和decorations
库的一部分。观察是,您的绘图中电压的符号是错误的,电流朝向正电压移动。
OBS:我在 中进行编译standalone class
,因为我将结果导出为 pdf,然后通过graphicx
允许插入 pdf 文档的库将其导入主文档,您可以看到更繁琐的解释这里。
梅威瑟:
% By j.leon.v
\documentclass[border=30pt]{standalone}
\usepackage{tikz}
\usepackage{circuitikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\ctikzset{bipoles/length=.8cm}
\begin{tikzpicture}[line width =.75pt,
current1/.style ={
line width=2pt,
color=red,
opacity=.3,
postaction={decorate,decoration={
markings,
mark=between positions 0.25 and 1 step 1cm with{
\arrow[red,line width=.8mm]{latex}}
}
}
},
current2/.style ={
line width=2pt,
color=red,
opacity=.3,
postaction={decorate,decoration={
markings,
mark=between positions 0.03 and 1 step 1cm with{
\arrow[red,line width=.8mm]{latex}}
}
}
},
]%TIKZ PICTURE PREAMBLE
% Draw transistors as objets
\draw(2,3) node[npn,
scale=1.5,
line width=1.5pt,
color=red
](q1){};
\draw(2,1) node[npn,
scale=1.5,
% line width=1.5pt,
color=black
](q2){};
\draw(9,3) node[npn,
scale=1.5,
% line width=1.5pt,
% color=red,
xscale=-1
](q3){};
\draw(9,1) node[npn,
scale=1.5,
line width=1.5pt,
color=red,
xscale=-1
](q4){};
%Draw energy lines
\draw(-0.5,4) node[ocirc,
scale=1.5,
line width=1.5pt,
% color=red
](L1){};
\draw(-0.5,0) node[ocirc,
scale=1.5,
line width=1.5pt,
% color=red,
](L2){};
%Draw the motor
\draw[color=red,line width=1.5pt](4.5,2) coordinate (M1)
to [Telmech=M,red](6,2) coordinate (M2);
%Draw diodes:
\draw (7,0) to[D*,*-*](7,2)to[D*,*-*](7,4);
\draw (3.5,0) to[D*,*-*](3.5,2)to[D*,*-*](3.5,4);
% Draw pasive wire
\draw(q1.E|- M1) to [short,*-] (M1);
\draw(q4.C|- M2) to [short,*-] (M2);
\draw (q2.C) -- (q1.E);
\draw (q4.C) -- (q3.E);
\draw (L1) -| (q3.C);
\draw (L1) to[short,-*](L1-|q1.C) -- (q1.C);
\draw (L2) to[short,-*](L2-|q2.E) -- (q2.E);
\draw (L2) -| (q4.E);
% Draw the path of the electric current.
\draw [current1] (L1) -| (q1.C);
\draw [current2] (q1.E) |- (M1);
\draw [current1] (M2) -| (q4.C);
\draw [current2] (q4.E) |- (L2);
% Draw labels
\draw
(q1.B) to[short,-o,red](q1.B) node[left]{$Q_1$}
(q2.B) to[short,-o](q2.B) node[left]{$Q_2$}
(q3.B) to[short,-o](q3.B) node[right]{$Q_3$}
(q4.B) to[short,-o](q4.B) node[right]{$Q_4$};
\draw (L1)node[left]{$-$};
\draw (L2)node[left]{$+$};
\draw[color=red,line width=1.5pt] (L1) to [open,v=$Vin$] (L2);
\end{tikzpicture}
\end{document}