0

Electric circuit

Good morning, I found this book, “Introduction to Electric Circuits”; Dorf, Svoboda, 9th Edition, 2014. I know this text was made using \LaTeX, my concern is about to know how they got this circuit style. I noticed the editors used OrCAD Capture to design these circuits in order to make them easily and faster (also by looking at the inductor style in this example). I would like to know if anyone out there has had the same concern, circuitikz sometimes does not have enough power, and for instance, I like this current source more than the circuitikz's, with a thick straight triangle in the arrow instead of this one. You can easily distinguish them.

I hope I get some help, any advice is welcome. Thank you in advance.

2
  • 1
    TikZ' own IEC standard shapes from its own circuit library has these shapes
    – percusse
    Commented Nov 13, 2014 at 4:16
  • 1
    In addition to percusse's comment, you are always free to patch the circuitikz style and include your favorite arrow within the current source symbol. Commented Nov 13, 2014 at 7:05

2 Answers 2

9

This is one way of doing it via circuitiz package. Two customized circuit elements are designed via macros called mycurrent and myswitch, hoping this will serve as a starting point.

enter image description here

Code

\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}
3
  • I have no words. Just thank you. You have done a work even better than I would expect. :)
    – mov0021
    Commented Nov 13, 2014 at 17:03
  • Would you please help me out doing the same to a controlled current source, @Jesse ? Thanks in advance.
    – mov0021
    Commented Nov 14, 2014 at 20:26
  • OK, here is the myctrcurrent macro -- \newcommand{\myctrcurrent}[2] % #1 = name , #2 = rotation angle {\draw[thick] (#1) ++(0,-14pt) --++(12pt,14pt) --++(-12pt,14pt) -- ++(-12pt,-14pt)-- cycle; \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); } Then change the first line of independent source into \draw (-1,0)node(o){} to[cI,color=white,name=C0,l=$6i_xA$] (-1,2); \myctrcurrent{C0}{0}
    – Jesse
    Commented Nov 15, 2014 at 0:20
5

My Code in circuit-macros – M4 Macros for Electric circuit diagrams

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

Convert to the .TEX (I can't paste it that has long lines) file then into add LaTeX file,

\documentclass[a4paper,11pt]{book}
\usepackage{tikz}
\begin{document}
\input{file.tex}
\end{document}

And display

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .