# Circuitikz: How to literally scale a circuit schematic drawn by relative length unit?

For the following, I need to:

1- scale the components size, wires lengths, connection nodes according to the drawing scale set by the font size

2- make both the components and the wires have the same thickness that is dependent on the global relative unit length for every scale since the wires seem thinner

3- scale the flow arrow length so that it always (regardless of the drawing scale) covers the distance between the end of the resistor and the start of the inductor.

4- know if the connection nodes between the wires and resistor/inductor can be loosened or smoothed instead of this sharp connection.

\documentclass{article}
\usepackage[
american,
siunitx ,
RPvoltages,
]{circuitikz}
\begin{document}
\tiny
\begin{circuitikz}[x=3em, y=3em]
\draw (0,2) to[R=$R_a$, o-] ++(2,0)
to[short,f=$i_a$] ++(0.1,0)
to[L, cute inductor, l=$L_a$]  ++(2,0);
\end{circuitikz}

\normalsize
\begin{circuitikz}[x=3em, y=3em]
\draw (0,2) to[R=$R_a$, o-] ++(2,0)
to[short,f=$i_a$] ++(0.1,0)
to[L, cute inductor, l=$L_a$]  ++(2,0);
\end{circuitikz}

\Large
\begin{circuitikz}[x=3em, y=3em]
\draw (0,2) to[R=$R_a$, o-] ++(2,0)
to[short,f=$i_a$] ++(0.1,0)
to[L, cute inductor, l=$L_a$]  ++(2,0);
\end{circuitikz}
\end{document}

• The best way to scale "everything" (after getting the values as suggested by @john-kormylo in their answer) is using transform canvas (which has a problem with reference point, though) or, better, scalebox, see tex.stackexchange.com/questions/544495/… Commented Dec 25, 2020 at 12:20
• Anyways, scaling linewidths down is really dangerous --- if you go subpixel, you are in the hand of the various antialiasing algorithm and everything can happen... Commented Dec 25, 2020 at 12:21
• @Rmano What about the flow arrow length? How can I manually add to its length?
– Diaa
Commented Dec 25, 2020 at 17:46
• @Rmano For example, I need to scale its length by 1.2 and its head size by 0.8.
– Diaa
Commented Dec 25, 2020 at 17:49
• The flow arrow is not a TikZ arrow, it is a shape, so you can't scale its parts differently. You can use the "advanced flows" to build your own arrow, see the manual, section 4.8, around pag 158, and tex.stackexchange.com/a/549354/38080 See also tex.stackexchange.com/questions/574576/… for an example application Commented Dec 25, 2020 at 18:39

The first step is to determine the relative size of the fonts.

\documentclass{article}
\usepackage{pgfmath}

\newcommand{\scale}{}% reserve global name
\newcommand{\setscale}[1]{\sbox0{#1\strut}%
\pgfmathdivide{\ht0}{\ht\strutbox}%
\let\scale=\pgfmathresult}

\begin{document}
\setscale{\tiny}tiny \scale

\setscale{\scriptsize}scriptsize \scale

\setscale{\footnotesize}footnotesize \scale

\setscale{\small}small \scale

\setscale{\normalsize}normalsize \scale

\setscale{\large}large \scale

\setscale{\Large}Large \scale

\setscale{\huge}huge \scale

\end{document}


Then you need to apply it to several scale factors in circutikz.

\documentclass{article}
\usepackage[
american,
siunitx ,
RPvoltages,
]{circuitikz}

\newcommand{\tinyscale}{0.5}
\newcommand{\Largescale}{1.5}

\begin{document}
\tiny
\ctikzset{bipoles/thickness=\tinyscale}
\begin{circuitikz}[scale=\tinyscale, transform shape, use fpu reciprocal, line width={\tinyscale*0.5pt}]
\draw (0,2) to[R=$R_a$, o-] ++(2,0)
to[short,f=$i_a$] ++(0.1,0)
to[L, cute inductor, l=$L_a$]  ++(2,0);
\end{circuitikz}

\normalsize
\ctikzset{bipoles/thickness=1}
\begin{circuitikz}
\draw (0,2) to[R=$R_a$, o-] ++(2,0)
to[short,f=$i_a$] ++(0.1,0)
to[L, cute inductor, l=$L_a$]  ++(2,0);
\end{circuitikz}

\Large
\ctikzset{bipoles/thickness=\Largescale}
\begin{circuitikz}[scale=\Largescale, transform shape, use fpu reciprocal, line width={\Largescale*0.5pt}]
\draw (0,2) to[R=$R_a$, o-] ++(2,0)
to[short,f=$i_a$] ++(0.1,0)
to[L, cute inductor, l=$L_a$]  ++(2,0);
\end{circuitikz}
\end{document}


• Thanks for your answer. However, I would like to have some automation without the need to have the skill of guessing the right numbers of thickness, line width and scale.
– Diaa
Commented Dec 24, 2020 at 18:51
• I revised the solution. Commented Dec 24, 2020 at 21:09
• Is it possible to replace 0.5pt of the line width with the saved value so that it goes in sync when using the options of thick, very thick`, etc.?
– Diaa
Commented Dec 24, 2020 at 21:39
• If that were the case, no one would be able to change just the font size and nothing else. You might be able to put everything into one macro using \ctikzset for the options. You might be able to do something with \pgflinewidth (length). Commented Dec 25, 2020 at 2:06
• See tex.stackexchange.com/questions/395372/… to see what is involved. Worse, circuitikz keeps changing how things are done, and fixes like this only work for awhile. Commented Dec 26, 2020 at 3:40