I want to define a new command to format \mathbb{E} in the same way as \sum - same size in display/inline formulae, and same treatment of sub/superscripts. The following seems to work...


...except that in display formulae, when inside automatically sized brackets (e.g. \left( \bbe_x \right)) it reverts to treating it as if it were in an inline formula (so smaller size, subscripts to the right not beneath).

I'm not sure what's causing this issue; any advice would be greatly appreciated!


The \ifinner test is not safe for this application. Indeed the conditional is true whenever TeX opens a new math list when it's already in math mode.

The following Plain TeX code shows this:


will print inner in the log file. The same happens inside a \left-\right pair.

What you need is \mathchoice, which depends only on the current math style, which doesn't change in math sublists.


Probably \larger from the relsize package is better for display style:


\ifinner is the wrong sort of test here, you need \mathchoice

enter image description here



$a \bbe_0^1 $

\[ \bbe_0^1 \qquad \frac{\bbe_0^1}{\bbe_0^1} \]


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.