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.

The following is a snippet of the original. It works..,

\documentclass[12pt]{article}
\usepackage{tikz} % drawing support
\usetikzlibrary{trees,arrows,decorations.markings}
\definecolor{darkgreen}{rgb}{0,.5,0}
\begin{document}
  \begin{tikzpicture}[yscale=-1,scale=1,label/.style={postaction={decorate,decoration={ markings, mark=at position .5 with \node #1;}} }]
    \node at (0,0) (node0) [inner sep=0pt,minimum width=1mm,circle,draw=blue] {1};                       % node#1 
  \end{tikzpicture}
\end{document}

The label style is primarily for edges which don't appear in the snippet above. However, I'd like to label the nodes, too: change the \node line to:

\node at (0,0) (node0) [inner sep=0pt,minimum width=1mm,circle,draw=blue] [label=60:X] {1};                       % node#1 

which is intended to put the letter "X" at a 60 degree angle from the node.

Tikz then "blesses" me with a

Package tikz Error: A node must have a (possibly empty) label text.

I've tried numerous combinations of [] {} etc, and haven't gotten the code to work.

share|improve this question
2  
I think to call label a custom style is bad as there's already a label: check on the manual. A more correct way (at least it works ;) ) to do that (I mean using the library markings) is my style insert node. –  Claudio Fiandrino Sep 12 '13 at 15:29
    
Thank you for your hint. I'm now using –  user21497 Sep 12 '13 at 16:16
    
\tikzstyle{edgelabel}=[style={postaction={decorate,decoration={ markings, mark=at position .5 with \node #1;}} }] –  user21497 Sep 12 '13 at 16:17
    
Don't use the obsolete tikzstyle, see Should \tikzset or \tikzstyle be used to define TikZ styles? –  Claudio Fiandrino Sep 13 '13 at 6:13

1 Answer 1

As TikZ already has already a label option (see section 16.10 The Label and Pin Options in the pgfmanual) you can not define your own style calling it label (moreover with a different aim).

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.