Cannot get circuit component label on both sides

With lot of manual tweak in defining labels positions ...

\documentclass[border=3mm,
               many,
               prewiev]{standalone}
\usepackage[siunitx]{circuitikz}

    \begin{document}
    \begin{circuitikz}\draw
        (0,0) to[V=12<\volt>] (0,4) -- (0,6)
              to[R=$R_1$]       node[pos=0.05,below left=1.5ex] {\SI{1.0}{\kilo\ohm}} (8,6) -- (8,4)
              to[R=$R_L$, *-*]  node[pos=-0.05,above left=1.5ex] {\SI{1.0}{\kilo\ohm}}    (8,0)
              to[R=$R_5$]       node[pos=0.1,above right=1.5ex] {\SI{1.0}{\kilo\ohm}} (4,0)
              to[R=$R_4$]       node[pos=0.1,above right=1.5ex] {\SI{1.0}{\kilo\ohm}} (0,0);
        \draw
        (0,4) to[R=$R_2$]       node[pos=0.1,below left=1.5ex] {\SI{1.0}{\kilo\ohm}} (4,4)
              to[R=$R_3$]       node[pos=0.1,below left=1.5ex] {\SI{1.0}{\kilo\ohm}} (8,4);
        \draw (4,4) to[R=$R_6$] node[pos=-0.05,above left=1.5ex] {\SI{1.0}{\kilo\ohm}}  (4,0);
        \draw (0,-1) -- node[ground]{} (0,0);
    \end{circuitikz}
    \end{document}

enter image description here


For occasional usage, it can be done without manual positioning tweaks by naming the bipole and later attaching another label node to the bipole's anchors:

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

\begin{document}
\begin{circuitikz}
  % for one-off usage:
  \draw (0,0) to[R=1.0<\kilo\ohm>,n=R1] ++(2,0) (R1.s) node[below] {$R_1$};
\end{circuitikz}
\end{document}

enter image description here

However, this is not very convenient usage. Because of the way circuitikz is implemented, I have not succeeded in finding a way to add both labels at the time the bipole is drawn.

You could package this into a convenience macro if you plan to use it more often. With more information about your desired syntax, I may be able to help with this.


I am not sure that you can have two labels (one able and the other below), but you can combine them into one label as I have done to the one in red:

enter image description here

To move the ones ion blue to be on top you need to use the underscore since you are drawing from right to left.

Notes:

  • If you want the labels on two lines you could look at Set label name on two lines in CircuiTikZ, but both the labels are on the same side.

Code:

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

\begin{document}

\begin{center}
    \begin{circuitikz}\draw
        (0,0) to[V=12<\volt>] (0,4) -- (0,6)
              to[R, l=\mbox{$R_1=\SI{1.0}{\kilo\ohm}$}, red] (8,6) -- (8,4)
              to[R=$R_L$, l=2.0<\kilo\ohm>, *-*] (8,0)
              to[R=$R_5$, l_=3.0<\kilo\ohm>, blue] (4,0)
              to[R=$R_4$, l_=4.0<\kilo\ohm>, blue] (0,0);
        \draw
        (0,4) to[R=$R_2$, l=5.0<\kilo\ohm>] (4,4)
              to[R=$R_3$, l=6.0<\kilo\ohm>] (8,4);
        \draw (4,4) to[R=$R_6$, l=5.6<\kilo\ohm>] (4,0);
        \draw (0,-1) -- node[ground]{} (0,0);
    \end{circuitikz}
\end{center}
\end{document}

Tags:

Circuitikz