Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'd like to get two or three nodes linking to a ground symbol (this is not an electric circuit), as in this attempt:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{circuitikz}
\begin{document}

\begin{tikzpicture}
\node[](a){X};
\node[](b)[right=of a]{Y};
\node[ground](g)[below=of a]{};
\draw[-] (a.south) -- (g.north);
\draw[-] (b.south) -- (g.north);
\end{tikzpicture}

\end{document}

But this fails with the following error:

! Package PGF Math Error: Unknown function `north' (in 'north').

See the PGF Math package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.12 \node[ground](g)[below=of a.east]{};

? 

And yet, TeX still outputs the PDF, which seems correct... What am I doing wrong?

(I am willing to use another library instead of circuitikz if it makes things easier)

edit: included an example with two nodes linking to ground, not only one

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

The monopole ground has only center anchor. So you can not refer to its north. Also positioning library uses that anchor when you say put it below such and such, so we have to reanchor it to its center. Hence everytime you want to refer to it either should use the node name or node name.center syntax. I would go with the TikZ' own circuit library to avoid such unforeseen problems.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{circuitikz}
\begin{document}

\begin{tikzpicture}
\node (a){X};
\node (b)[right=of a]{Y};
\node[ground,below=of a,anchor=center] (g) {};
\draw (a.south) -- (g);
\draw (b.south) -- (g);
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
Thanks a lot, really! Now it all works as I intended. –  Jay Jun 30 '12 at 1:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.