1

I need to indicate the relation to that the ordering \geq operator refers, because there are several relations R, Q and so on. For display-style math I use the \underset macro to put the relation symbol below the operator. Actually I defined a new macro like this

% Extended >= operator
\newcommand{\extgeq}[1]{\underset{#1}{\geq}}

% Some short-cuts for frequently used relations in my text
\newcommand{\Rgeq}{\extgeq{R}}
\newcommand{\Qgeq}{\extgeq{Q}}
\newcommand{\Sgeq}{\extgeq{S}}

I think it is clear how it works and how it is used.

For display-style math this approach is OK, but I also need to use it in short inline-style math snippets, like Assume $a \Rgeq b$ holds and .... In these cases line-spacing is destroyed because the relation symbol is put below the operator. However I would prefer a subscript to the right of the operator and the same automatic behavior as for sum-style operators. Moreover, the result (operator > plus relation symbol) should still be considered a binary operator and not an ordinary math noun such that the surrounding spacing is correct.

So the questions are:

  • How do I improve the definition of \extgeq such that it differentiates between display and inline math mode
  • How do I ensure that the inline version of the combined symbol is still treated as a binary operator? (\geq_{R} seems to be treated as a noun.)

1 Answer 1

1

A good case for \mathchoice (see What is \mathchoice?)

\documentclass[twocolumn]{article} % twocolumn just to reduce size
\usepackage{amsmath}

\DeclareRobustCommand{\extgeq}[1]{%
  \mathrel{\mathchoice
   {\underset{#1}{\geq}}
   {\geq^{}_{#1}}
   {\geq^{}_{#1}}
   {\geq^{}_{#1}}
}}
\newcommand{\Rgeq}{\extgeq{R}}
\newcommand{\Qgeq}{\extgeq{Q}}
\newcommand{\Sgeq}{\extgeq{S}}

\begin{document}

\[
a\Rgeq b
\]

$a\Rgeq b$

\end{document}

enter image description here

You must log in to answer this question.

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