[Tex/LaTex] How to typeset the concatenation of strings properly


I am looking for a good way to typeset the concatenation of two strings. This is standard notation in descriptive set theory to join an m-tuple x to an n-tuple y to get an (m+n)-tuple x^y, that is, a small slightly raised circumflex or frown joining the upper parts of the characters together. I currently use the straightforward

x^\smallfrown y

which doesn't look terribly good.

Semantically, this is a binary operation, but it shouldn't have the usual spacing on the right and the left and it should be higher up than a minus sign, say.

Here's a sample screen shot from Moschovakis's Descriptive set theory (p.76 of the pdf) which is approximately what I'd like to do, but I'd prefer a frown:

Sample screen shot from Moschovakis

Looking around on this site, I found the question String/vector concatenation symbol but it is concerned with which symbol to use for the operation, so it doesn't address my question.

Best Answer

Define a binary math command (\mathbin) that is typeset according to your specifications:

enter image description here

\usepackage{graphicx}% http://ctan.org/pkg/graphicx
$x\concatA y\ x\concatB y$

\concatA could be what you're after, although I've also added \concatB to show you another possibility. There may be more, so if you're interested, see How to look up a symbol?.

You can fiddle around with the \frown raise (1ex) as well as the size (scaled to .7 of its original size thanks to graphicx).

It sounds logical to me to have the spacing set as \mathbin since it represents an operator acting on two entities (operands). However, you can use \mathord to remove the binary-operator-ness. Perhaps even specifying your own spacing around the symbol with additional \mkerns if needed.