I've stumbled over something I consider strange behavior in circuitikz.

The label distance for a bipole (in this case a lamp) seems to depend on whether the component is drawn from left to right (R) or right to left (L): From right to left, a label below is closer to the component, and a label above farther away, compared to when drawn from left to right.



\draw (1,0) to [lamp, l=R] ++(1,0)
            to [lamp, l_=R] ++(1,0);
\draw (4,0) to [lamp, l=L] ++(-1,0);
\draw (1,0) to [lamp, l_=L] ++(-1,0);


enter image description here

Is this a bug? Does anyone know how to fix this (locally in my code or in general)?

1 Answer 1


It is because the upper and lower positions are not equidistant, and when you purposely draw a reversed circuit, you will get the reverted positions, if you draw according to the syntax you will not have problems.

Probably they are not equidistant because the separation must be relative to the text box, that when the text has characters with descender, it separates more, for that reason to compensate, the separation is lower than the below label. What visually should be appropriate for the programmer, but when the direction is inverted should be commuted distances, but that does not happen.

How to fix this, is acustomize package issue, or redefine it, but to be something that happens outside the syntax because I think that for that reason there are direction modifiers such as mirror and invert.


enter image description here




%Normal sintaxis
\draw[color=blue] (0,0) 
    to [lamp, l=Sup-Lg,i_=i] ++(1.5,0)
    to [lamp, l=Sup-Rg,i=i] ++(1.5,0)
    to [lamp, l_=Inf-Rg,i=i] ++(1.5,0)
    to [lamp, l_=Inf-Lg,i=i] ++(1.5,0)
    to [short] ++(0,2)
    to [lamp, l=Sup-Lg,i=i] ++(-1.5,0)
    to [lamp, l=Sup-Rg,i=i] ++(-1.5,0)
    to [lamp, l_=Inf-Rg,i=i,invert] ++(-1.5,0) %invert command change symbol direction, has no effect in lamp
    to [lamp, l_=Inf-Lg,i=i] ++(-1.5,0);

%Bad sintaxis, that not define a circuit
\draw[color=blue] (1.5,-2)
    to [lamp, l=Sup-Rg,i=i] ++(1.5,0)
    to [lamp, l_=Inf-Lg,i=i] ++(1.5,0);
\draw[color=red] (6,-2)
    to [lamp, l=Sup-Rg,i=i] ++(-1.5,0);
\draw[color=green] (1.5,-2)
    to [lamp, l_=Inf-Lg,i=i] ++(-1.5,0);

%Revision draws
\draw[|-|,orange,thick] (1.2,0) -- ++(0,0.55) node[midway,right=-2pt]{\scriptsize 0.55};
\draw[|-|,orange,thick] (3.8,0) -- ++(0,-0.6) node[midway,right=4pt]{\scriptsize 0.6};
\draw[|-|,orange,thick] (1.2,2) -- ++(0,0.6) node[midway,right=-2pt]{\scriptsize 0.6};
\draw[|-|,orange,thick] (5.5,2) -- ++(0,-0.55) node[midway,right=4pt]{\scriptsize 0.55};

\draw[|-|,orange,thick] (1.2,-2) -- ++(0,0.6) node[midway,right=-2pt]{\scriptsize 0.6};
\draw[|-|,blue,thick] (5.5,-2) -- ++(0,-0.55) node[midway,right=4pt]{\scriptsize 0.55};

\draw[->,orange,thick] (.5,-.5) -- ++(2,0) node[midway,below=-2pt]{\scriptsize normal};
\draw[->,orange,thick] (3.5,.5) -- ++(2,0) node[midway,above=-2pt]{\scriptsize normal};
\draw[->,orange,thick] (2.5,-2) -- ++(1,0) node[midway,above=-2pt]{\scriptsize normal};
\draw[<-,orange,thick] (5,-1.5) -- ++(1,0) node[midway,above=-2pt]{\scriptsize reverse};
\draw[<-,orange,thick] (0.5,-2.5) -- ++(1,0) node[midway,below=-2pt]{\scriptsize reverse};
\draw[<-,orange,thick] (0.5,1.5) -- ++(2,0) node[midway,below=-2pt]{\scriptsize reverse};
\draw[<-,orange,thick] (3.5,2.5) -- ++(2,0) node[midway,above=-2pt]{\scriptsize reverse};

%finally with diodes:
    to [D*,l=Sup-Lg,i=i] ++(1.5,0)
    to [D*,l=Sup-Rg,i=i,invert] ++(1.5,0) % invert has effect, but not in current.
    to [D*,l_=Inf-Lg,i<=i,invert] ++(1.5,0) % i<, is used to change the current.
    to [D*,l_=Inf-Lg,i=i] ++(1.5,0);

    to [D*,l=Sup-Lg,i=i] ++(1.5,0)
    to [D*,l_=Inf-Rg,i=i] ++(1.5,0);
    to [D*,l_=Inf-Lg,i=i] ++(-1.5,0);
    to [D*,l=Sup-Lg,i=i] ++(-1.5,0);


You must log in to answer this question.

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