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'm trying to label a circled node in Tikz with some text to the left. The problem is it is colliding with the circle.

For example I have something like:

\begin{tikzpicture}
\node[draw,circle] at (0,0) {A};
\node[left] at (0,0) {010101};
\end{tikzpicture}

This causes the binary to overlap the node A. What is the best way to fix this?

share|improve this question

3 Answers 3

up vote 5 down vote accepted

One way to fix this is to load the positioning library

enter image description here

Note that in the code below I have named your first node as nameofnode and then positioned the text in relation to it by using left=of nameofnode.

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}
\node[draw,circle](nameofnode) at (0,0) {A};
\node[left=of nameofnode] {010101};
\end{tikzpicture}

\end{document}
share|improve this answer
    
Thanks! I'm trying to work out how to get the binary label a bit closer now. –  Andrew Oct 31 '12 at 16:24
3  
@Andrew Try left=<distance> of nameofnode and vary <distance>. –  Loop Space Oct 31 '12 at 16:26
    
@AndrewStacey perfect, I was just about to say that :) –  cmhughes Oct 31 '12 at 16:27
    
OK, thanks again! –  Andrew Oct 31 '12 at 16:29

Instead of placing the text node at via coordinates, you could name the circle node and place it to the left of the named circled node:

enter image description here

Code:

\documentclass[border=2pt]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
  \node[draw,circle] (CircleNode) at (0,0)  {A};
  \node[left] at (CircleNode.west) {010101};
\end{tikzpicture}

\end{document}
share|improve this answer

An even easier version is using the label option for nodes:

\documentclass{article}
\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}
        \node[draw,circle,label=left:010101] (CircleNode) at (0,0)  {A};
    \end{tikzpicture}
\end{document}

It looks just like Peter Grill's solution.

share|improve this answer

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.