Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad line junctions sometimes #417

Closed
Rmano opened this issue Jun 30, 2020 · 3 comments
Closed

Bad line junctions sometimes #417

Rmano opened this issue Jun 30, 2020 · 3 comments
Assignees

Comments

@Rmano
Copy link
Collaborator

@Rmano Rmano commented Jun 30, 2020

Consider the following snippet:

\documentclass[border=10pt]{standalone}
\usepackage[RPvoltages]{circuitikz}
\begin{document}
\begin{tikzpicture}
    \coordinate(o) at (2,0);
    \draw (0,0) -- ++(0,1.5)coordinate(tmp) to[D,i=$i_{D}$,v=$u_{D}$]
    % problem here
    (tmp-|o)
       to[short,-*]
    (o)
    ;
\end{tikzpicture}
\end{document}

If you look at the result, you have:

image

Now, reverting this patch: 6efc2ee

seems to fix it. My problem is that I do not understand what the patch is doing... I will try to dig into it. Meanwhile, if @sistlind is here, could you shed some light? I have seen the bug report but I can't really understand it. Doing

  \draw (node) to[...] (whatever)

is expected to fail if the (node) has no border anchor anyway... or I am wrong?

I am trying to compile the manual with it reverted... let's see.

@Rmano Rmano self-assigned this Jun 30, 2020
@Rmano
Copy link
Collaborator Author

@Rmano Rmano commented Jun 30, 2020

So the original problem can be reduced to this thing:

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

\begin{circuitikz}
	\draw
	(0,0) node[npn] (npn6) {}
	(npn6.C)++(0,1) coordinate[](P4)
	(npn6.B) to[short,l=LO-,-o] ++(-0.5,0)
	(P4) to[R,l_=$R_2$,-] ++(0,2) node[vcc]{}
	;
	\draw
	(3,0) node[npn] (npn6) {}
	(npn6.C)++(0,1) node[draw=red](P4){}
	(npn6.B) to[short,l=LO-,-o] ++(-0.5,0)
	(P4) to[R,l_=$R_2$,-] ++(0,2) node[vcc]{}
	;
	\draw
	(6,0) node[npn] (npn6) {}
	(npn6.C)++(0,1) node[draw=red](P4){}
	(npn6.B) to[short,l=LO-,-o] ++(-0.5,0)
	(P4) to[] ++(0,2) node[vcc]{}
	;
\end{circuitikz}
\end{document}

which produces:

image

Now, the code is slightly incorrect --- (P4) is a node and not a coordinate, and as you can see, using the coordinate is ok. But effectively the behavior is strange, and it's due to circuitikz, because a normal to does not show it.

The patch fixes it but it disrupts the path, unfortunately. Not sure why because I do not understand the code ;-)

@Rmano
Copy link
Collaborator Author

@Rmano Rmano commented Jun 30, 2020

Now, this is a different patch (applied over the revert):

diff --git a/tex/pgfcircpath.tex b/tex/pgfcircpath.tex
index a20f8b7..c6a855a 100644
--- a/tex/pgfcircpath.tex
+++ b/tex/pgfcircpath.tex
@@ -107,6 +107,7 @@
 
     (\tikztostart) coordinate (\ctikzvalof{bipole/name}start)%necessary to get correct coordinates in the case of relative start/end or constructions like ((node1)-|(node2))
     (\tikztotarget) coordinate (\ctikzvalof{bipole/name}end)
+    (\tikztostart) % go back to start
     \pgfextra{
         \pgfmathanglebetweenpoints{\pgfpointanchor{\ctikzvalof{bipole/name}start}{center}}
         {\pgfpointanchor{\ctikzvalof{bipole/name}end}{center}}

Seems to fix both things:

image

and

image

So... any comment? @sistlind @mredaelli @der-stefan

@Rmano
Copy link
Collaborator Author

@Rmano Rmano commented Jul 1, 2020

Notice that now the original example in issue #76 compiles like this:

image

Which is correct --- P3 and P4 are nodes and so they have a non-zero sizes. You can see what's happening if you add [draw=red] to them:

image

The behavior of forcing the start point at the center of the node is not standard and creates a lot of problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

1 participant