TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm just getting warmed to tikz so please forgive me if this is a dumb question I want to declare an newcommand containing a node with text:

\newcommand{\mydoor}[1] {
\draw[black] (1,-1) -- (1,-0) node[right,near start] {{#1}};


The output I get is not "| mytext" but "| ["

What on earth am I missing and how can I design a simple line with a configurable text (I want to use this on a more complicated polygon, therefore the environment)?

share|improve this question

closed as too localized by egreg, percusse, Marco Daniel, Torbjørn T., Martin Schröder Aug 19 '12 at 12:45

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 2 down vote accepted

The syntax is not right: twice brackets are not necessary in the command definition as the semicolon in the call of the command. Moreover the argument (the text) is mandatory, thus you should use brackets and not square brackets. Try in this way:


\newcommand{\mydoor}[1] {
\draw[black] (1,-1) -- (1,-0) node[right,near start] {#1};


which gives:

enter image description here

share|improve this answer
Many thanks! I was just too stupid too see it ;-) – Martin May 4 '12 at 12:03

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