Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I wanted to use align* environment but it's somehow not working. It's working with regular $$ but the problem is then i have to customize formatting with \hspace and \vspace which defeats the purpose of TeX.

It seems to be a straight forward question. Could be a bug in TeX. Cause there are no typos. I have gone over the slide many times. The code is given below and the output slide is also shown underneath the code.

\begin{frame}{Best Linear Predictor}
\begin{itemize}

\item $\min \limits_{\alpha,\beta} E(Y - \alpha - \beta X)^2$\\
\item Expanding the squared terms and taking the expectations individually we get the    following:
\bigskip

$S = E(Y)^2 +\alpha ^2 + \beta ^2 E(X)^2 - 2\alpha E(Y) - 2\beta E(XY) + 2 \alpha \beta E(X)$\\

\item First order Conditions:\\
\bigskip
 $\frac{\partial S}{\partial \alpha} = 2\alpha - 2 E(Y) + 2\beta E(X)=0$

$\frac{d S}{d \beta} = 2\beta E(X)^2 - 2 E(XY) + 2 \alpha E(X)=0$

\item Solving the above equations simultaneously for $\alpha$ and $\beta$ and denoting the optimal values by $\alpha*$ and $\beta*$ , we get,\\
$\beta^* = \frac{Cov(X,Y)}{V(X)}$\\
and \\
$\alpha^* = E(Y) - \frac{Cov(X,Y)}{V(X)} E(X)$
\end{itemize}
 \end{frame}

The Cluttered Slide

share|improve this question
1  
Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Christian Hupfer Jul 9 at 20:29
    
1st: Please do not use $$...$$, use \[...\] instead. 2nd: There is too much information in the frame –  Christian Hupfer Jul 9 at 20:30
2  
Comment aside: Cov should be declared as math operator. –  Bernard Jul 9 at 20:32
    
"Could be a bug in TeX". Then you can be famous and obtain over 300$. See tex.stackexchange.com/questions/110586/… –  Przemysław Scherwentke Jul 9 at 20:39

1 Answer 1

up vote 6 down vote accepted

Try this:

\documentclass{beamer}

\setbeamertemplate{section in toc}{\hspace*{1em}\inserttocsectionnumber.~\inserttocsection\par}
\setbeamertemplate{subsection in toc}{\hspace*{2em}\inserttocsectionnumber.\inserttocsubsectionnumber.~\inserttocsubsection\par}

\begin{document}

\begin{frame}[allowframebreaks]{Best Linear Predictor}
\begin{itemize}
\item $\min \limits_{\alpha,\beta} E(Y - \alpha - \beta X)^2$\\
\item Expanding the squared terms and taking the expectations individually we get the    following:
\[
S = E(Y)^2 +\alpha ^2 + \beta ^2 E(X)^2 - 2\alpha E(Y) - 2\beta E(XY) + 2 \alpha \beta E(X)
\]
\item First order Conditions:
\begin{align*}
\frac{\partial S}{\partial \alpha} &= 2\alpha - 2 E(Y) + 2\beta E(X)=0 \\
\frac{d S}{d \beta} &= 2\beta E(X)^2 - 2 E(XY) + 2 \alpha E(X)=0
\end{align*}
\item Solving the above equations simultaneously for $\alpha$ and $\beta$ and denoting the optimal values by $\alpha*$ and $\beta*$ , we get,
\begin{align*}
\beta^* &= \frac{Cov(X,Y)}{V(X)} \\
\intertext{and}
\alpha^* &= E(Y) - \frac{Cov(X,Y)}{V(X)} E(X)
\end{align*}
\end{itemize}
\end{frame}

\end{document}

enter image description here

As you can see, align* works as expected. I made some other changes using \[...\] for displayed single-line expressions and using \intertext in the last align* (\shortintertext from the mathtools package could also have been used and produces better results regarding the vertical space).

On a side note, your frame has too much information: either use two frames or pass [allowframebreaks] to the frame (as in my example), to have a better spatial distribution.

share|improve this answer
    
Cool :) Thank You so much. I think it was just more information in the slide which was causing the trouble. Though I tried allowframebreak but somehow it wasn't running properly....Thank you so much! –  Nck Jul 9 at 20:38
1  
@Nck You're welcome! Perhaps you should also consider adding \DeclareMathOperator{\Cov}{Cov} to the preamble and using \Cov(X,Y) instead of just Cov(X,Y) to get the proper font and spacing for the operator. –  Gonzalo Medina Jul 9 at 20:50
1  
@GonzaloMedina: \shortintertext from mathtools would lokk better than intertext. –  Bernard Jul 9 at 21:10
    
@Bernard yes. I added a comment to my answer. Thanks. –  Gonzalo Medina Jul 9 at 21:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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