4

I have the following MWE:

\usepackage[colorlinks = true, citecolor=black, filecolor=black, linkcolor=black, urlcolor=black, linktocpage=true]{hyperref}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{siunitx}    
\usepackage{geometry}
\usepackage{tikz}      
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\usetikzlibrary{automata}
\usepackage[european,cuteinductors,fetbodydiode]{circuitikz}

\begin{document}
\begin{figure}[!h]
    \centering
    \begin{tikzpicture}[arrowmos]
        \draw (0,0) -- ++(0,0.75) to[short,i_=$a_1$] ++(0,0.5) to[short,-o] ++(0,0.5) node[right]{$b_1$} coordinate(b1);
        \draw [thick, dotted] (b1) -- ++(0,1);
    \end{tikzpicture}
\end{figure}
\end{document}

Which produces the output output. As you can see, the dotted line intersects the node circle. How can I avoid this?

1
  • have alook at the answer below -- coordinate does not have any border -- nodes have some border
    – js bibra
    Feb 22, 2021 at 16:05

2 Answers 2

6

As ever, @js bibra answer is ok. Just to explain a bit more what happens in the following (you can read a quite lengthy and full explication in the manual of circuitikz, section 5.1).

        \draw (0,0) -- ++(0,0.75) to[short,i_=$a_1$] ++(0,0.5) 
        to[short,-o] ++(0,0.5) node[right]{$b_1$} coordinate(b1);

When you use -o, circuitikz will add a node with the shape ocirc to the path. Nodes are drawn after the path is stroked; and the node is designed so that is filled with white. The coordinate b1 is then set at the point where you arrived (the node you added with $b_1$ has not moved it). Now

        \draw [thick, dotted] (b1) -- ++(0,1);

will draw the dotted line starting from b1, which is at the center of the ocirc node.

A different solution is to position the ocirc node after having drawn the dashed line.

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}

\begin{tikzpicture}[arrowmos]
    \draw (0,0) -- ++(0,0.75) to[short,i_=$a_1$] ++(0,0.5) 
        to[short] ++(0,0.5) node[right]{$b_1$} coordinate(b1);
    \draw [thick, dotted] (b1) -- ++(0,1);
    \node [ocirc] at (b1){};
\end{tikzpicture}
\end{document}

(BTW, notice that this is a real MWE).

A very similar problem is explained around page 174, in the FAQ:

enter image description here

Finally, as you comment, if you want to use the north coordinate of the pole, you have to put it explicitly so that you can name it:

\begin{tikzpicture}[arrowmos]
    \draw (0,0) -- ++(0,0.75) to[short,i_=$a_1$] ++(0,0.5) 
        to[short] ++(0,0.5) node[ocirc](b1){} node[right]{$b_1$};
    \draw [thick, dotted] (b1.norht) -- ++(0,1);
\end{tikzpicture}

enter image description here

Moreover, as noticed by John Kormylo, now b1 is a node reference, so the lines going out will start from the border anchor automatically:

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{tikzpicture}[arrowmos]
    \draw (0,0) -- ++(0,0.75) to[short,i_=$a_1$] ++(0,0.5) 
        to[short] ++(0,0.5) node[ocirc](b1){} node[right]{$b_1$};
    \draw [thin,  red] (b1) -- ++(0,1);
    \draw [thin, blue] (b1) -- ++(1,1);
    \draw [thin, dashed] (b1) -- ++(-1,1);
    \draw [thin, dotted] (b1) -- ++(0.5,1);
\end{tikzpicture}
\end{document}

enter image description here

4

enter image description here

\begin{tikzpicture}[arrowmos]
        \draw (0,0) -- ++(0,0.75) to[short,i_=$a_1$] ++(0,0.5) to[short,-o] ++(0,0.5) node[right]{$b_1$} node[inner sep=1pt](b1){};
        \draw [thick, dotted] (b1) -- ++(0,1);
    \end{tikzpicture}
5
  • Thanks! But isn't it kind of a hack to use a node directly after a node and furthermore define the inner sep? I tried to use the anchor b1.north too but that hasn't worked aswell
    – Steradiant
    Feb 22, 2021 at 16:08
  • if it serves the purpose its not a hack -- its ingenuity and being a yoda level operator
    – js bibra
    Feb 22, 2021 at 16:13
  • 1
    @Steradiant if you use -o the internal ocirc node is not accessible. You can put the node explicitly, with node [ocirc](name){} and then you can use (name.north)
    – Rmano
    Feb 22, 2021 at 18:22
  • @Rmano - or just (name). Just tried it. Feb 22, 2021 at 21:28
  • @JohnKormylo you're right - being a node name the line will automatically start at the border!
    – Rmano
    Feb 22, 2021 at 21:37

You must log in to answer this question.

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