我想让电路图上的所有文本都采用无衬线字体。有人知道我该怎么做吗?谢谢
\documentclass[twoside,12pt]{article}
\usepackage[a4paper, left=1in, top=1in, bottom=1in, right=0.5in]{geometry} % Defines margins
\usepackage[siunitx]{circuitikz}
\ctikzset{
resistors/scale=0.8, % smaller R
capacitors/scale=0.7, % even smaller C
diodes/scale=0.6, % small diodes
transistors/scale=1.2, % bigger BJTs
transistors/thickness=4,
transistor circle/relative thickness=0.5,
bipoles/cuteswitch/thickness=0.25
}
\begin{document}
\begin{circuitikz}
\draw
(0,0) node[npn, tr circle](Q1){BC548}
(-2,0) to [eC, *-o, l=10<\micro\farad>] (-4,0) node[left]{IN}
(-2,3) to [R, l=100K] (-2,0) -- (Q1.B)
(-2,0) to [R, l=20K] (-2,-3)
(-2,3) -- (0,3)
to [R, l=1K] (0,1) -- (Q1.C)
(0,1) to [eC, -o, l=10<\micro\farad>] (4,1) node[right]{OUT}
(Q1.E) -- (0,-1)
to [R, -*, l=47<\ohm>] (0,-3) -- (-2,-3)
(0,-1) -- (2,-1)
to [eC, l=100<\micro\farad>] (2,-3) -- (0,-3)
(0,3.3) node[vcc]{\qty{6}{\volt}} -- (0,3)
(0,-3) -- (0,-3.1) node[ground]{}
;
\end{circuitikz}
\end{document}
答案1
请尝试以下操作:
\documentclass[twoside,12pt]{article}
\usepackage[a4paper, left=1in, top=1in, bottom=1in, right=0.5in]{geometry} % Defines margins
\usepackage[siunitx]{circuitikz}
\ctikzset{
resistors/scale=0.8, % smaller R
capacitors/scale=0.7, % even smaller C
diodes/scale=0.6, % small diodes
transistors/scale=1.2, % bigger BJTs
transistors/thickness=4,
transistor circle/relative thickness=0.5,
bipoles/cuteswitch/thickness=0.25
}
\begin{document}
\begin{circuitikz}[font=\sffamily]
\sisetup{mode = text,
reset-text-family = false ,
reset-text-series = false ,
reset-text-shape = false
}
\draw
(0,0) node[npn, tr circle](Q1){BC548}
(-2,0) to [eC, *-o, l=10<\micro\farad>] (-4,0) node[left]{IN}
(-2,3) to [R, l=100K] (-2,0) -- (Q1.B)
(-2,0) to [R, l=20K] (-2,-3)
(-2,3) -- (0,3)
to [R, l=1K] (0,1) -- (Q1.C)
(0,1) to [eC, -o, l=10<\micro\farad>] (4,1) node[right]{OUT}
(Q1.E) -- (0,-1)
to [R, -*, l=47<\ohm>] (0,-3) -- (-2,-3)
(0,-1) -- (2,-1)
to [eC, l=100<\micro\farad>] (2,-3) -- (0,-3)
(0,3.3) node[vcc]{\qty{6}{\volt}} -- (0,3)
(0,-3) -- (0,-3.1) node[ground]{}
;
\end{circuitikz}
\end{document}
附註:
如果您的文档中包含许多电路图并且\sffamily
只想在图像中使用字体circuitikz
,则将字体设置移动siunitx
到文档前言并使用\AtBeginEnvironment
定义的宏是明智的etoolbox
,如下面 MWE 中所做的那样:
\documentclass[twoside,12pt]{article}
\usepackage[a4paper,
margin=1in, right=0.5in]{geometry} % Defines margins
\usepackage[siunitx]{circuitikz}
\ctikzset{
resistors/scale=0.8, % smaller R
capacitors/scale=0.7, % even smaller C
diodes/scale=0.6, % small diodes
transistors/scale=1.2, % bigger BJTs
transistors/thickness=4,
transistor circle/relative thickness=0.5,
bipoles/cuteswitch/thickness=0.25
}
\usepackage{etoolbox}
\AtBeginEnvironment{circuitikz}{%
\sisetup{mode = text,
reset-text-family = false,
reset-text-series = false,
reset-text-shape = false
},
font=\sffamily}
\begin{document}
\begin{circuitikz}
\draw
(0,0) node[npn, tr circle](Q1){BC548}
(-2,0) to [eC, *-o, l=10<\micro\farad>] (-4,0) node[left]{IN}
(-2,3) to [R, l=100K] (-2,0) -- (Q1.B)
(-2,0) to [R, l=20K] (-2,-3)
(-2,3) -- (0,3)
to [R, l=1K] (0,1) -- (Q1.C)
(0,1) to [eC, -o, l=10<\micro\farad>] (4,1) node[right]{OUT}
(Q1.E) -- (0,-1)
to [R, -*, l=47<\ohm>] (0,-3) -- (-2,-3)
(0,-1) -- (2,-1)
to [eC, l=100<\micro\farad>] (2,-3) -- (0,-3)
(0,3.3) node[vcc]{\qty{6}{\volt}} -- (0,3)
(0,-3) -- (0,-3.1) node[ground]{}
;
\end{circuitikz}
\end{document}
生成的图像与之前相同。