2

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

\documentclass{article}

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

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

2 Answers2

3

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}

\begin{equation}
\textbf{G} \coloneqq \parop_{\pi \in \mathcal{P}} \textbf{G}^{\pi} 
\end{equation}

\begin{equation}
\sum_{\pi \in \mathcal{P}} \parop_{\pi \in \mathcal{P}}
\end{equation}

\begin{equation}
\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{equation}

\end{document}

enter image description here

egreg
  • 1,121,712
1

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

\documentclass{article}

\usepackage{mathtools}
\begin{document}
    \begin{equation}
        \textbf{G} := \mathop{\parallel}\limits_{\pi \in \mathcal{P}} \textbf{G}^{\pi} 
    \end{equation}
\end{document}
TeXnician
  • 33,589
  • For all other situations, see https://tex.stackexchange.com/questions/23432/how-to-create-my-own-math-operator-with-limits. – TeXnician Dec 16 '18 at 15:44