0

Does any one know how to make a single simple command that gives different outputs for displayed and inline maths

\documentclass{article}

\usepackage{amsmath}

\begin{document}

$A^\prime$

\begin{align*}
\overline{A}
\end{align*}

\end{document}
  • 2
    \newcommand*\simpleA{\mathchoice{\bar{A}}{A'}{(A)}{!A!}} and then \[ \simpleA \frac{\simpleA}{\simpleA}^{\simpleA_{\simpleA}} \]. – Manuel Jan 29 '18 at 11:35
  • 1
    I suggest (as @Manuel indicated) that you learn about \mathchoice. This post and its answers is a good place to start. – Sandy G Jan 29 '18 at 17:32
  • Well this is great, but what I need is something that could detect the displayed environment to change the output. That is, even in a fraction's numerator/denominator, characters should not be treated as inline math unless they are not in a displayed environment. – ένας Jan 30 '18 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.