I want to turn a font-changing macro into a "switch" (I found the term in this answer), making macros like \macro{Text to be changed} work within the brakets, like {\switch text to be changed}, similarly to \textbf's and \bfseries's behavior.
I'm working with a thesis class which provides formatting commands like \titleformat, \authornameformat, etc., which can be changed. But in the whole class, those formatting commands are used like switches, so you have a \titlepage command that prints {\titleformat \titledata}, etc. I want to change some of these formatting commands into real small caps, which I defined as \DeclareRobustCommand{\smallcaps}[1]{\textls[10]{\scshape\MakeLowercase{#1}}}, but I don't know how I could make a switch to lowercase letters (i tried it with textcase package's \MakeTextLowercase too).
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[osf]{libertine}
\usepackage{letterspace}
\DeclareRobustCommand{\smallcaps}[1]{\textls[10]{\scshape\MakeLowercase{#1}}}
\begin{document}
\smallcaps{These are real smallcaps}, {\smallcaps these are not} and this is normal.
\end{document}


\textbfis defined with the help of\bfseries: In latex.ltx you will find\DeclareTextFontCommand{\textbf}{\bfseries}. So you will have to be more specific about how your macro is defined if you want to go the other way round. – Ulrike Fischer Feb 10 '12 at 17:06{\smallcaps xyz}to\smallcaps{xyz}, in general. – egreg Feb 10 '12 at 18:30