2

I have seen people put small question marks over greater than symbols in proofs, however, I'm having trouble doing it over "≥" symbols. Using \stackrel{?}{≥} returns an error:

 Command \> already defined.
               Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...
l.175 \newcommand{\>}{\stackrel{?}{?}}
?

And using \overset{?}{≥} gives the wrong symbol:

enter image description here

How would we type "≥" in latex without returning a question mark?

  • 3
    (1) Welcome, (2) please post a minimal example, just not an image of an error. You are being told you cannot define \<, so find another name for it. In general it is not a good idea to use so short macro names for your own personal macros. – daleif Oct 14 '16 at 14:21
  • 5
    Try \newcommand\maybegeq{\stackrel{?}{\geq}}. With the amsmath package, \overset{?}{\geq} works as well. I don't think that you can use the greater-equal unicode character directly. – gernot Oct 14 '16 at 14:52
  • @gernot I suggest you make that an answer – Andrew Swann Nov 4 '16 at 21:12
6

Use \geq instead of and define the command as

\newcommand\maybegeq{\stackrel{?}{\geq}}

or as

\usepackage{amsmath}
\newcommand\maybegeq{\overset{?}{\geq}}

Example:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$x \stackrel{?}{\geq} y$

$x \overset{?}{\geq} y$
\end{document}

enter image description here

\stackrel and \overset differ in the way they are spaced. \stackrel{a}{b} is a relation no matter what b was (as rel in the macro name suggests), whereas \overset{a}{b} will be treated in the same way as b without \overset. If you want \overset{a}{b} to become a relation, you have to say so explicitly using \mathrel{\overset{a}{b}} or \overset{a}{\mathrel{b}}.

enter image description here

  • I believe \overset is preferred to \stackrel (due to better spacing or something). – erik Nov 4 '16 at 23:00
  • @erik It depends on what your aim is. I have added an explanation. Thanks for your comment. – gernot Nov 5 '16 at 11:45
1

Doing \newcommand{\>}{\stackrel{?}{≥}} obviously produces an error, because \> is an already defined command.

You could do

\renewcommand{\>}{\stackrel{?}{≥}}

but it wouldn't help much, because an input like

$a \> b$

would not print what you'd like to. Even if you load

\usepackage[utf8]{inputenc}

(assuming you're saving your file in UTF-8 encoding) wouldn't be sufficient.

You can use as a shorthand for \geq, by defining an action for the Unicode character (and as well).

\documentclass{article}

\usepackage[utf8]{inputenc}

\usepackage{amsmath}
\usepackage{newunicodechar}

\newunicodechar{≤}{\leq}
\newunicodechar{≥}{\geq}

\begin{document}

\begin{tabular}{cc}
\verb|\stackrel|    & \verb|\overset| \\
$a\stackrel{?}{≤}b$ & $a\overset{?}{≤}b$ \\
$a\stackrel{?}{≥}b$ & $a\overset{?}{≥}b$
\end{tabular}

\end{document}

I'd prefer \overset to \stackrel, because it's more general.

About redefining \> for this purpose, I wouldn't do it. You can rather do

\newcommand{\?}[1]{\overset{?}{#1}}

and input

$a \?{>} b$
$a \?{≥} b$
$a \?{<} b$
$a \?{≤} b$

which is, in my opinion, clearer.

enter image description here

  • Is \newcommand{\?}{\overset{?}} in any way preferable? – gernot Nov 5 '16 at 11:33
  • @gernot It is essentially equivalent, but less clear. You save a few nanoseconds every time \? is expanded. – egreg Nov 5 '16 at 11:38

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.