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.

This may seem a bit trivial, but I am writing TikZ code with an enormous number of unlabelled nodes. It frustrates me that I have to type {} at the end of every node declaration. Is there some straightforward way to avoid having to type this? Omitting the {} gives a compilation error: A node must have a (possibly empty) label text.

share|improve this question
add comment

1 Answer

up vote 10 down vote accepted

The {} are part of the internal used syntax and can't be avoided (just replaced by \bgroup \egroup, but that doesn't help you).

If your \nodes don't have any content and size and are only used to store the coordinates, then I would use \coordinate instead (or \path coordinate). It is basically a \node without content. IIRC it uses \node [..] {}; internally.

Alternatively just write your own macro which inserts the correct \node syntax itself.

share|improve this answer
1  
Such a macro could be something as simple as \def\nod [#1]{\node[#1] {} }. You can then write \nod [draw=red]; instead of \node[draw=red] {};. –  Jake Aug 16 '11 at 10:26
    
Thanks Jake, just what I needed. –  Jamie Vicary Aug 16 '11 at 10:47
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.