当我想要在子图问题出在“>”和“<”上,因为如果我去掉它们,代码就可以正常工作!
我正在使用以下软件包:
\usepackage{subfigure}
代码:
\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}
错误是:
Argument of \language@active@arg< has an extra }. }
如果我放入包:“subcaption”,错误是:
Package subcaption Error: This package can't be used in cooperation(subcaption) with the subfigure package. \subcaption@CheckCompatibility
提前致谢!!
答案1
您有两个不同的问题,一个是使用过时的软件包,另一个是键入/语法错误(@rmano 的回答已解决)。请注意,在您的特定情况下,到目前为止,您似乎没有遇到使用过时软件包的问题。
关于第一个,您有两个选择:
- 使用
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}
- 使用
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}
这个特殊情况与之前相同吗?对于图像代码,使用了@rmano 答案中的代码 (+1)。
答案2
错误是:
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.
请注意 Ti钾Z 解析器认为您使用了密钥f <
,但是它无法识别它。
如果您将其更改为真正的密钥f<
(无空格),它就会起作用。
\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}