# newcommand with node confusion [closed]

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}};
}

\begin{tikzpicture}
\mydoor[mytext];
\end{tikzpicture}


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)?

-

## closed as too localized by egreg, percusse, Marco Daniel, Torbjørn T., Martin SchröderAug 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.

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:

\documentclass{article}
\usepackage{tikz}

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

\begin{document}
\begin{tikzpicture}
\mydoor{mytext}
\end{tikzpicture}
\end{document}


which gives:

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