# How to apply \limits to \parallel? [duplicate]

LaTeX complains Limit controls must follow a math operator. \textbf{G} := \parallel\limits about the following snippet.

\documentclass{article}

\usepackage{mathtools}
\begin{document}
$$\textbf{G} := \parallel\limits_{\pi \in \mathcal{P}} \textbf{G}^{\pi}$$
\end{document}


What is a possible workaround to apply \limits to \parallel?

## marked as duplicate by TeXnician, Troy, Sebastiano, Kurt, Stefan PinnowDec 16 '18 at 16:41

Maybe you want a symbol similar to \sum:

\documentclass{article}

\usepackage{mathtools,graphicx}

\makeatletter
\newcommand{\parop}{\DOTSB\parop@\slimits@}
\newcommand{\parop@}{\mathop{\vphantom{\sum}\mathpalette\delimiter@to@op\Vert}}
\newcommand{\delimiter@to@op}[2]{%
\begingroup
\sbox\z@{$#1\sum$}%
\vcenter{\hbox{\resizebox{!}{\ht\z@}{$\m@th#2$}}}%
\endgroup
}
\makeatother

\begin{document}

$$\textbf{G} \coloneqq \parop_{\pi \in \mathcal{P}} \textbf{G}^{\pi}$$

$$\sum_{\pi \in \mathcal{P}} \parop_{\pi \in \mathcal{P}}$$

$$\textstyle \sum_{\pi \in \mathcal{P}} \parop_{\pi \in \mathcal{P}} \scriptstyle \sum_{\pi \in \mathcal{P}} \parop_{\pi \in \mathcal{P}} \scriptscriptstyle \sum_{\pi \in \mathcal{P}} \parop_{\pi \in \mathcal{P}}$$

\end{document}


For a quick and dirty one-time-use solution, make it a math operator.

\documentclass{article}

\usepackage{mathtools}
\begin{document}
$$\textbf{G} := \mathop{\parallel}\limits_{\pi \in \mathcal{P}} \textbf{G}^{\pi}$$
\end{document}