Goal: create a command that works within a group (a scope)
I am using polyglossia package to write bilingual texts. I want to create \eng declaration or switch to behave just like \textenglish:
{\eng this is an english text} this is a foreign text
This should be equivalent to:
\textenglish{this is an english text} this is a foreign text

\mycmdsupposed to do? – campa Mar 02 '21 at 12:35\mycmdis just any command that effect what is inside the group. – AvidSeeker Mar 02 '21 at 12:43\color,\bfseries, ortinydon't take arguments (they are declarations or "switches", if you will). If your\mycmdalso doesn't take an argument, they you are good to go without anything special. If\mycmdtakes an argument, then it is not "just like" those other macros. – Steven B. Segletes Mar 02 '21 at 12:43\mycmdwants to do. If you give an example... – Rmano Mar 02 '21 at 12:52\color,\bfseriesetc have no access to the text that is in the current group, they just change the state and that state ends when the group ends. – David Carlisle Mar 02 '21 at 12:53\newcommand\mycmd{\bfseries\itshape\color{red}}and then do{\mycmd abc is some text}, does what you want. If whatever you want to achieve is achievable just by changing some states (like the colour stack, the font in use, some sizes, etc.) you can do this just by changing the definition. If your macro needs access to the contents of the group, then just as others have already said, that's impossible. – Skillmon Mar 02 '21 at 13:33