I need to perform a test on the current font shape. More specifically, I need to detect whether the current font shape is italic or slanted.
Joseph Wright already provided a solution in his answer to Detect which text "mode" (normal, italic, bold, etc.) is currently in use?. For instance, if you define
\newcommand*{\my@test@it}{it}
then
\ifx\f@shape\my@test@it
will be true if the current font shape is italics.
However, as I'm trying to avoid code duplication as much as possible, I'm wondering whether there really is a need to define macros that expands to it
(for italics), sl
(for slanted), etc. I suspect there may already exist such macros, perhaps defined in the LaTeX kernel. Is that the case? If so, what are those macros called?