2

I wanna draw some schematics, but I need voltage and current sources quite different from those provided by package.

sources

I think I can use american current source with empty source to get my current souce and just american current source as my voltage source.

\begin{circuitikz}[american voltages, american currents, european resistors]
\draw 
(0,0) to[voltmeter, rotate=0] (0,4)
      to[ammeter] (4,4) -- (4,0)
      to[I,/tikz/circuitikz/bipoles/length=1cm, n=S1] (0,0)
      to [esource,/tikz/circuitikz/bipoles/length=2cm] (0,0)
;
\end{circuitikz}

But I'm getting this:

Schmtc

Do you have any idea to overlap one component with another or better, write a macro to automate this?

1 Answer 1

2

Your example fails because the first generator is drawn between (4,0) and (0,0) (so at (2,0)) while the second one is from (0,0) to (0,0)... Use two different paths:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{circuitikz}

\begin{document}
\begin{circuitikz}[american voltages, american currents, european resistors]
\path (4,0) to[I,/tikz/circuitikz/bipoles/length=1cm, n=S1] (0,0);
\draw (4,0) to [esource,/tikz/circuitikz/bipoles/length=2cm] (0,0);
\end{circuitikz}
\end{document}

strange current source

...and the \path instead of \draw will avoid the wires from "sticking into" the empty generator.

4
  • Can you explain to me how this code can be fixed? \newcommand{\I_source}[3] {\path[rotate=#3] (#1) to[I,/tikz/circuitikz/bipoles/length=1cm] (#2); \draw (#1) to [esource,/tikz/circuitikz/bipoles/length=2cm] (#2);}
    – Jump3r
    Commented Dec 14, 2017 at 6:10
  • You can't use the underscore in the command name...
    – Rmano
    Commented Dec 14, 2017 at 6:58
  • Is it really worth it learning Circuitikz? Because it seems that I would save a lot of time using another tool like Visuo and then copy the image to LaTeX... Commented Dec 15, 2017 at 1:28
  • @JoãoPedro it depends. If you need to produce lot of circuits with small differences (and if you like the way it marks voltages and current, which I don't), probably yes. Otherwise, my vote on the faster and best-looking application for drawing circuits goes to XCircuit
    – Rmano
    Commented Dec 15, 2017 at 12:05

You must log in to answer this question.

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