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 wish to draw a ground symbol in a circuit diagram using the circuits.ee.IEC TiKZ library. The example in the PGF Manual (pdf) on page 311 shows exactly what I want. However, when I try to draw it, the wire is extended beyond the ground symbol:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}

\begin{document}
\begin{tikzpicture}[circuit ee IEC]
\draw (0,0) to[ground] (3,0);
\end{tikzpicture}
\end{document}

Ground symbol does not end wire

How do I fix this, so the ground symbol ends the wire as in the example?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You can supply pos=1 to the ground key to position the symbol at the end of the line instead of in the middle:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}

\begin{document}
\begin{tikzpicture}[circuit ee IEC]
\draw (0,0) to [ground={pos=1}] (3,0);
\end{tikzpicture}
\end{document}

Or, as percusse suggested in a comment, you could place the symbol as a "proper" node instead of passing it to the to keyword. Note that you'll have to supply an empty set of brackets and use the right keyword (and an appropriate rotate option if the wire isn't going from left to right).

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}

\begin{document}
\begin{tikzpicture}[circuit ee IEC]
\draw (0,0) -- (3,0) node [ground, right] {};
\end{tikzpicture}
\end{document}
share|improve this answer
2  
Or you don't make it a connecting node and place it at the end \draw (0,0) -- (3,0) node[ground,right]{}; –  percusse Sep 6 '12 at 15:00
    
Perfect, thanks! =) –  Tomas Lycken Sep 6 '12 at 15:04
    
I had to use \draw (0,0) to [ground={pos=1, right}] (3,0); for some reason. –  someonr Jan 17 at 14:46
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.