0

In fact, I want to display two circuits drawn by circuitikz as figures. I have read in a post that the same procedure to follow is the same as with figures. However when I tried it, an error was displayed. Here is the code :

\documentclass[review]{elsarticle}  
\usepackage{graphicx}
\usepackage{amssymb,amsmath,nccmath}
\usepackage{cclicenses}
\usepackage{makecell}
\usepackage[straightvoltages]{circuitikz}
\usetikzlibrary{arrows}
\usepackage{lscape,array}
\usepackage{subcaption}
\usepackage{caption}

\begin{document}
\begin{figure}[!ht] 
\begin{subfigure}
\centering
\captionsetup{justification=centering}
\begin{circuitikz}[scale=0.6][american voltages]
\draw

(0,0) to [open,v>=${v}_{ds}$] (0,4) 
to [short, *- ,i=${i}_{ds}$] (0.5,4)
to [/tikz/circuitikz/bipoles/length=1cm,R, l=$R_s$] (2,4) 
to [/tikz/circuitikz/bipoles/length=1cm,L, l=$X_s$] (4,4)
to [/tikz/circuitikz/bipoles/length=1cm,european voltage source, 
l_=${\omega}_s {\phi}_{qs}$] (4.5,4)
(4.5,4) to [short, -] (5,4)
(5,4) to [/tikz/circuitikz/bipoles/length=1cm,L, l_=$X_m$] (5,0)

(5,4) to [/tikz/circuitikz/bipoles/length=1cm,european voltage source, 
l_=${\omega}_r {\phi}_{qr}$] (6.5,4)
to [/tikz/circuitikz/bipoles/length=1cm,L, l=$X_r$] (7.5,4)
to [/tikz/circuitikz/bipoles/length=1cm,R, l=$R_r$] (9.8,4)
to [short, -* ,i<=${i}_{dr}$] (10,4) 
(10,0) to [open, v>=${v}_{dr}$] (10,4)
(0,0) to [short, *-*] (10,0);
\end{circuitikz}
\caption{fig1} 
\end{subfigure} 
\begin{subfigure}
\centering
\captionsetup{justification=centering}
\begin{circuitikz}[scale=0.6][american voltages]
\draw

(0,0) to [open,v>=${v}_{qs}$] (0,4) 
 to [short, *- ,i=${i}_{qs}$] (0.5,4)
 to [R, l=$R_s$] (2,4) 
 to [L, l=$X_s$] (4,4)
 to [european voltage source, l_=${\omega}_s {\phi}_{ds}$] (4.5,4)
 (4.5,4) to [short, -] (5,4)
 (5,4) to [L, l_=$X_m$] (5,0)

 (5,4) to [european voltage source, l_=${\omega}_r {\phi}_{dr}$] (6.5,4)
 to [L, l=$X_r$] (7.5,4)
 to [R, l=$R_r$] (9.8,4)
 to [short, -* ,i<=${i}_{qr}$] (10,4) 
 (10,0) to [open, v>=${v}_{qr}$] (10,4)
 (0,0) to [short, *-*] (10,0);
 \end{circuitikz}
 \caption{fig2} 
 \end{subfigure}
 \caption{FIG3}
 \end{figure}
 \end{document}

Thank you in advance

MWiesner
  • 225
twimo
  • 171
  • 2
  • 10
  • as two sub figures? syntax for use subfigure is \begin{subfigure}[t]{< widht>}, whre in your case <width> can be for example 0.45\linewidth. – Zarko Feb 09 '18 at 22:15
  • Yes but they are combinedd with each other what can I do ? – twimo Feb 09 '18 at 22:30
  • (i) in drawing of your circuits you should consider my answer (https://tex.stackexchange.com/questions/414562/how-can-i-reduce-the-size-of-an-electric-circuit-in-circuitikz/414568?noredirect=1#comment1035648_414568; ) , (ii) consider my first comment and all be ok – Zarko Feb 09 '18 at 22:39
  • Thank you so very much Zarko you are a saver. Please one last thing I want to have an arrow on the top of \omega}r {\phi}{qr} as the V_dr and V_ds here is what I did : [/tikz/circuitikz/bipoles/length=1cm,european voltage source, l_<=${\omega}r {\phi}{qr}$] but an error was displayed how can I do it simply ? – twimo Feb 09 '18 at 22:51
  • @twimop, you should decided what you ask in one question :-(. here is, as far a see problem how to use subfigure environment, which essentially has nothing with circuitikz. for further help please accept one of received answers on your question https://tex.stackexchange.com/questions/414562/how-can-i-reduce-the-size-of-an-electric-circuit-in-circuitikz, that i know, which one is in the game. – Zarko Feb 09 '18 at 23:00
  • I just gave an example that's all because that arrow is important – twimo Feb 09 '18 at 23:08

1 Answers1

1

you have more issues in your question and reported in your comments above:

  1. use of subfigure environment. correct syntax is:

\documentclass[review]{elsarticle}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\captionsetup{justification=centering}

\begin{document}
    \begin{figure}[ht]
\begin{subfigure}[t]{0.48\linewidth}
    \includegraphics[width=\linewidth]{example-image-a}
\caption{first circuit}
\end{subfigure}
    \hfill
\begin{subfigure}[t]{0.48\linewidth}
    \includegraphics[width=\linewidth]{example-image-b}
\caption{second circuit}
\end{subfigure}
\caption{FIG3}
\label{fig:fig3}
    \end{figure}
\end{document}
  1. use of your circuit drawings. i suspect, that this your question was dedicated to this problem, so i wonder why you not use received answer (meanwhile is see that one has been deleted). this answer solve your problems (regarding scaling). please accept it (by clicking on check mark at top left side of answer), that it become clear, what you will use in your drawings in future and that we know, what we should to improve.
  2. if you have new problem with your circuitikz picture, please don't hesitate to ask new question. comments are not right place for this, since they are not well visible to wide audience here (i'm not only one who is /little/ familiar with circuitikz), so more people can help you.
Zarko
  • 296,517