Circuitikz doesn’t draw transmission line with overlay option

circuitikztikz-pgf

Consider the following MWE.

\documentclass{article}

\usepackage{circuitikz}

\begin{document}

\begin{circuitikz}
  \draw (0,0) to [TL] (2,0);
\end{circuitikz}

\begin{circuitikz} [overlay]
  \draw (0,0) to [TL] (2,0);
\end{circuitikz}

\end{document}

MWE output

For some reason the transmission line symbol is not drawn when using the overlay option.

Why is that and how can I get around it?

Best Answer

update:

should be fixed starting from 1.4.6, see https://github.com/circuitikz/circuitikz/issues/604

workaround

(but it breaks fill opacity, mind you; proper fix in the update above)

Puzzling. In the drawing of the TL legacy shape there is a transparency group (I do not remember why) that seems to confuse or badly interact with overlay. Removing it fixes the issue at hand, but I have to study it a bit more.

\documentclass{article}

\usepackage{circuitikz}
\makeatletter
\pgfcircdeclarebipolescaled{RF}
{}
{\ctikzvalof{bipoles/tline/height}}
{tline}
{\ctikzvalof{bipoles/tline/height}}
{\ctikzvalof{bipoles/tline/width}}
{
    \pgf@circ@res@step=.2\pgf@circ@res@right % half x axis
    % \begin{pgftransparencygroup}
        \pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
        \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@up}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@left+\pgf@circ@res@step}{\pgf@circ@res@up}}
        \pgfpatharc{-90}{90}{-\pgf@circ@res@step and -\pgf@circ@res@up}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{\pgf@circ@res@down}}
        \pgf@circ@draworfill
        \pgfpathellipse{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
        {\pgfpoint{\pgf@circ@res@step}{0pt}}{\pgfpoint{0pt}{-\pgf@circ@res@up}}
        \pgf@circ@draworfill
    % \end{pgftransparencygroup}
    \pgfsetlinewidth{\pgfstartlinewidth}
    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@right-\pgf@circ@res@step}{0pt}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@right}{0pt}}
    \pgfusepath{stroke}
}
\makeatother

\begin{document}

\begin{circuitikz}
  \draw (0,0) to [TL] (2,0) to[R] (4,0) to[generic] (6,0);
\end{circuitikz}

\begin{circuitikz} [overlay]
  \draw (0,0) to [TL] (2,0) to[R] (4,0) to[generic] (6,0);
\end{circuitikz}

\end{document}

enter image description here