beamer add tag
Anush (imported from SE)
I am using beamer and smashoperator as follows:


    \documentclass[xcolor={rgb}]{beamer}
    \setbeamercovered{transparent}
    \beamertemplatenavigationsymbolsempty
    \setbeamersize{text margin left=10mm,text margin right=5mm}
    \setbeamertemplate{frametitle}[default][center]
    \usepackage{mathtools}
    \usepackage{bm}
    \newcommand{\var}[1]{\operatorname{var}{#1}}
    \newcommand{\E}{\mathbb{E}}
    \newcommand{\norm}[1]{\left\lVert#1\right\rVert}
    \begin{document}
    \begin{frame}[t]
    \begin{align*}
    \onslide<2->{&= \E\Bigl( g(a)^2 \smashoperator{\sum_{j\in[n]\backslash\{a\}}} f^2_j Y^2_j + \smashoperator{\sum_{\substack{j\in[n]\setminus\{a\}\\i\ne j}}} f_i f_j g(i) g(j) Y_i B_j\Bigr) -{}\\}
    \onslide<2->{&\qquad\qquad\qquad\qquad \Bigl(\smashoperator{\sum_{j\in[n]\backslash\{a\}}} f_j \mathbb{E}[g(a)g(j)Y_j]\Bigr)^2\\[\jot]}
    \onslide<3->{&= \sum_{j\in[n]\backslash\{a\}} \frac{f^2_j}{k} + 0 - 0\\[\jot]}
    \end{align*}
    \end{frame}
    \end{document}

However this gives an odd result.

[![enter image description here][1]][1]

Is there any way to fix this?

 


  [1]: https://i.stack.imgur.com/iGhkL.png
Top Answer
samcarter
As a workaround, you can add the colour yourself:


```
\documentclass[xcolor={rgb}]{beamer}
\setbeamercovered{transparent}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm}
\setbeamertemplate{frametitle}[default][center]
\usepackage{mathtools}
\usepackage{bm}
\newcommand{\var}[1]{\operatorname{var}{#1}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\norm}[1]{\left\lVert#1\right\rVert}
\begin{document}
\begin{frame}[t]
\begin{align*}
\onslide<1->{&= \E\Bigl( g(a)^2 \smashoperator{\sum_{j\in[n]\backslash\{a\}}} f^2_j Y^2_j + \smashoperator{\sum_{\substack{j\in[n]\setminus\{a\}\\i\ne j}}} f_i f_j g(i) g(j) Y_i B_j\Bigr) -{}\\}
\onslide<2->{&\qquad\qquad\qquad\qquad \Bigl(\smashoperator{\sum_{\alt<2->{}{\color{.!85!bg}}j\in[n]\backslash\{a\}}} f_j \mathbb{E}[g(a)g(j)Y_j]\Bigr)^2\\[\jot]}
\onslide<3->{&= \sum_{j\in[n]\backslash\{a\}} \frac{f^2_j}{k} + 0 - 0\\[\jot]}
\end{align*}
\end{frame}
\end{document}
```

![document.gif](/image?hash=7b81963306e1ce7f1566d927d33018d6c9342180252ac7d754fe0ab65455e443)
Answer #2
marmot
I think you have discovered a bug, and you got already an excellent workaround. However, here is another way to obtain this result, which might be even a bit shorter. More importantly, the fact that this method works may allow us to come up with educated guesses on what's going on. All you need to do is to ["repair" the `\pause` command](https://topanswers.xyz/tex?q=1126#a1350). I do not want to repeat all information from the linked post, but the `align` and so on environments "run" the code twice, one time in a "measuring" phase and then "for real". By suppressing the measuring phase in `\pause`, your issue gets solved, too. This seems to suggest that the `\smashoperator` uses the "wrong" boxes in the subscripts of the sum.

```
\documentclass[xcolor={rgb}]{beamer}
\setbeamercovered{transparent}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm}
\setbeamertemplate{frametitle}[default][center]
\usepackage{mathtools}
\usepackage{bm}
\newcommand{\var}[1]{\operatorname{var}{#1}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\norm}[1]{\left\lVert#1\right\rVert}
\makeatletter
\renewrobustcmd{\beamer@@pause}[1][]{%
  \unless\ifmeasuring@%
  \ifblank{#1}%
    {\stepcounter{beamerpauses}}%
    {\setcounter{beamerpauses}{#1}}%
  \onslide<\value{beamerpauses}->\relax%
  \fi
}
\makeatother
\begin{document}
\begin{frame}[t]
\pause
\begin{align*}
&= \E\Bigl( g(a)^2 \smashoperator{\sum_{j\in[n]\backslash\{a\}}} f^2_j Y^2_j + \smashoperator{\sum_{\substack{j\in[n]\setminus\{a\}\\i\ne j}}} f_i f_j g(i) g(j) Y_i B_j\Bigr) -{}\\
&\qquad\qquad\qquad\qquad \Bigl(\smashoperator{\sum_{j\in[n]\backslash\{a\}}} f_j \mathbb{E}[g(a)g(j)Y_j]\Bigr)^2\\[\jot]
\pause
&= \sum_{j\in[n]\backslash\{a\}} \frac{f^2_j}{k} + 0 - 0\\[\jot]
\end{align*}
\end{frame}
\end{document}
```
![ani.gif](/image?hash=99ceb90a047f4c8077f34fb08a0323cf2ecd69272353fb6e5ff4ac516ccbb5f5)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.