add tag
topnush
I have the following start to a frame.


```
\documentclass[xcolor={rgb}]{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm} 
\setbeamertemplate{frametitle}[default][center]
\newcommand{\var}[1]{\operatorname{var}{\!#1}}
\begin{document}
\begin{frame}[t]
%\addtolength{\leftmargini}{-1.3cm}
%\hspace*{-0.5cm}
\begin{align*}
\var(X) &= 0 + \var{\left(g(a) \sum_{j\in[n]\backslash\{a\}} f_j\cdot g(j) Y_j\right)}\\ 
&= \mathbb{E}\left( g(a)^2 \sum_{j\in[n]\backslash\{a\}} f^2_j Y^2_j + g(a)^2 \sum_{j\in[n]\backslash\{a\}} \right) - \left(\sum_{j\in[n]\backslash\{a\}} f_j \mathbb{E}[g(a)g(j)Y_j]\right)
\end{align*}
\end{frame}
\end{document}`
```


I would really like to fit the second line into one line on the slide. 

* How can I shift it left into the margin?  The two commented out methods didn't work
* Is it possible to compress the maths slightly by reducing the space around the brackets, the \mathhbb{E}, plus sign etc.?
Top Answer
marmot
With the `multine` environment, `\smashoperator` from `mathtools` and input from barbara beeton you'd get
```
\documentclass[xcolor={rgb}]{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm} 
\setbeamertemplate{frametitle}[default][center]
\usepackage{mathtools}
\DeclareMathOperator{\var}{var}
\begin{document}
\begin{frame}[t]
\begin{multline*}
\!\!\var(X) = 0 + \var\!\left(g(a) \smashoperator{\sum_{j\in[n]\setminus\{a\}}} f_j\cdot g(j) Y_j\right)\\ 
=  \mathbb{E}\left( \smashoperator[r]{\sum_{j\in[n]\setminus\{a\}}}g(a)^2 f^2_j Y^2_j +
\smashoperator{\sum_{j\in[n]\setminus\{a\}}}g(a)^2 \right) 
- \left(\smashoperator[r]{\sum_{j\in[n]\setminus\{a\}}} f_j \mathbb{E}[g(a)g(j)Y_j]\right)
\end{multline*}
which naively is the same as
\begin{align*}
\var(X) &= 0 + \var\!\left(g(a) \smashoperator{\sum_{j\in[n]\setminus\{a\}}} f_j\cdot g(j) Y_j\right)\\ 
&=  \mathbb{E}\left[\smashoperator[r]{\sum_{j\in[n]\setminus\{a\}}}g(a)^2
\left( f^2_j Y^2_j +1\right)\right]
- \left(\smashoperator[r]{\sum_{j\in[n]\setminus\{a\}}} f_j \mathbb{E}[g(a)g(j)Y_j]\right)
\end{align*}
\end{frame}
\end{document}
```
![Screen Shot 2020-09-14 at 1.06.22 PM.png](/image?hash=eb9a6fa2c17c8a2d5cfaab82d5129e83c1c4019fde6c6bc73bcc12b3d762c5eb)
Answer #2
samcarter
Even with zero margins, this won't fit on your slide.

Instead you could try

- a smaller font size

- move the second term into the next line

```
\documentclass[xcolor={rgb}]{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm} 
\setbeamertemplate{frametitle}[default][center]
\newcommand{\var}[1]{\operatorname{var}{\!#1}}
\begin{document}
\begin{frame}[t]
{\small\begin{align*}
\var(X) &= 0 + \var{\left(g(a) \sum_{j\in[n]\backslash\{a\}} f_j\cdot g(j) Y_j\right)}\\ 
&= \mathbb{E}\left( g(a)^2 \sum_{j\in[n]\backslash\{a\}} f^2_j Y^2_j + g(a)^2 \sum_{j\in[n]\backslash\{a\}} \right) - \left(\sum_{j\in[n]\backslash\{a\}} f_j \mathbb{E}[g(a)g(j)Y_j]\right)
\end{align*}}
\end{frame}

\begin{frame}[t]
\begin{align*}
\var(X) = & 0 + \var{\left(g(a) \sum_{j\in[n]\backslash\{a\}} f_j\cdot g(j) Y_j\right)}\\ 
= & \mathbb{E}\left( g(a)^2 \sum_{j\in[n]\backslash\{a\}} f^2_j Y^2_j + g(a)^2 \sum_{j\in[n]\backslash\{a\}} \right) -\\
&- \left(\sum_{j\in[n]\backslash\{a\}} f_j \mathbb{E}[g(a)g(j)Y_j]\right)
\end{align*}
\end{frame}
\end{document}
```

![Screen Shot 2020-09-14 at 21.37.18.png](/image?hash=b2b0cbb26c79d68145d06cc9df00f44363b8d490e3827443d57c1e544f7e00b4)

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.