5

I'm currently hearing a lecture about formal systems (a computer science lecture).

The lecturer makes a symbol that is written like overlying < and >:

enter image description here

Every time when he draws it, he says "genau dann wenn" (German for "if, and only if").

How do I crate this symbol with LaTeX?

  • 6
    Why not \iff? BTW, I've never seen that symbol before. – Henri Menke Dec 12 '14 at 21:58
  • @HenriMenke I think he wants to make sure that this does not get confused with the symbol used for equivalence in propositional calculus formulas / predicate logic formulas. But I'm not too sure about it. – Martin Thoma Dec 12 '14 at 23:22
  • In my experience \leftrightarrow would be used. – Jessica B Dec 13 '14 at 8:28
  • I always write "if and only if" or "just when", to minimize confusion. Your symbol would confuse me, because I have never seen it before. – Benjamin McKay Mar 27 '15 at 7:08
4

And here is more simple definition than @egregs ooalign:

\def\gdw{\mathrel{{>}\mkern-13mu{<}}}

$A \gdw B$

And it is optical better:

gdm

  • 1
    Guess the width? Sorry, I don' buy it. Try with \usepackage{newtxmath} and you'll get this picture. Is it “optically better”? – egreg Dec 13 '14 at 11:34
  • @egreg If the character is missing in the font then user have to play as font designer and to guess the most optimal look for each font family. This cannot be done by automaton which can do only exactly aligned result, no optical optimal result. – wipet Dec 13 '14 at 12:02
9

A simple application of \ooalign:

\documentclass{article}

% Simple version if you don't need it in sub/superscripts
%\newcommand\gdw{\mathrel{\ooalign{$<$\cr$>$\cr}}}

% Fuller version
\makeatletter
\newcommand{\gdw}{\mathrel{\mathpalette\@gdw@\relax}}
\newcommand{\@gdw@}[2]{\ooalign{$\m@th#1<$\cr$\m@th#1>$\cr}}
\makeatother

\begin{document}
$X \gdw Y_{\gdw}$
\end{document}

enter image description here

See this answer for a quick course on \ooalign. What's the advantage of this complicated looking solution over a seemingly simpler “print >, back up and print <”? That you don't need to guess the width of the symbol, which might change with the font used; with \ooalign you don't run the risk of having to compute the width.

If you want to make the inner rhombus smaller, you can add some pushing:

\documentclass{article}

\makeatletter
\newcommand{\gdw}{\mathrel{\mathpalette\@gdw@\relax}}
\newcommand{\@gdw@}[2]{%
  \ooalign{$\m@th#1\@gdw@push<$\cr$\m@th#1>\@gdw@push$\cr}}
\newcommand{\@gdw@push}{\mkern2mu}% adjust to suit
\makeatother

\begin{document}
$X \gdw Y_{\gdw}$
\end{document}

enter image description here

Another possibility:

\documentclass{article}
\usepackage{mathtools}

\newcommand{\gdw}{%
  \mathrel{\mathrlap{>}}% print > with zero width
  \mathrel{\mkern2mu}% some small spacing
  <% print the <
}

\begin{document}
$X \gdw Y_{\gdw}$
\end{document}

This produces exactly the same output as the last one (with the 2mu to be adjusted to suit). It is simpler in its aspect, because it uses \mathpalette internally. It exploits the fact that TeX inserts no space between consecutive relation atoms.

  • The "2mu correction" is font shape dependent. For example for TX math the center of the character is too dark if 2mu is used. From this point of view: it is probably better to design this value individually for each font shape and to implement only the "back up" value, which avoids the need of \matchoice. – wipet Dec 13 '14 at 12:17
4

This is the unicode U+2AA4 named "GREATER-THAN OVERLAPPING LESS-THAN". Here, you may see, which fonts support this symbol and here, which fonts on your system do provide it.

The MWE requires Lua- or XeLaTeX. It just shows two fonts I found on my PC. Of course, you should define your preferred version in a \mathrel-command.

% arara: lualatex

\documentclass{article} 
\usepackage{fontspec}

\begin{document} 
\fontspec{Asana Math}\symbol{"2AA4}
\fontspec{XITS Math}\symbol{"2AA4}
\end{document}

enter image description here

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.