I would like to write a macro that expands differently based on the context it is called in. So in normal text it should expand to value1, but if called in a section title or figure caption it should expand to the same text with different formatting.
I am aware that I should use the ifthenelse environment, but I do not know what condition to test for; maybe anyone of you can help.
What I want here is to avoid some special formatting in headings and captions, maybe there is a other way to do that entirely?
So it should look like this:
Code: Select all
\newcommand{\ExpandMe}{
\ifthenelse{-- we are in normal text -- }
{\emph{\textsmaller{ExpandMe}}}
{ExpandMe}
}