# What is a simple way to create a binary relation symbol on top of another?

What is a simple way to have \ll on top of \gg with equal size and vertically center aligned and have them work as a binary relation symbol like \lessgtr? The commands \underset and \overset cannot be used because they do not treat the two symbols equally, and they do not vertically center.

-

You can try substack

\documentclass{article}

\usepackage{amsmath, amssymb}
\begin{document}

\newcommand{\ggll}{\mathrel{\substack{\ll\\[-.05em]\gg}}}

$x\ggll x$

$x\substack{\ll\\\gg}x$

\end{document}


I added amsmath for \lessgtr but it also needed for substack. You may read more about this command in the amsmath documentation or in the mathmode paper. As @tohecz pointed out, one may need some spacing correction by mathrel. Furthermore i added a vertical correction with the optional argument of \\. This makes the symbol a little bit more like belonging together (and might be a thing of personal taste too).

-
You might want to add \mathrel{\substack{...}} for the proper spacing. –  yo' Jan 4 '13 at 11:02
Thank you, bloodworks and tohecz. –  sawa Jan 4 '13 at 11:03
@tohecz indeed i want;) –  bloodworks Jan 4 '13 at 11:11
Just wanted to add that I used this solution to create a nice inline i.i.d. distributed symbol. I haven't found a question about it, so I thought I'd add it for future seekers.. –  Kiwile Dec 15 '13 at 16:30

I doubt that you really want such an ugly symbol, but here are two proposals:

\documentclass{article}
\usepackage{amssymb}
\newcommand{\llgg}{\mathrel{\mathpalette\llggi\relax}}
\newcommand{\llggi}[2]{\vcenter{\offinterlineskip\hbox{$#1\ll$}\hbox{$#1\gg$}}}

\newcommand{\sllgg}{\mathrel{\mathpalette\sllggi\relax}}
\newcommand{\sllggi}[2]{\vcenter{\offinterlineskip\hbox{$\mkern2mu#1\ll$}\hbox{$#1\gg\mkern2mu$}}}

\begin{document}
$a\llgg b \lessgtr c_{\llgg}$

$a\sllgg b \lessgtr c_{\sllgg}$
\end{document}


One might add some vertical space in the first version, but I'd prefer the second one, in which I add instead a little horizontal shift.

-

I would suggest putting two \lessgtr in a roll, with a good space inbetween so that the lines join each other nicely:

\documentclass{article}

\usepackage{amsmath, amssymb}
\newcommand\llgg{\lessgtr\mkern-5.7mu\lessgtr}

\begin{document}
$a\llgg b$

$f_{a\llgg b}$

$g_{h_{a\llgg b}}$
\end{document}

-

I use stackrel or stackbin commands.

\documentclass{article}

\usepackage{amsmath, amssymb,stackrel}

\begin{document}

$$A\stackbin[\text{and}]{}{+} B \stackrel[x]{!}{=} C$$

$$A\stackbin{\ll}{\gg} B$$

\end{document}


You can find useful the following post

Cheers.

-
Have you tried to compile the code? It doesn't really look like one complicated relational symbol. The upper part is smaller. –  yo' Jan 4 '13 at 12:10