2

I have a problema when i want to put a circuit inside a subfigure. The problem is on ">" and "<", because if i take off these, the code works!

I'm using the following packages:

\usepackage{subfigure}

Code:

\begin{figure}[h]
    \centering
    \subfigure[circuit]{
    \begin{circuitikz}[scale=0.75,transform shape]
        \draw   (0,0) coordinate (base)
                (base)  to [R,l=$R_2$]  ++ (0,-3) node[ground]{}
                (base)  to [R,l_=$R_1$] ++ (0,3)
                        to [short,-*]           ++ (2.5,0) coordinate (cole);
        \draw   (base)  to [open]   ++ (2.5,0) node[npn](Q){}
                (base)  to [short,*-, f < = $I_B$]     (Q.B)
                %HERE THE PROBLEM! ("f < =")
                (Q.E)   to [R,l=$R_E$]      ++ (0,-2.25) node [ground]{}
                (Q.C)   to [R,l_=$R_C$] (cole);
        \draw   (cole)  to [short]  ++ (3,0) 
                        to [battery,l=$V_{CC}$]     ++ (0,-6) node[ground]{};
    \end{circuitikz}
    }

\end{figure}

The error is:

Argument of \language@active@arg< has an extra }. }

if i put the package: "subcaption" the error is:

Package subcaption Error: This package can't be used in cooperation(subcaption) with the subfigure package. \subcaption@CheckCompatibility

Thanks in advance!!

4
  • 1
    Please extend your code fragment to small but complete document, which reproduce your problem. It seems that you use obsolete subfigure package. Try to replace it by subfig or even better subcaption package and accordingly replace subfigure with code defined in the mentioned packages.
    – Zarko
    Commented Oct 24, 2020 at 17:40
  • It's f<=, no spaces between f and <
    – Rmano
    Commented Oct 24, 2020 at 17:59
  • I just added more information about the problem! Commented Oct 24, 2020 at 18:32
  • Also notice that the error you cite now, Argument of \language@active@arg< has an extra }., is very typically related to babel. See for example tex.stackexchange.com/questions/166772/… --- even if it's a different char, the problem (could) be similar.
    – Rmano
    Commented Oct 25, 2020 at 9:58

2 Answers 2

3

You have two different issues, one is use of obsolete package, the other is typing/syntax error writing (which is solved by @rmano answer). Let me note, that in your particular case, so far it seems that you not have a problems with use obsolete package.

Regarding first, you have two options:

  • use of the subfigure:
\documentclass{article}
\usepackage[siunitx, nooldvoltagedirection]{circuitikz}
\usepackage{subfig} % <---

\begin{document}
    \begin{figure}
\subfloat[ subfloat caprion, if needed] 
{
\begin{circuitikz}
\draw   (0,0)   coordinate (aux1)
                to [R=$R_1$]    ++  (0,-3)  coordinate (base)
                to [short,*-,f< = $I_B$]    ++  (2,0)   node[right,npn](Q){}
        (base)  to [R=$R_2$]    ++  (0,-3)  coordinate (aux2)   node [ground]{}
        (aux1)  to [short,*-]   (aux1 -| Q.C)
                to [R=$R_C$]    (Q.C)
        (Q.E)   to [R=$R_E$]    (Q.E |- aux2)  node [ground]{}
(aux1 -| Q.C)   to [short,*-]   ++ (2,0)    coordinate (aux3)
                to [battery,l=$V_{CC}$] (aux3 |- aux2)  node[ground]{};
\end{circuitikz}
}
\caption{Main caption}
    \end{figure}
\end{document}

enter image description here

  • use of the subcaption
\documentclass{article}
\usepackage[siunitx, nooldvoltagedirection]{circuitikz}
\usepackage{subcaption} % <---

\begin{document}
    \begin{figure}
\begin{subfigure}{\linewidth}
    \centering
\draw   (0,0)   coordinate (aux1)
                to [R=$R_1$]    ++  (0,-3)  coordinate (base)
                to [short,*-,f< = $I_B$]    ++  (2,0)   node[right,npn](Q){}
        (base)  to [R=$R_2$]    ++  (0,-3)  coordinate (aux2)   node [ground]{}
        (aux1)  to [short,*-]   (aux1 -| Q.C)
                to [R=$R_C$]    (Q.C)
        (Q.E)   to [R=$R_E$]    (Q.E |- aux2)  node [ground]{}
(aux1 -| Q.C)   to [short,*-]   ++ (2,0)    coordinate (aux3)
                to [battery,l=$V_{CC}$] (aux3 |- aux2)  node[ground]{};
\end{circuitikz}
    \caption{sub figure caption, if needed}
\end{subfigure}
\caption{Main caption}
    \end{figure}
\end{document}

where is this particular case the same as before. For image code is used code from @rmano answer (+1).

2
  • Thanks for the help! Commented Oct 24, 2020 at 19:20
  • @MatiasTevez, you are welcome!
    – Zarko
    Commented Oct 24, 2020 at 19:59
3

The error is:

Package pgfkeys Error: I do not know the key '/tikz/f <', to which you passed '$I_B$', and I am going to ignore it. Perhaps you misspelled it.

Notice that the TikZ parser thinks that you used the key f <, and it does not recognize it.

If you change it to the real key, which is f< (no space), it'll work.

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, nooldvoltagedirection]{circuitikz}
\begin{document}
\begin{circuitikz}[scale=0.75,transform shape]
    \draw   (0,0) coordinate (base)
    (base)  to [R,l=$R_2$]  ++ (0,-3) node[ground]{}
    (base)  to [R,l_=$R_1$] ++ (0,3)
    to [short,-*]           ++ (2.5,0) coordinate (cole);
    \draw   (base)  to [open]   ++ (2.5,0) node[npn](Q){}
    (base)  to [short,*-, f< = $I_B$]     (Q.B)
    %HERE THE PROBLEM! ("f < =") is a different key than "f<="
    (Q.E)   to [R,l=$R_E$]      ++ (0,-2.25) node [ground]{}
    (Q.C)   to [R,l_=$R_C$] (cole);
    \draw   (cole)  to [short]  ++ (3,0) 
    to [battery,l=$V_{CC}$]     ++ (0,-6) node[ground]{};
\end{circuitikz}
\end{document}

enter image description here

2
  • Hi! Thanks for the apport, but is not the error. The error is: "Argument of \language@active@arg< has an extra }. }". It's only when use "subfigure". Commented Oct 24, 2020 at 18:25
  • Thanks for the help!!!! Commented Oct 24, 2020 at 19:20

You must log in to answer this question.

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