早上好,我找到了这本书《电子电路简介》;Dorf,Svoboda,第 9 版,2014 年。我知道这本书是用 \LaTeX 制作的,我关心的是他们是如何得到这种电路样式的。我注意到编辑们使用 OrCAD Capture 来设计这些电路,以便更轻松、更快地制作它们(也可以通过查看此示例中的电感器样式)。我想知道是否有人有同样的担忧,circuitikz 有时功率不足,例如,我更喜欢这个电流源而不是 circuitikz 的电流源,箭头中有一个粗直三角形,而不是这个。您可以轻松区分它们。
希望得到一些帮助,欢迎任何建议。提前谢谢。
答案1
这是通过封装实现的一种方法。通过名为和circuitiz
的宏设计了两个自定义电路元件,希望这可以作为一个起点。mycurrent
myswitch
代码
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage[american,siunitx]{circuitikz}
\usetikzlibrary{calc,positioning}
\newcommand{\mycurrent}[2] % #1 = name , #2 = rotation angle
{\draw[thick] (#1) circle (12pt);
\draw[rotate=#2,line width=1pt] (#1) +(0,-6pt) -- +(0,6pt) coordinate(a1);
\draw[rotate=#2,thin] ($(a1)+(0,1pt)$) to [bend right=12] ++(2pt,-5pt);
\draw[rotate=#2,thin] ($(a1)+(0,1pt)$) to [bend left=12] ++(-2pt,-5pt);
}
%
\newcommand{\myswitch}[2]{
\draw[rotate=#2] (#1) +(-0.58,0) coordinate(c) +(0.57,0) coordinate (a)
+(0,-0.5 )coordinate(b)
(a)node[above](a1){a} arc (0:-50:0.6)
(b)node[left] (b1){b} arc (-90:-0:0.4);
\draw [shorten >=-10pt] (c)node[below](c1){c}-- ($(a)!0.5!(b)$);
\draw[thick,red,->] (c) ++ (0.5,0.3) to[bend left] ++(-0.5,-0.8)node[above=0.5cm]{\scriptsize$t=0$};
}
\begin{document}
\begin{circuitikz}
\draw (-1,0)node(o){} to[I=$6A$] (-1,2); % default current
\draw (0,2) to[I,color=white,name=C1] (0,0); % customized curent
\mycurrent{C1}{0}
\draw (-1,2) to[generic,color=white,name=S1] (3.5,2) to[I,color=white,name=C2] (5,2); %customized element
\myswitch{S1}{0}
\mycurrent{C2}{-90}
\draw (b) to[short,o-*] (b|-o);
\draw (-1,2) to[short,-o](c);
\draw (a) to[short,o-](3.5,2);
\draw (-1,0) to[short](5,0);
\draw (3.5,2) to[R=$4$,*-*] (3.5,0);
\draw (5,2) to[L, l=$\frac{1}{5}F$] (5,0);
\end{circuitikz}
\end{document}
答案2
我的代码电路宏 – 用于电路图的 M4 宏
http://www.ctan.org/pkg/circuit-macros
.PS # Picture start
cct_init # Library
scale=25.4 # mm
O:(0,0) # Origin, Start position
line up_ dimen_/3;source(up_);clabel(,"$\uparrow$",);llabel(,"$\tt 6\;A$",);
line dimen_/3;corner;line right_ 1.5*dimen_;B:dot(at Here,.7,1);
{line chop 0.6 down 3*sqrt(2) chop 0 right 3*sqrt(9)};
move dimen_/1.5;D:dot(at Here,.7,1) ;"$\tt a$" above;move to D.e;line dimen_;
V:dot;{line right_ dimen_/2;dot(at Here,0,1);
setrgb(0.03921568627,0.4823529412,0.7176470588);
{"$\longrightarrow$" at (Here.x,Here.y+2);"$i$$_{\tt{L}}$" at (Here.x,Here.y+3)};
resetrgb;M:line right_ dimen_/2;corner};R:resistor(down_ from Here to (Here.x,O.y));
llabel(,\tt 4\;\Omega,);
dot;{L:line right_ dimen_;corner};line from Here to ((B.x+D.x)/2,Here.y);
dot;{line up_ 1.18*dimen_;
T:dot(at Here,.7,1);"$\tt b$" below ljust};line to O;corner;
arcd(B,dimen_/1.5,325,355)
arcd(B,dimen_/1.7,309,345)
setrgb(0.03921568627,0.4823529412,0.7176470588)
U:arcd(B,dimen_/2.95,300,40)
L:inductor(down_ from M.end to L.end);llabel(,\tt ^1\!\!/\!_5\;H,)
line -> from (B.x-((cosd(40)*dimen_/3)+sind(40)*(dimen_/3)/tan(50)),B.y) \
chop 6 to (B.x,B.y-((sind(40)*dimen_/3)-cosd(40)*(dimen_/3)/tan(40))) chop 1;"$t$ = 0" rjust;
#RGB(10,123,183) # bluish color
.PE # Picture end
转换为.TEX(我无法粘贴长行文件)然后添加 LaTeX 文件,
\documentclass[a4paper,11pt]{book}
\usepackage{tikz}
\begin{document}
\input{file.tex}
\end{document}
并显示