1

I am trying to find out a way to type this symbol illustrated below by latex, which means vector concatenation. enter image description here

Does anyone know it? Thanks a lot!

3

3 Answers 3

3

I don't know if there is a dedicated command for such an operator, but you could simply use a big \Vert symbol.

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator*{\concat}{%
    \mathchoice%
        {\Big\Vert}%
        {\big\Vert}%
        {\Vert}%
        {\Vert}%
}
\begin{document}
\begin{align*}
& \vec{h}_i' = \concat_{k=1}^K \sigma\Biggl( \sum_{j\in\mathcal{N}_i} \alpha_{ij}^k \mathbf{W}^k \vec{h}_j \Biggr) \\
& \textstyle \vec{h}_i' = \concat_{k=1}^K \sigma\Bigl( \sum_{j\in\mathcal{N}_i} \alpha_{ij}^k \mathbf{W}^k \vec{h}_j \Bigr) \\
& \scriptstyle \vec{h}_i' = \concat_{k=1}^K \sigma\bigl( \sum_{j\in\mathcal{N}_i} \alpha_{ij}^k \mathbf{W}^k \vec{h}_j \bigr) \\
& \scriptscriptstyle \vec{h}_i' = \concat_{k=1}^K \sigma( \sum_{j\in\mathcal{N}_i} \alpha_{ij}^k \mathbf{W}^k \vec{h}_j )
\end{align*}
\end{document}
2
  • 3
    I would suggest something like \DeclareMathOperator*{\veccat}{\mathchoice{\Big\Vert}{\big\Vert}{\Vert}{\Vert}}. Using \Big\Vert is good in displaystyle, but for in-line text that would be too big. (For in-line \big seems to be a good size, using \sum as a comparison.) Commented Mar 7, 2022 at 14:01
  • @WillieWong Good point, thanks! I added \mathchoice in the example.
    – Vincent
    Commented Mar 7, 2022 at 14:09
2

To make the new operator the same size as a sum, I suggest scalerel.

enter image description here

\documentclass{article}

\usepackage{amsmath,scalerel}

\DeclareMathOperator*{\concat}{\scalerel*{\Vert}{\sum}}

\begin{document}

Display:
\[
\vec{h}_i' = \concat_{k=1}^K \sigma\left( \sum_{j\in\mathcal{N}_i} \alpha_{ij}^k \mathbf{W}^k \vec{h}_j \right)
\]

Inline: $\vec{h}_i' = \concat_{k=1}^K \sigma\left( \sum_{j\in\mathcal{N}_i} \alpha_{ij}^k \mathbf{W}^k \vec{h}_j \right)$.

\end{document}

Also, you might consider replacing \left( and \right) with \Biggl( and \Biggl) in display mode, which will make the parentheses slightly smaller than they are in your screenshot. Similarly, I suggest \bigl( and \bigl) for inline mode.

2

This will make the symbol with the same vertical dimension as \sum.

\documentclass{article}
\usepackage{amsmath,graphicx}

% if you use also lmodern, add
% \usepackage{fixcmex}

\makeatletter
\newcommand{\concat@}{\mathop{\vphantom{\sum}\mathpalette\concat@@\relax}}
\newcommand{\concat@@}[2]{%
  \vcenter{\hbox{%
    \sbox\z@{$#1\sum$}%
    \resizebox{\width}{\dimexpr\ht\z@+\dp\z@\relax}{\raisebox{\depth}{$\m@th#1\Vert$}}%
  }}%
}
\newcommand{\concat}{\DOTSB\concat@\slimits@}
\makeatother

\begin{document}

\[
\sum_{k=1}^K h=\concat_{k=1}^K x
\quad
\textstyle \sum h=\concat_{k=1}^K x
\]

\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 .