# How to use limits and nolimits together?

In some case limits and nolimits need to be used together, e.g. an expression \prod\nolimits^{B}\limits_{x \in X}, in which B is in the right-upper corner and x \in X under the \prod, is not displayed it should be, B is displayed above the \prod, not in the right-upper corner. How to resolve this?

-

The amsmath package provides \sideset:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$\sideset{}{^{B}}\prod_{x \in X}A_{x}$

\end{document}


You may want to define your own command:

\newcommand{\prodB}{\sideset{}{^{B}}\prod}

-
Well, it works too. Thank you. – Popopo Apr 1 '13 at 2:55

\documentclass{article}
\usepackage{mathtools}
\begin{document}

${\prod_{\mathclap{x \in X}}}^{B}$
\end{document}

-
Thank you, it works. – Popopo Mar 31 '13 at 17:13
Using \mathclap may give undesirable spacing when the subscript is large. – Aditya Mar 31 '13 at 18:58
@Aditya true (it hides the size of the subscript) although if you don't do anything it pushes B to the right if the subscript is wider than the base. sideset as in egregs answer is another possibility. – David Carlisle Mar 31 '13 at 19:51
You can use \smashoperator{\prod_{x \in X}} instead of that mathclap. – Manuel Mar 31 '13 at 19:57