3

I am drawing a simple diagram on circuitikz with the following code

\documentclass{standalone}
\usepackage[american]{circuitikz}
\usepackage{siunitx}

\begin{document}

\begin{circuitikz}[scale=1.25]
\ctikzset{label/align=smart,bipoles/length=1.5cm}
\draw (0,0) to[R,l_=\mbox{$R_1=\SI{2}{\ohm}$},*-*] (4,0);
\draw (4,0) to[R,l^=\mbox{$R_2=\SI{2}{\ohm}$},*-*] (2,3);
\draw (2,3) to[R,l_=\mbox{$R_3=\SI{2}{\ohm}$},*-*] (0,0);
\end{circuitikz}

\end{document}

enter image description here

It seems that l_= and l^= does not work with diagonal elements or am I missing something? How can I put $R_2$ and $R_3$ on top of the resistor?

1 Answer 1

4

Just switch the coordinates.

(4,0) ... (2,3); To (2,3) ... (4,0)
(2,3) ... (0,0); To (0,0) ... (2,3)

\documentclass[border={10}]{standalone}
\usepackage[american]{circuitikz}
\usepackage{siunitx}

\begin{document}

\begin{circuitikz}[x=1.5cm,y=1.5cm]
\ctikzset{label/align=smart,bipoles/length=1.5cm}
\draw (0,0) to[R,l_=\mbox{$R_1=\SI{2}{\ohm}$},*-*] (4,0);
\draw (2,3) to[R,l^=\mbox{$R_2=\SI{2}{\ohm}$},*-*] (4,0);
\draw (0,0) to[R,l_=\mbox{$R_3=\SI{2}{\ohm}$},*-*] (2,3);
\end{circuitikz}

\end{document}

The result is

enter image description here

I've replaced [scale=1.25] with [x=1.5cm,y=1.5cm]. As @Gonzalo Medina mentioned in his answer :

Instead of scaling the circuit, you can use x=, y=, so labels, for example, won't be affected.

You must log in to answer this question.

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