1

The following code snippet produces the correct picture but also it gives an error message, namely:

undefined control sequence. ...terry1,invert, l_=\SI{12}{\ volt}] (0,4)

\begin{center}
\begin{circuitikz}
\draw (0,0)
to[battery1, invert, l_=\SI{33}{\ volt}] (0,4) % The voltage source
to[R=$5 \ ohms$, i=$I_1$] (4,4)
to[R=$5 \ ohms$, i>_=$I_3$] (4,0) % The resistor
to[R=$5 \ ohms$] (0,0);
\draw (8,4)
to[R, l_=$5 \ ohms$,  i_=$I_2$] (4,4);
\draw (8,4)
to[battery1,l_=\SI{10}{\ volt}] (8,0)
to[R=$5 \ ohms$] (4,0);
\end{circuitikz} 
\end{center}

what is my error and how do I correct it?

3
  • 3
    Probably using on siunitx package. Add to premable.
    – user31034
    Oct 29 '19 at 20:36
  • You have a space in \ volt... And in general you are using the siunitx package wrong. It's \SI{12}{\volt} , no spaces.
    – Rmano
    Oct 29 '19 at 21:10
  • 1
    Please do not add answers in the body of the question. If @Zarko answer solved it, please accept it
    – Rmano
    Oct 30 '19 at 9:57
3

I guess, that you like to draw your scheme as follows:

enter image description here

For writing units circuitikz offer siunitx mode, in which it adopt siunitx syntax \SI{ number }{ unit } to number<units>. See MWE below:

\documentclass[margin=3mm]{standalone}
\usepackage[siunitx]{circuitikz}

\begin{document}
    \begin{circuitikz}
\draw (0,0)
to[battery1, invert, l_=33<\volt>] (0,4) % <---
to[R=5<\ohm>, i=$I_1$] (4,4) % <---
to[R=5<\ohm>, i>_=$I_3$] (4,0) % <---
to[R=5<\ohm>] (0,0); % <---
\draw (8,4)
to[R, l_=5<\ohm>, i_=$I_2$] (4,4); % <---
\draw (8,4)
to[battery1,l_=10<\volt>] (8,0) % <---
to[R=5<\ohm>] (4,0); % <---
    \end{circuitikz} 
\end{document}
2
  • You do not need to re-load siunitx if specified in the circuitikz options... ;-) otherwise it's a bug. You can load it before if you want to play with options.
    – Rmano
    Oct 30 '19 at 9:59
  • @Rmano, you are right. Corrected (removed explicit siunitx loading).
    – Zarko
    Oct 30 '19 at 10:20

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.