The basic idea is from How can I create new commands in TikZ?

\usepackage[a4paper,top=1in, bottom=1in, left=1in, right=1in]{geometry}

\def\centerarct[#1](#2)(#3:#4:#5)% Syntax: [draw options] (center) (start angle:end angle:radius)
{ \path[#1] ($(#2)+({#5*cos(-#3+90)},{#5*sin(-#3+90)})$) arc [start angle={-#3+90}, end angle={-#4+90}, radius=#5)]; }

    myvector/.is family,
    line width/.initial =5mm,
    text align/.initial=center,


  line width/.get=\mbflinewidth,
  text align/.get=\mbftextalign,
 \centerarct[{Triangle[width=9mm,length=5mm]}-,draw=\mbfcolor,line  width=\mbflinewidth,postaction={decorate,decoration={text along path,text align=\mbftextalign,text=\mbftext,raise=\mbfraise}}](#2)(180:1:\mbfradius);

  \myvector[text align=right,raise=-1.25mm](0,0);

It works. But unfortunately if I use

\myvector[text align={right,right indent=1cm},raise=-1.25mm](0,0);

the result is

! Package pgfkeys Error: I do not know the key '/pgf/decoration/text align/righ t,right indent=1cm' and I am going to ignore it. Perhaps you misspelled it.

I read about key handlers but I didn't found a way out.

  • Have you tried \myvector[{text align={right,right indent=1cm}},raise=-1.25mm](0,0);?
    – cfr
    Commented Jul 4, 2017 at 12:16
  • I tried it just now. No change.
    – fatts
    Commented Jul 4, 2017 at 12:18
  • I guess text align=\mbftextalign will treat \mbftextalign as a key instead of list of keys. I think it is better to use /.style to store list of keys.
    – Symbol 1
    Commented Jul 4, 2017 at 12:33
  • Why do you need to even create all of those keys? Most of them are just standard keys anyway, including text align, aren't they?
    – cfr
    Commented Jul 4, 2017 at 12:58
  • For the mwe I changed the code to make it more easy. But in the end I want to use also own keys. The main goal is a command \myvector[options] (xcoord,ycoord); and options is key1=value1,key2=value2, ...; keys are standard, some are own and needed to calculate some thing for plotting the vector
    – fatts
    Commented Jul 4, 2017 at 13:04

1 Answer 1


This is the case where the .expand once handler is useful. In the myvector macro definition you have somewhere:

text align=\mbftextalign

What you want is to set text align to the expansion of the \mbftextalign macro. You can do this easily with:

text align/.expand once=\mbftextalign

Of course, you should do the same modification with the other keys where expansion is needed.

  • This solves it!
    – berkus
    Commented Jul 4, 2017 at 17:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .