Before explaining my problem, sorry if this is a repeated question, but I was not been able to find one answered/asked question in which the problem was the same as mine.

In order to create a diagramn I've defined my own function that draws a rectangle centered in a point defined previously, rotated by an angle also passed as an argument. The code:





    \path (#1); \pgfgetlastxy{\XCoord}{\YCoord};

\newcommand{\myrec}[5]{% #1: center, #2: horizontal edge, #3: vertical edge, #4 angle of rotation, #5: edge color
    \node (a) at (\XCoord,\YCoord) {};
    \draw [solid,rotate=#4,draw=#5] let \p1=(a) in ($ (\x1,\y1) + 0.5*(-#2,#3) $) rectangle ($ (\x1,\y1) + 0.5*(#2,-#3) $);

        \node (Point) at (2,3) {Point};

Now, I tried to improve this function adding the possibility of choosing the color of the edge. However, although I did it in a way that works for most of the people I obtain the error: Package xcolor Error: Undefined color ';'. Any idea about how to pass the color as an argument properly?


I don't understand yet why, but rebooting the computer solved the problem.

closed as off-topic by Joseph Wright Mar 23 '16 at 11:48

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Your code compiles fine for me. Am I missing something? – wrtlprnft Mar 23 '16 at 11:17
  • 1
    It works for me as well. A couple of notes: you can write \draw[solid,rotate=#4,#5] and it will work as well. Also, solid here is not doing anything and you can safely remove it. Solid is used when you need to switch from dashed or dotted, for example. If you draw a line and it's dotted/dashed and you want to put a node on the path (with automatic drawing), then you'll use solid if you want the node to be solid because otherwise it inherits the path style. But in this case it's not doing anything. – Alenanno Mar 23 '16 at 11:25
  • Thanks for your answers and your note @Alenanno ! I don't understand yet what was going on, but rebooting my computer solved it (.-.) – Hector248 Mar 23 '16 at 11:29
  • 1
    I'm voting to close this question as off-topic because it was solved in some way by rebooting. – Joseph Wright Mar 23 '16 at 11:48