9

As the title says my question is: "Why do authors keep defining their own \gtrsim and \lesssim commands?"

It happens continuously. Here are the last cases I encountered:

\newcommand{\gsim}{\raisebox{-0.13cm}{~\shortstack{$>$ \\[-0.07cm]
      $\sim$}}~}
\newcommand{\lsim}{\raisebox{-0.13cm}{~\shortstack{$<$ \\[-0.07cm]
      $\sim$}}~}

and

\def\gsim{\stacksymbols{>}{\sim}{2.5}{.2}}
\def\lsim{\stacksymbols{<}{\sim}{2.5}{.2}}

Edit. Here's another "fresh" one (I'm really tempted to collect all of them...):

\newcommand{\lsim}{{\;\raise0.3ex\hbox{$<$\kern-0.75em\raise-1.1ex\hbox{$\sim$}}\;}}
\newcommand{\gsim}{{\;\raise0.3ex\hbox{$>$\kern-0.75em\raise-1.1ex\hbox{$\sim$}}\;}}

And, of course, the remedy is:

\newcommand{\gsim}{\gtrsim}

as egreg suggested.

4
  • 2
    Because they don't know where to find the precomposed symbol? Another cause: \shortstack is a rarely used LaTeX command, but existing from day one. It predates amssymb and inertia wins.
    – egreg
    Aug 9, 2017 at 21:06
  • Probably because they don't know it is already defines in amssymb.
    – Bernard
    Aug 9, 2017 at 21:07
  • @egreg I think you're right. It must be inertia in most cases. But I suspect that the \gtrsim and \lesssim layout could be unsatisfactory for some authors. Aug 9, 2017 at 21:14
  • Some journals like e.g. Science do not allow you to use external packages in your latex document, basically forcing you to define any symbols you need from e.g. amssymb yourself.
    – Thriveth
    Feb 19, 2019 at 2:07

1 Answer 1

9

The main reason, I believe, is inertia. The author learned how to produce \gsim in that (hilarious) way thirty or more years ago or borrowed it from some template whose origin dates from the early times of LaTeX. The amssymb package is in its current form essentially since 1994, but the symbols had already been available for several years, even for plain TeX (or AMS-TeX).

The macro \shortstack was conceived for picture mode, but is not really useful for any real application, as far as I can tell.

A definition like the one you show is wrong under many respects:

  1. the spacing is not the same as for relation symbols;
  2. it doesn't change size in subscripts/superscripts;
  3. the -0.07cm vertical adjustment is computed “by eye” and doesn't scale with the main font size.

Here's a visual comparison:

\documentclass{article}

\usepackage{amssymb}

\newcommand{\gsim}{\raisebox{-0.13cm}{~\shortstack{$>$ \\[-0.07cm]
      $\sim$}}~}

\begin{document}

$a\gtrsim b_{\gtrsim}$

$a\gsim b_{\gsim}$

\end{document}

enter image description here

The output of \gsim (second line) seems not so bad, but the spacing is odd and the subscript is clearly wrong.

A slightly better result can be obtained with some more work:

\documentclass{article}

\usepackage{amssymb}

\makeatletter
\newcommand{\undersim}[1]{\mathrel{\mathpalette\@undersim{#1}}}
\newcommand{\@undersim}[2]{%
  \vcenter{%
    \ialign{%
      ##\cr
      $\m@th#1#2$\cr
      \noalign{\nointerlineskip\kern.2ex}
      $\m@th#1\sim$\cr
      \noalign{\kern-.4ex}
    }%
  }%
}
\newcommand{\gsim}{\undersim{>}}
\newcommand{\lsim}{\undersim{<}}
\makeatother

\begin{document}

$a\gtrsim b_{\gtrsim}$

$a\gsim b_{\gsim}$

\end{document}

enter image description here

However, such tricks should only be used for symbols that are not available as already precomposed ones (or if in tight situations with too many math fonts).

In your case, don't be afraid to remove the silly definitions and change them into

\newcommand{\gsim}{\gtrsim}
\newcommand{\lsim}{\lesssim}

along with \usepackage{amssymb}.

You must log in to answer this question.

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