2

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

6
  • 2
    Don't, there is no reason to do this.
    – daleif
    Commented Nov 4, 2015 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
    Commented Nov 4, 2015 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
    Commented Nov 4, 2015 at 20:50
  • Please see correction above; I misstated my question.
    – jdbrody
    Commented Nov 4, 2015 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
    Commented Nov 4, 2015 at 21:02

1 Answer 1

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.

2
  • 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
    Commented Nov 4, 2015 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
    Commented Nov 4, 2015 at 20:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .