I'm trying to write a macro that returns different things depending on it if is used in a displayed equation or if it is used in an inline equation. Something like this, I assume:
\newcommand{\foo}{%
\ifdisplaystyle
This equation is displayed!
\else
This equation is inline!
\fi}
I assume there's a way to do this, as $\sum$ and $$\sum$$ look different. How is it done?

\mathchoice? – Werner Sep 11 '18 at 18:24I think my question has the advantage of being asked in a way that someone might be able to find it without knowing the solution (figure out how
– Pi Fisher Sep 11 '18 at 19:28\mathchoiceworks and then use it).