# Symbols for Outer Joins

I'm looking for a way to typeset the symbols for outer joins, that is ⟕ U+27D5 onward.

There seems to be nothing in symbols-a4. Note that I'm not looking for ⋊ U+22C9 as this represents a semijoin.

This post presents a custom eps (for only one of the three symbols) and a anonymous comment suggests using an ifsym timing diagram (I'm awed by the lateral thinking but the result looks ugly).

-

\documentclass[a4paper]{article}
\usepackage{amssymb}

\def\ojoin{\setbox0=\hbox{$\bowtie$}%
\rule[-.02ex]{.25em}{.4pt}\llap{\rule[\ht0]{.25em}{.4pt}}}
\def\leftouterjoin{\mathbin{\ojoin\mkern-5.8mu\bowtie}}
\def\rightouterjoin{\mathbin{\bowtie\mkern-5.8mu\ojoin}}
\def\fullouterjoin{\mathbin{\ojoin\mkern-5.8mu\bowtie\mkern-5.8mu\ojoin}}

\begin{document}
$A\leftouterjoin B$
$A\rightouterjoin B$
$A\fullouterjoin B$
\end{document}


-

With unicode-math and XeLaTeX or LuaLaTeX, you can use these symbols directly:

% compile with xelatex or lualatex
\documentclass{article}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmathfont{XITS Math}

\begin{document}
$A ⟖ B$
\end{document}


They also have aliases: \leftouterjoin, \rightouterjoin, \fullouterjoin

-
Wow! This is as it should be. One more reason to switch away from pdfTeX. – ian Jun 15 '11 at 18:18

egreg's answer modified to use \Join instead of \bowtie. Had to modify values in a code I don't quite understand so correct me if I made a mistake. It looks good on my machine though.

\def\ojoin{\setbox0=\hbox{$\Join$}%
\rule[-.02ex]{.25em}{.4pt}\llap{\rule[1.10ex]{.25em}{.4pt}}}
\def\leftouterjoin{\mathbin{\ojoin\mkern-8.5mu\Join}}
\def\rightouterjoin{\mathbin{\Join\mkern-8.5mu\ojoin}}
\def\fullouterjoin{\mathbin{\ojoin\mkern-8.5mu\Join\mkern-8.5mu\ojoin}}

-

Better version, which uses \Join symbol which looks like real DB join symbol than \bowtie!

\def\ojoin{\setbox0=\hbox{$\Join$}%
\rule[0.1ex]{.27em}{.4pt}\llap{\rule[1.3ex]{.27em}{.4pt}}}
\def\leftouterjoin{\mathbin{\ojoin\mkern-5.8mu\Join}}
\def\rightouterjoin{\mathbin{\Join\mkern-5.8mu\ojoin}}
\def\fullouterjoin{\mathbin{\ojoin\mkern-5.8mu\Join\mkern-5.8mu\ojoin}}

-
The horizontal lines and the \Join symbol aren't properly attached if I compile your code. Could you turn your snippet into a full minimal document and include a screenshot of the output (like egreg and Caramdir did)? – Jake Jul 9 '12 at 5:23
I think it depends on individual LaTeX compiler and language/font packages installed. Because for me iKs's code did not work, and so I just tweaked \rule[0.1ex] and \rule[1.3ex] until it showed correctly in my compiled output. So you may want to try that at your end. – Medha A Jul 9 '12 at 6:57
iKs' and egreg's solution both work fine using pdflatex without any special font packages, so it seems like you're doing something non-standard that breaks iKs' code on your setup. Would you mind posting a complete minimal example document? – Jake Jul 9 '12 at 7:04
Ummm. I will see if I can, but yes, I surely am using a special stylefile required for my document, and I am unsure if that stylefile has some special commands or TeX \defs which might be interfering. (And right now I don't have a lot of bandwidth to dig deeper into that, I just needed this to be working)!! Oh, and I am using pdflatex too! – Medha A Jul 9 '12 at 7:07