2

Inductor styles

Hello, friends, once more.

I guess this is an easy one for you, I would like to know how to get both styles for the inductor, like in the picture. I like both, but specially the first one. Thanks in advance. I have not found this specific issue, I know the second one is gotten by [cute inductor] but not a clue about the first one.

  • You should check if your questions have an answer and, in that case, apart from upvoting (in case you think the answer deserves it) accept them (clicking the green tick). – Manuel Nov 13 '14 at 19:36
  • Hello, could you please provide a minimal working example (MWE)? You seem to know how to place an inductor and you just want to change the style. – yo' Nov 13 '14 at 19:41
  • \documentclass{standalone} \usepackage{tikz,american} \begin{document} \begin{tikzpicture} \draw (0,0) to[cute inductor] (0,3) ; \end{tikzpicture} \end{document} – mov0021 Nov 13 '14 at 20:52
  • 1
    Please always provide a fully compilable MWE in the question rather than in the comments. What you have in the comment above will not compile. – Peter Grill Nov 13 '14 at 21:47
7

You can specify the desired symbol via the options:

enter image description here

Code:

\documentclass{article} 
\usepackage[american]{circuitikz} 
\begin{document} 
\begin{tikzpicture} 
    \draw (0,0) to[cute inductor] (3,0) ; 
    \node [below=5pt] at (1.5,0) {cute inductor};

    \draw (4,0) to[american inductor] (7,0) ; 
    \node [below=5pt] at (5.5,0) {american inductor};
\end{tikzpicture} 
\end{document} 
  • Sorry about the wrong-placed code. I lost a code where the first inductor was drawn, this one is based on semicircles and I like it a lot, if I had it, I definitely share it. American inductor as in your example is too bland to my tastes... I hope you get a clue on how to help me, no one else has been able to solve this issue. It is not a big deal, but I would like to know how to do things better. Thanks in advance, @PeterGrill. – mov0021 Nov 14 '14 at 2:03
3

I'm not sure if it helps, but here is a solution for the first symbol without circuitikz. I adjusted the symbol I normally use slightly to be able to let the semicircles go on for more than 180 degrees.

\documentclass[tikz]{standalone}

\tikzset{
    inductor/.style args={#1}{
        sloped,
        allow upside down,
        minimum height=4mm,
        minimum width=10mm,
        path picture={%
            \pgfmathsetmacro{\addangle}{#1}
            \pgfmathsetmacro{\radius}{.8/(2+6*cos(\addangle))}
            \draw[white] (-4.5mm,0) -- (4.5mm,0);
            \draw[line join=bevel] (-5mm,0)-- (-4mm,0)
                arc (180:-\addangle:\radius)
                arc (180+\addangle:-\addangle:\radius)
                arc (180+\addangle:-\addangle:\radius)
                arc (180+\addangle:0:\radius)
                -- (5mm,0);
        }
    },
    inductor/.default={40}
}

\begin{document}
    \begin{tikzpicture}
        \draw (0,0) -- node[inductor]{} ++(2,0) node[right]{\verb|inductor|};
        \draw (0,-1) -- node[inductor={0}]{} ++(2,0) node[right]{\verb|inductor={0}|};
    \end{tikzpicture}
\end{document}

This is the result: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.