CircuitikZ – Controlling Linewidth and Border of Voltage Source, and Font Size of Polarity

circuitikz

Let us assume that we plan to draw a voltage source using the code as below:

\documentclass[border=0.5cm]{standalone}
\usepackage[american]{circuitikz}
\usepackage{anyfontsize}
\newcommand{\myfont}{\usefont{T1}{cmr}{m}{n}\fontsize{20}{\baselineskip} \selectfont}
\begin{document}
\begin{circuitikz}
\draw [ line width=0.1pt,gray] (-1,0) grid (1,3);
    \draw [font=\myfont,line width=2pt](0,0)
    to[V, v=$V$, invert] (0,3);        
      \end{circuitikz}
\end{document}

The result is:
enter image description here
I have the following questions:

  1. How to make the + and – thicker? obviously as I tried changing the fontsize in \draw does not work.
  2. Why the linewidth of the wire is thinner than that of the circle? How to make both 1 pt line width?

Best Answer

Answering to your questions:

  1. If you look at the manual, the default style for sources is to have the symbol's element drawn with a line thickness which is twice the default thickness for the path element. This is because by default sources/thickness is none, which makes them defaulting to the legacy bipoles/thickness which is 2.

    I also do not like it (my style, which is distributed with the package, has sources/thickness=1. You can learn more about styles in https://texdoc.org/serve/circuitikz/0#subsection.3.3)

  2. The + and - are not drawn, they are symbols. You can look at the example in the manual on how to change them.

I suppose that what you want is this (I am using bm for the boldmath, but there are several options).


\documentclass[border=0.5cm]{standalone}
\usepackage[american]{circuitikz}
\usepackage{anyfontsize}
\newcommand{\myfont}{\usefont{T1}{cmr}{m}{n}\fontsize{20}{\baselineskip} \selectfont}
\usepackage{bm}
\begin{document}
% manual 1.3.4 page 40 (3.3.3 line thickness)
\ctikzset{sources/thickness=1}
% manual 1.3.4 page 69 (examples of sources customization)
\ctikzset{bipoles/vsourceam/inner plus={$\bm{+}$}}
\ctikzset{bipoles/vsourceam/inner minus={$\bm{-}$}}
\begin{circuitikz}
    \draw [ line width=0.1pt,gray] (-1,0) grid (1,3);
    \draw [font=\myfont,line width=2pt](0,0)
    to[V, v=$V$, invert] (0,3);
\end{circuitikz}
\end{document}

enter image description here

Related Question