The following example uses circuitikz
, but the question is about expressing coordinates in generic tikz
.
Look at the following code:
\documentclass[border=10pt]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}[american]
\draw (0,0) node[npn](Q1){};
\draw (Q1.E) to[R=$R_E$] (0,-2.5) node[ground]{};
\draw [gray] (Q1.E) -- ++(2,0)
coordinate(tmp) to[C, color=gray] (tmp |- 0, -2.5)
node[ground, color=gray]{};
\end{circuitikz}
\end{document}
where all the grounds are supposed to be at (x, -2.5). The tricky thing is the coordinate (tmp |- 0, -2.5)
(hint from here): what I want to express is the concept of a coordinate which is
(the current path x, the absolute y -2.5)
and the solution I found is, as you can see, using a temporary node. Is there an easier way to write that coordinate?
BTW, for easier way I mean something to directly say "move to the coordinate that has the current value of x, and y=-2.5", like for example
\draw [gray] (Q1.E) -- ++(2,0)
to[C, color=gray] (\magiccurrentx, -2.5)
node[ground, color=gray]{};
...or a similar thing.
(Q1.E)
to(0,-2.5)
than you can use only relative coordinates:\draw [gray] (Q1.E) -- ++(2,0) to[C, color=gray] ++ (0,-1.73) node[ground, color=gray]{};
. as i see your mwe, this distance is not known, so you determine end of this path by coordinate defined by(tmp |- 0, -2.5)
. as far as i know, for this is no better way. – Zarko Oct 3 '18 at 11:42(tmp |- 0, -2.5)
already what you're looking for? If not, please consider editing(the current path x, the absolute y -2.5)
in such a way that it is a bit clearer. – user121799 Oct 3 '18 at 14:55