8

In his 1989's Theorem for free! (doi: 10.1145/99370.99404, preprint in .dvi) paper, Wadler typeset the concatenation operation with two "plus" signs collapsed: enter image description here

I asked write-math.com and Detexify to name this operator without success, and could not find anything apart from a not-so-elegant solution proposed by a blog, which consists in defining

\newcommand{\concat}{\ensuremath{+\!\!\!\!+\,}}

Is this operator defined in a package I'm not aware of, this notation not used at all?

5
  • 1
    “Not-so-elegant” is a very big understatement: it's a completely wrong definition under all respects. ;-)
    – egreg
    Commented Oct 13, 2015 at 14:32
  • 1
    If it should be used with \mathbin, why didn't use that in your \concat command?
    – user31729
    Commented Oct 13, 2015 at 15:20
  • 1
    I added an alternative version, making a symbol that has the same dimensions as the plus sign.
    – egreg
    Commented Oct 13, 2015 at 15:23
  • 1
    I've now added it to the text-search: concatenation symbol (P.S.: Please call my service "write-math.com") Commented Oct 14, 2015 at 9:30
  • 1
    @moose : thank you for including this symbol, and for your post-scriptum. I edited my first post.
    – Clément
    Commented Oct 14, 2015 at 13:14

3 Answers 3

6

I see nothing bad in the idea of partially superposing two plus signs. I've never seen such notation before, but it's not difficult to do it right, which is not the case with the macro you found out.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\concat}{%
  \mathbin{{+}\mspace{-8mu}{+}}%
}

\newcommand{\starop}[1]{\mathop{#1^*}}

\begin{document}

\begin{gather*}
({\concat}): \forall X.\ X^* \to X^* \to X^* \\
\starop{a}(xs\concat_{A} ys)=(\starop{a} xs)\concat_{A'}(\starop{a} ys)
\end{gather*}

\end{document}

enter image description here

Compare with the original:

enter image description here

They seem to differ only for better spacing in my output. ;-) Maybe the distance between the vertical bars is slightly different, adjust it to suit.

And yes, the original uses two plus signs, judging from the DVI file that I transformed into PDF.

Alternative version

You might prefer a different symbol, as high and wide as the standard plus sign.

The use of color is to show precisely that the two symbols have the same width (red or black never overspills). Again, adjust the distance between the vertical bars to suit.

\documentclass{article}
\usepackage{amsmath,pict2e,color}

\makeatletter
\newcommand{\concat}{\mathbin{\mathpalette\conc@t\relax}}
\newcommand{\conc@t}[2]{%
  \vcenter{\hbox{%
    \sbox\z@{$\m@th#1-$}%
    \setlength{\unitlength}{\wd\z@}%
    \begin{picture}(1,1)
    \roundcap
    \put(0.1,0.5){\line(1,0){0.8}}
    \put(0.35,0.1){\line(0,1){0.8}}
    \put(0.65,0.1){\line(0,1){0.8}}
    \end{picture}%
  }}%
}
\makeatother

\newcommand{\starop}[1]{\mathop{#1^*}}

\begin{document}

\begin{gather*}
\rlap{\color{red}$+$}{\concat}{\concat}\llap{\color{red}$+$}\\
\rlap{\color{red}$\concat$}{+}{+}\llap{\color{red}$\concat$}\\
{+}{\concat}\quad a_{\concat_{\concat}}\\
{+}\\
{\concat}\\
({\concat}): \forall X.\ X^* \to X^* \to X^* \\
\starop{a}(xs\concat_{A} ys)=(\starop{a} xs)\concat_{A'}(\starop{a} ys)
\end{gather*}

\end{document}

enter image description here

4
  • 2
    is this the symbol that is listed as "double plus" in unicode (U+29FA)? if so, it should be in the stix / xits fonts, probably with the name \doubleplus. (there's also a triple plus at U_29FB; i have no idea what it might mean, but the shape may have some bearing on the appearance of the double.) Commented Oct 13, 2015 at 15:28
  • 1
    @barbarabeeton Importing it from STIX has the disadvantage that its shape would not agree with the CM plus.
    – egreg
    Commented Oct 13, 2015 at 15:41
  • 1
    true about the shape. what was really in my mind was the naming convention, and i didn't phrase that properly. (i really hope that someday there will be a unique name for every symbol, perhaps with reasonable, non-duplicated synonyms that convey appropriate meaning for particular topical areas.) Commented Oct 13, 2015 at 17:48
  • 2
    @barbarabeeton I think that symbols should have an “abstract” name, but that users should rename them to give more semantics to them: for instance, I like to have \newcommand\tens{\otimes}; the same symbol is used in other fields to denote something else and, in that case, another name should be used. On the other hand, \sum and \int are somewhat “universal”; maybe the latter can be renamed \Fend or \Fcoend in the context of Kan extension in category theory.
    – egreg
    Commented Oct 13, 2015 at 17:55
3

Try +\kern -0.4em+ for example, the value of -0.4em provides some nice look, but this can be changed of course.

\documentclass[a4paper,10pt]{article}    
\usepackage{amsmath}

\DeclareMathOperator{\dplus}{+\kern -0.4em+}

\begin{document}
$ z_a \dplus z_b $
\end{document}

enter image description here

2
  • 1
    An operator? I don't think so.
    – egreg
    Commented Oct 13, 2015 at 14:30
  • I'm the one responsible: I name it an operator in my initial post. But I definitely think this sould be declared with a mathbin statement.
    – Clément
    Commented Oct 13, 2015 at 14:38
2

I think it's important that a binary symbol aligns correctly with another binary symbols. An obvious workaround is with \scalebox and brethren but I leave those for another answer if someone wants to show it. Here's a version that (surprinsingly) works.

I copied the code from egreg :)

\documentclass{scrartcl}

\usepackage{mathtools,calc}

\makeatletter
\newcommand*\concat
  {\mathbin{\mathmakebox[\widthof{${+}\m@th$}]{+\hskip-1emplus1fil+}}}
\newcommand*\starop[1]{\mathop{#1^*}}
\makeatother

\begin{document}

\begin{gather*}
({\concat})\colon \forall X.\ X^* \to X^* \to X^* \\
\starop{a}(xs\concat_{A} ys)=(\starop{a} xs)\concat_{A'}(\starop{a} ys)
\end{gather*}

\begin{align*}
  a + b + c + d \\
  a \concat b \concat c \concat d
\end{align*}

\end{document}

enter image description here

You must log in to answer this question.

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