1

I'd like to define \a to be the $\forall$ symbol, but I'd like it be the regular $\forall$ in text-mode and \mathsmaller{\forall} in math mode. Is there any easy way to do this? I'm guessing it should be easy with some TeX programming but I've never done that!

CORRECTION: I misstated what I want to do; long day and my brain is tired. What I really want to do is have $\forall$ display smaller when it's a subscript. So I want to write sentences like "Let $(\K_\fa, \leq_\fa)$ be the $\fa$-closure of ..." and have the first \fa display in regular size but the second display using \mathsmaller

  • 2
    Don't, there is no reason to do this. – daleif Nov 4 '15 at 19:26
  • Note that using single-character macros like \a conflicts with other macros in some cases. I'd suggest using something more descriptive, even if its using \fa. – Werner Nov 4 '15 at 19:34
  • Don't redefine \a. You'll regret it, sooner or later. What's a reason for this strange requirement? The “for all” symbol should never appear in text mode. – egreg Nov 4 '15 at 20:50
  • Please see correction above; I misstated my question. – jdbrody Nov 4 '15 at 20:55
  • I'm sorry, but if I do \newcommand{\fa}{\forall} and type Let $(\K_\fa, \leq_\fa)$ be the $\fa$-closure, the result is as expected: the “for all” in subscripts is smaller than the one in $\fa$-closure. – egreg Nov 4 '15 at 21:02
2

You can use \ifmmode to check for math mode:

\documentclass{article}

\usepackage{relsize}

\protected\def\a{%
  \ifmmode%
    \mathsmaller{\forall}
  \else%
    $\forall$
  \fi}

\begin{document}
  in text: \a and in math: $\a$
\end{document}

See \ifmmode doesn't seem to work correctly inside an array environment for the reason why to put \protected.

  • Thanks for this! It looks like the right answer to the question I asked but not the question I meant to ask. Not sure what the protocol is for accepting answers in that context? – jdbrody Nov 4 '15 at 20:55
  • @user3054726: Follow-up questions like this are more than welcome! Please use the "Ask Question" link for your new question; there you can link to this question to provide the background. – Werner Nov 4 '15 at 20:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.