2

I want to make all the text on my circuit diagram to be in a sans-serif font. Does anyone know how I would do this? THanks

\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}

enter image description here

1 Answer 1

3

Try the following:

\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}

enter image description here

Addedndum: In the case that in your document are many circuit schemes and like to have \sffamily fonts only in circuitikz images, than is sensible to move siunitx and font settings to document preamble and use macro \AtBeginEnvironment defined in the etoolbox as is done in the following 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}

Produced image is the same as before.

1
  • 1
    @KenEly, see addendum to answer.
    – Zarko
    Commented Dec 9, 2021 at 7:50

You must log in to answer this question.

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