2

I try to imitate the scale style of the text book (american style), so I modified the length of the bipoles, like this

\ctikzset{bipoles/length=.8cm}

Everything went smoothly except the symbol of + and - on the american voltage source, they were mixed together, like this

enter image description here

An example is this enter image description here

\documentclass{standalone}
\usepackage[americanvoltages,americancurrents,
americanresistors,americaninductors,
europeanports,siunitx]{circuitikz}

\begin{document}
    \ctikzset{bipoles/length=.8cm}
    \begin{circuitikz}
            \draw (0,0) to[V,invert,v<=$\dot{U_S}$] (0,2.5) 
            to[L=$\mr{j}\omega L$] (2,2.5) 
            to[short,i=$\dot{I}_C$] (4,2.5) 
            to[C=$1/\mr{j}\omega C$] (4,0) to (0,0);
            \draw (2,2.5) to[R=$R$,*-*] (2,0);
    \end{circuitikz}
\end{document}
Ronan
  • 35

2 Answers2

3

The supported way to change the relative size of components is to use the class keys resistors/scale, capacitors/scale and so on. Once you have the relative scales correct, using a global scale=xxx, transform shape will give you the sizes you like.

The V symbol (really vsourceam) has the + and - symbol drawn with the current font, and it's not adjustable. Look:

\documentclass[border=6mm]{standalone}
\usepackage[siunitx, american, RPvoltages]{circuitikz}
\ctikzset{resistors/scale=0.7} 
\ctikzset{capacitors/scale=0.7} 
\ctikzset{sources/scale=0.9} 

\begin{document}
\begin{circuitikz}
    \draw (0,0) to[V, l_=$\hat{U}(s)$] ++(0,3) to[R=\SI{5}{\ohm}] ++(3,0)
      to[C=$1/j\omega C$] ++(0,-3) to[short, -*] (0,0)
      node[ground]{};
      \tiny
      \draw (5,0) to[V, l_=$\hat{U}(s)$] ++(0,3) to[R=\SI{5}{\ohm}] ++(3,0)
      to[C=$1/j\omega C$] ++(0,-3) to[short, -*] (0,0)
      node[ground]{};
  \end{circuitikz}
\end{document}

gives:

result of the snippet above

If you want to be able to change the font you have to add the configurability to the component (hey, I think I'll add it to the next version):

\documentclass[border=6mm]{standalone}
\usepackage[siunitx, american, RPvoltages]{circuitikz}

\makeatletter
%% Redefine vsourceam to have + and - customizable
\ctikzset{bipoles/vsourceam/inner plus/.initial={$+$}}
\ctikzset{bipoles/vsourceam/inner minus/.initial={$-$}}
%% Independent voltage source - American style
\pgfcircdeclarebipolescaled{sources}
{}
{\ctikzvalof{bipoles/vsourceam/height}}
{vsourceAM}
{\ctikzvalof{bipoles/vsourceam/height}}
{\ctikzvalof{bipoles/vsourceam/width}}
{

    \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
    \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}
    \pgf@circ@draworfill
    \pgfsetcolor{\ctikzvalof{color}}
    \ifpgf@circ@oldvoltagedirection
    \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner plus}}
        \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner minus}}
    \else
        \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{\ctikzvalof{bipoles/vsourceam/inner minus}}
        \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{\ctikzvalof{bipoles/vsourceam/inner plus}}
    \fi
}
\makeatother

\ctikzset{resistors/scale=0.7}
\ctikzset{capacitors/scale=0.7}
\ctikzset{sources/scale=0.9}

\begin{document}
\begin{circuitikz}
    \draw (0,0) to[V, l_=$\hat{U}(s)$] ++(0,3) to[R=\SI{5}{\ohm}] ++(3,0)
      to[C=$1/j\omega C$] ++(0,-3) to[short, -*] (0,0)
      node[ground]{};
   \ctikzset{bipoles/vsourceam/inner plus={\tiny $+$}}
   \ctikzset{bipoles/vsourceam/inner minus={\tiny $-$}}
   \draw (5,0) to[V, l_=$\hat{U}(s)$] ++(0,3) to[R=\SI{5}{\ohm}] ++(3,0)
   to[V, invert, bipoles/vsourceam/inner plus={\color{red}\tiny $\oplus$},
        bipoles/vsourceam/inner minus={}] ++(0,-3)
   to[short, -*] (0,0)
      node[ground]{};
\end{circuitikz}
\end{document}

enter image description here

Rmano
  • 40,848
  • 3
  • 64
  • 125
  • 1
    These options will be in circuitikz v1.0.3 and forward. See https://github.com/circuitikz/circuitikz/pull/387 – Rmano Apr 15 '20 at 20:38
  • I'm sorry, I'm a novice in circuitikz. I just can't simply load the RPvoltages option of the circuitikz package, and texstudio can't run some other commands either. Did I forgot something? Like the settings in texstudio? – Ronan Apr 16 '20 at 00:31
  • @Ronan TeXstudio is just an editor, not a TeX/LaTeX system. But your problem is that you probably have an old version of circuitikz. You can see it by loading the package and putting the command \pgfcircversion somewhere in your code. You can find uptodate version at https://circuitikz.github.io/circuitikz – Rmano Apr 16 '20 at 07:33
  • See also https://tex.stackexchange.com/questions/524328/i-need-to-use-a-different-version-of-circuitikz-how-can-i-do-that – Rmano Apr 16 '20 at 08:12
  • Finally did I figure it out. Thank you for your considerable help! Hope you can add it to the next version as soon as possible. – Ronan Apr 16 '20 at 11:13
  • It's already in the ...git version. I have two big merges now, then I will release a version, I hope this weekend. – Rmano Apr 16 '20 at 14:02
2

Partial answer: The following should work (or at least have some effect), but doesn't.

\documentclass{standalone}
\usepackage{circuitikz}

\begin{document}
\ctikzset{bipoles/length=.8cm}
\ctikzset{voltage/american font=\tiny}
\ctikzset{voltage/american plus=X}
\ctikzset{voltage/american minus=O}
\begin{circuitikz}
\draw (0,0) to[american voltage source,l=$U_z$] (0,2);
\node[below] at (current bounding box.south) {\csname pgf@circ@avplus\endcsname};
\end{circuitikz}
\end{document}
John Kormylo
  • 79,712
  • 3
  • 50
  • 120
  • Hi, these keys are for the external voltages (the ones with v=...) keys. The + and + of the generator are set with the current font (that's suboptimal, yes, I know). – Rmano Apr 15 '20 at 15:02