[Tex/LaTex] Dashed short circuits in CircuiTikz

circuitikzcircuits

I have a circuit in CircuiTikz in which I am trying to add a dashed short circuit. I know about the \draw[dashed], but this gives me dashed lines also in the endpoints.Circuit with dashed lines

\documentclass[border=5mm]{standalone}
\usepackage{circuitikz}

\begin{document}
\begin{figure}[ht]
    \begin{circuitikz}
        \draw           (0,0)       node[op amp] (opAmp) {};

        \draw           (opAmp.-)   to[short,-] ++(-0.5,0) coordinate (J5);

        \draw[dashed]   (J5)        to[short,*-o] ++(0,2)
    \end{circuitikz}
\end{figure}
\end{document}

Is there a way to not have the endpoints dashed?

Best Answer

The easiest way is to not use the circ and ocirc shapes defined by circuitikz but to define styles with the same names so that TikZ does not choose the shapes.

\documentclass[border=5mm]{standalone}
\usepackage{circuitikz}
\tikzset{
  circ/.style={
    shape=circle,
    color/.expanded=\pgfkeysvalueof{/tikz/circuitikz/color},
    draw, fill, solid, inner sep=+0pt,
    minimum size=2*\pgfkeysvalueof{/tikz/circuitikz/nodes width}*\pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
  },
  ocirc/.style={circ, fill=white}
}
\begin{document}
\begin{circuitikz}
  \draw           (0,0)       node[op amp] (opAmp) {};
  \draw           (opAmp.-)   to[short,-] ++(-0.5,0) coordinate (J5);
  \draw[dashed]   (J5)        to[short,*-o] ++(0,2);
\end{circuitikz}
\end{document}

Though, if you look closer, that line actually is put together by two lines with a null-node in the middle (the shortshape). This is the reason the dashing is not consistent. It becomes very noticeable if you do

  \draw[dashed] (J5) to[short,*-o] ++(0,1);
Related Question