To define string concatenation, I use the || symbol to concatenate two strings, like S1||S2. Now I need to show the concatenation of more than two. Is there any known symbol to define the concatenation of more than two strings, like the sum in \sum_{i=1}^N S_i, but with something different from \sum?
Asked
Active
Viewed 1,142 times
1
Bernard
- 271,350
-
2Welcome to TeX.SE! I think your question is off topic here. Better ask on a mathematican forum... – Mensch Apr 28 '22 at 11:29
-
1I think the question is on topic. It is asked for how to produce a big operator from two vertical bars, as I understand it. Maybe this question (or its answers) could be helpful. – mickep Apr 28 '22 at 11:44
-
1Does this answer your question? How do I type a vector concatenation symbol like this one? – Vincent Apr 28 '22 at 13:49
1 Answers
3
This can be done using \DeclareMathOperator* and the scalerel package:
In the code below, \scalerel* scales the \Vert symbol (double vertical lines) to match the size of a \sum symbol, whether inline or displayed or in a subscript. \DeclareMathOperator gives the symbol the same behavior as a large operator like \sum. The starred version \DeclareMathOperator* places the limits above and below when displayed, but on the right when inline.
\documentclass{article}
\usepackage{amsmath,scalerel}
\DeclareMathOperator{\concat}{\scalerel{\Vert}{\sum}}
\begin{document}
Inline: $\concat_{n=1}^{\infty} S_n$. Display: $\displaystyle{\concat_{n=1}^{\infty} S_n}$
\end{document}
Sandy G
- 42,558
-
Perhaps you could consider adding
For 2 arguments: ${S_1}\concat{S_2}$.to illustrate the nice spacing of this approach even as an operator between 2 arguments (like+) – jessexknight Apr 28 '22 at 12:54 -
I was also tinkering with
\&as the operator, instead of\Vert, but the scaling gets wonky. Some people may find this hack useful: replace\Vertwith\vphantom{\textstyle\sum}\smash{\&}to get better scaling with that approach. – jessexknight Apr 28 '22 at 12:56 -
@Sandy G Thanks, this is exactly what I tried as the first thought. I was principally interested if such an operator exists and is commonly used (somehow, I do not know myself). Anyway, many thanks! Sorry, as a new member, I cannot upvote. ):- – Stanislav Koncebovski Apr 28 '22 at 13:09
