0

Consider this standard MWE:

\documentclass[11pt]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usetheme{default}
\begin{document}

\begin{frame}

\begin{itemize}
    \item Equation 1 here: 

        \begin{equation}
        Pr( Y= n)  = \frac{e^{-7}\times 7^n}{n!} 
        \end{equation}

    \item Equation 2 here:

        \begin{equation} 
        Pr( Y= n)  = \dfrac{e^{-7}\times 7^n}{n!}
        \end{equation}

\end{itemize}

\end{frame}
\end{document}

It produces:

enter image description here

I want to achieve this:

enter image description here

I can do it manually adding \vspace{-1.05cm} before both equations. Instead, I would like this to be done automatically.

Notice I want to preserve the equation number, so using inline $ equation $ at the \item level is not enough (plus it would need manual centering, depending on equation length.

Is there a way to achieve what I want?

Related posts that haven't helped me are this one and this one.

luchonacho
  • 4,161

1 Answers1

0

As suggested, this question is a duplicate of this one. Here are however some minor changes to the most upvoted answer, to my taste:

  1. Require the equation to be written inside a math environment. This looks nicer in the editor, as it does not show characters out of place.

    For this change to take place, replace \sbox2{$\displaystyle#3\m@th$}% with \sbox2{#3}%. Then, use the environment as this:

    \itemequation{Nice equation}{$2+2=4$}
    

    rather than

    \itemequation{Nice equation:}{2+2=4}
    
  2. Add option for no equation number (useful with the $$ ... $$ math environment).

    For this, I created another command, removing the \sbox4{\@eqnnum}% line. (I tried creating a star command using @\ifstar but failed.

luchonacho
  • 4,161