2

I am using Circuitikz to draw some diagrams involving American batteries (battery1). By default, it includes the polarity, but it places the label partially overlapping it. (See the top image in the diagram below.) I would like to move the 50 V label to below the battery. When I try to do this using either l_ or a, it does move the 50 V label, but also removes the + and - indicating the battery polarity (see the second and third diagrams below). I'd like to move the label but keep the polarity. How can I do this?

The code below shows what I have tried:

    \documentclass[border=3pt]{standalone}
    \usepackage{tikz}
    \usepackage[americanvoltages,fulldiodes,siunitx]{circuitikz}
    \begin{document}
    \begin{circuitikz}
    \draw  (0,0) to [battery1=$50 \, \mathrm{V}$] (3,0); % Polarity, but label above
    \draw  (0,-2) to [battery1,a=$50 \, \mathrm{V}$] (3,-2); % Label below, no polarity
    \draw  (0,-4) to [battery1,l_=$50 \, \mathrm{V}$] (3,-4); % Label below, no polarity
    \end{circuitikz}
    \end{document}

what I'm getting

3

Use a "blank" voltage and a label (also fixed warnings and used siunitx correctly):

\documentclass[border=3pt]{standalone}
\usepackage[americanvoltages,fulldiodes,siunitx, nooldvoltagedirection]{circuitikz}
\begin{document}
    \begin{circuitikz}
        \draw  (0,-4) to [battery1,v_={~}, l^=\SI{50}{V}] (3,-4); % Label below, no polarity
    \end{circuitikz}
\end{document}

enter image description here

You can use v_, v^, l_, l^ for the above/below position.

The overlap was at least partially fixed in one of the recent versions of circuitikz (This is why I have no overlap here: this is with version 1.2.3).

enter image description here

 \draw  (0,-4) to [battery1,v=\SI{50}{V}] (3,-4); 
5
  • That moves both the polarity AND the label, and on my system, they overlap whether they are together above or together below. How can I get the polarity and the label on opposite sides? – Lauren Pearce Oct 1 '20 at 17:02
  • Ah, ok. Wait... – Rmano Oct 1 '20 at 17:03
  • Your responsive answers is enough to love your package :) – Diaa Oct 1 '20 at 17:06
  • Thanks @Diaa :<3 – Rmano Oct 1 '20 at 17:08
  • @Rmano Thanks! I guess I should update circuitikz; I usually wait for a new TeXLive. – Lauren Pearce Oct 1 '20 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.