4
\documentclass{standalone}
\usepackage[siunitx]{circuitikz}
\begin{document}
    \begin{circuitikz}
    \draw (0,0) to[V, v=$10V$,invert] (0,6) -- (2,6)
    to[R, l_={$ \SI{100}{\kilo\ohm}$},] (2,3)
    to[R, l_={$ \SI{100}{\kilo\ohm}$}] (2,0) 
    -- (0,0);
    \draw (4,3) to [R, l={$R_{\text{probe}}=1$M$\Omega$}] (4,0) -- (2,0);
    \draw[-Latex] (2,3) -- (5,3);
    \node[circ] at (4,3) {}; % Default label (you can customize it)
    \node[above right] at (4,3) {$V_{\text{out}}$};
    \end{circuitikz}
\end{document}

I'd like to rotate the labels for the resistors 90° and for the 1$M$\Omega$ --> I'd like place this on the right side and the R_{probe} on the left side (so both 90°) rotated.

I tried:

\draw (4,3) to [R, l_={\rotatebox{90}{$R_{\text{probe}}=1$M$\Omega$}}] (4,0) -- (2,0);

but with this it's not centered original

0

3 Answers 3

1

One possible "pure" circuitikz solution (without adding separate nodes for the labels) is this.

I had to change the direction in which the components are drawn because the labels under the rotate regime follow that direction when they are vertical.

For the "both side", I used a label and an annotation together.

\documentclass[border=3mm]{standalone}
\usepackage[siunitx]{circuitikz}
\begin{document}
    \begin{circuitikz}
    \ctikzset{label/align=rotate}
    \draw (2,0)
    to[R, l=\qty{100}{\kohm}] (2,3)
    to[R, l=\qty{100}{\kohm}] (2,6)  -- (0,6)
    to[V, v<=$10V$] (0,0) -- (2,0);
    \draw (2,0) -- (4,0)
    to [R, l=$R_{\text{probe}}$, a=\qty{1}{\Mohm}] (4,3);
    \draw[-Latex] (2,3) -- (5,3);
    \node[circ] at (4,3) {};
    \node[above right] at (4,3) {$V_{\text{out}}$};
    \end{circuitikz}
\end{document}

enter image description here

4

Option label/align=rotate.

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

\begin{document}
    \begin{circuitikz}
    \draw (0,0) to[V, v=$10V$,invert] (0,6) -- (2,6)
    to[R, l_={$ \SI{100}{\kilo\ohm}$},] (2,3)
    to[R, l_={$ \SI{100}{\kilo\ohm}$}] (2,0) 
    -- (0,0);
    \draw (4,3) to [R, l={$R_{\text{probe}}=1$M$\Omega$}, label/align=rotate] (4,0) -- (2,0);
    \draw[-Latex] (2,3) -- (5,3);
    \node[circ] at (4,3) {}; % Default label (you can customize it)
    \node[above right] at (4,3) {$V_{\text{out}}$};
    \end{circuitikz}
\end{document}

enter image description here

2
  • 2
    You can also use a global \ctikzset{label/align=rotate} to have all the labels rotating along the component. Section 5.1.3, "labels and annotation orientation". (+1!)
    – Rmano
    Commented Jan 21 at 21:01
  • 1
    @Rmano You're great!!! Thankssssssssss.
    – Sebastiano
    Commented Jan 21 at 21:03
4

According to the documentation of the package siunitx, the command \SI is not recommended. Instead, use \qty.

The key name is used. Then the text is placed with a \node with the option rotate=90 using the previously given name.

Furthermore, $10V$ is replaced by \qty{10}{\volt} and $1$M$\Omega$ by \qty{1}{\mega\ohm}.

enter image description here

\documentclass[border=6pt]{standalone}
\usepackage[siunitx]{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0,0) to[V,v=\qty{10}{\volt}] (0,6)--(2,6) to[R,name=A] (2,3) to[R,name=B] (2,0)--(0,0);
\node[above,rotate=90] at (A.south) {\qty{100}{\kilo\ohm}};
\node[above,rotate=90] at (B.south) {\qty{100}{\kilo\ohm}};
\draw (4,3) to[R,name=C] (4,0)--(2,0);
\node[above,rotate=90] at (C.south) {$R_{\text{probe}}$};
\node[below,rotate=90] at (C.north) {\qty{1}{\mega\ohm}};
\draw[-Latex] (2,3)--(5,3);
\node[circ] at (4,3) {}; % Default label (you can customize it)
\node[above right] at (4,3) {$V_{\text{out}}$};
\end{circuitikz}
\end{document}
1
  • Yes, that works, but it's a pity to add separate nodes when circuitikz has the possibility to align the labels automatically... see the manual, section 5.1.3, "label and annotation orientation".
    – Rmano
    Commented Jan 21 at 21:06

You must log in to answer this question.

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