4

The following code displays the problem

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{circuits}

\begin{document}
\begin{tikzpicture}[circuit]
    \draw (0,0) to [circuit handle symbol={draw,shape=rectangle,at start}] (0,3);
    \draw (1,3) to [circuit handle symbol={draw,shape=rectangle,at end}] (1,0);
\end{tikzpicture}
\end{document}

This, compiled with expected output before upgrading to latest version of pgf. The two lines ending in a small rectangle should be identical, but in the case of at end it seems that the rectangle is rotated and thus moving the paths end point from the expected end point.

What I would like now is to control this behavior using a parameter in my tikzets since I ofcourse have tons of them for my drawings library.

enter image description here

2
  • Looks like a bug to me. Make a bug report. Jan 3, 2017 at 9:46
  • 1
    I've never reported bugs before. But I've tried now. Thanks for the tip.
    – DrJay
    Jan 3, 2017 at 10:17

1 Answer 1

1

You are right; there is a problem when the node is added at pos=1 (and only then). It seems that the anchoring point (with respect to the node) is at west all the time.

I see two ways to handle the situation: either using anchor=south, or whatever is convenient in the case at hand, or using pos=.999. I would prefer the latter.

An example.enter image description here

\documentclass[11pt, border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{circuits}

\begin{document}

\begin{tikzpicture}[circuit,
  every node/.style={scale=.7},
  every label/.style={text=black, scale=.9}]
  \draw[gray, very thin, dashed] (-2, -1) grid (7, 5);
  \draw[thick]
  (-2, 0) node[fill=white] {start level} -- +(1.5, 0)
  (-2, 4) node[fill=white] {end level} -- +(1.5, 0);
  
  \draw[blue, thick] (0, 0) to [
  circuit handle symbol={draw, shape=rectangle, fill=yellow, at start},
  circuit handle symbol={draw, shape=rectangle, pos=.7},
  circuit handle symbol={draw, shape=rectangle, at end}
  ] +(2, 4);

  \draw[red, thick] (2, 0) to [
  circuit handle symbol={draw, shape=rectangle, fill=yellow, at start},
  circuit handle symbol={draw, shape=rectangle, pos=.7},
  circuit handle symbol={%
    draw, shape=rectangle, at end, anchor=south,
    label={[above]80:{with anchor=south}}
  }] +(2, 4);
  
  \draw[red, thick] (4, 0) to [
  circuit handle symbol={draw, shape=rectangle, fill=yellow, at start},
  circuit handle symbol={draw, shape=rectangle, pos=.7},
  circuit handle symbol={%
    draw, shape=rectangle, pos=.9999,
    label={[above right, text width=5em]90:with pos=.9999}
  }] +(2, 4);  
\end{tikzpicture}  

\end{document}

You must log in to answer this question.

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