[Tex/LaTex] Vertically Aligning or Locking Text in Beamer Presentation

beameroverlays

I understand that by using overlays in a beamer presentation, one is able to lock text within a frame, and continue to display other items without affecting the position of the previous item(s) being displayed. What I want to do, however, is to replace one particular overlay with another, without affecting the position of the previous overlays that are being displayed. I am not quite sure how to do this. The best that I have been able to come up with is in the following sample of code, where I am trying to preserve the position of the definition and the matrix in separate slides.

\documentclass[11pt,xcolor=pdftex,dvipsnames,table]{beamer}

\usepackage{multirow}
\usepackage{beamerthemesplit}
\usetheme{Berkeley}
\usecolortheme{dolphin}
\usepackage{graphicx}
\usepackage{epsf}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\title[Short Title]{Longer Presentation Title}
\author[John Doe]{John Doe}
\institute{University of Nowhere}
\date{July 7, 2011}

\begin{document}

\maketitle

\begin{frame}
  \frametitle{Introduction}
  \setbeamercovered{dynamic}
  \framesubtitle{Definitions (Cont...)}
    \textit{Definition 5:} If $A$ is an $m \times n$ matrix, $I$ is a subset of $\{1, ..., m\}$ with $k$ elements, and $J$ is a subset of $\{1, ..., n\}$ with $k$ elements, then the matrix for the $k \times k$ minor of $A$ that corresponds to the rows with index in $I$ and the columns with index in $J$, is written as $[A]_{I,J}$. \pause
    \newline
    \newline
    If $I = J$, then $[A]_{I,J}$ is called a \textit{principal minor}.
    \newline
    \newline
    \[A =
      \left(
        \begin{array}{rrr}
          \multicolumn{1}{r}{1} & \multicolumn{1}{r}{4} & \multicolumn{1}{r}{7} \\
          \cline{2-3}
          \multicolumn{1}{r}{3} & \multicolumn{1}{|r}{0} & \multicolumn{1}{r|}{5} \\
          \multicolumn{1}{r}{-1} & \multicolumn{1}{|r}{9} & \multicolumn{1}{r|}{11} \\
          \cline{2-3}
        \end{array}
      \right), \mbox{~where~} I = \{2, 3\} \mbox{~and~} J = \{2,3\}
    \]
\end{frame}

\begin{frame}
  \frametitle{Introduction}
  \setbeamercovered{dynamic}
  \framesubtitle{Definitions (Cont...)}
    \textit{Definition 5:} If $A$ is an $m \times n$ matrix, $I$ is a subset of $\{1, ..., m\}$ with $k$ elements, and $J$ is a subset of $\{1, ..., n\}$ with $k$ elements, then the matrix for the $k \times k$ minor of $A$ that corresponds to the rows with index in $I$ and the columns with index in $J$, is written as $[A]_{I,J}$.
    \newline
    \newline
    If the matrix consists of elements in rows and columns from $1$ to $k$, then the principal minor is called a \textit{leading principal minor}.
    \[A =
      \left(
        \begin{array}{rrr}
          \cline{1-2}
          \multicolumn{1}{|r}{1} & \multicolumn{1}{r|}{4} & \multicolumn{1}{r}{7} \\
          \multicolumn{1}{|r}{3} & \multicolumn{1}{r|}{0} & \multicolumn{1}{r}{5} \\
          \cline{1-2}
          \multicolumn{1}{r}{-1} & \multicolumn{1}{r}{9} & \multicolumn{1}{r}{11} \\
        \end{array}
      \right), \mbox{~where~} I = \{1,2\} \mbox{~and~} J = \{1,2\}
    \]
\end{frame}

\end{document}

Any help/suggestions on how I can do this would be appreciated.

Best Answer

You could use overlayarea (see Section 9.5 Dynamically Changing Text or Images of the manual), \onslide, and \only:

\documentclass[11pt,xcolor=pdftex,dvipsnames,table]{beamer}

\usepackage{multirow}
\usepackage{beamerthemesplit}
\usetheme{Berkeley}
\usecolortheme{dolphin}
\usepackage{graphicx}
\usepackage{epsf}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\title[Short Title]{Longer Presentation Title}
\author[John Doe]{John Doe}
\institute{University of Nowhere}
\date{July 7, 2011}

\begin{document}

\maketitle

\begin{frame}
  \frametitle{Introduction}
  \framesubtitle{Definitions (Cont...)}
\textit{Definition 5:} If $A$ is an $m \times n$ matrix, $I$ is a subset of $\{1, ..., m\}$ with $k$ elements, and $J$ is a subset of $\{1, ..., n\}$ with $k$ elements, then the matrix for the $k \times k$ minor of $A$ that corresponds to the rows with index in $I$ and the columns with index in $J$, is written as $[A]_{I,J}$.\\[1\baselineskip]


\begin{overlayarea}{\textwidth}{1cm}
\only<1>{If $I = J$, then $[A]_{I,J}$ is called a \textit{principal minor}.}
\only<2>{If the matrix consists of elements in rows and columns from $1$ to $k$, then the principal minor is called a \textit{leading principal minor}.}
\end{overlayarea}

\begin{overlayarea}{\textwidth}{3cm}
\only<1>{%
\[A =
      \left(
        \begin{array}{rrr}
          \multicolumn{1}{r}{1} & \multicolumn{1}{r}{4} & \multicolumn{1}{r}{7} \\
          \cline{2-3}
          \multicolumn{1}{r}{3} & \multicolumn{1}{|r}{0} & \multicolumn{1}{r|}{5} \\
          \multicolumn{1}{r}{-1} & \multicolumn{1}{|r}{9} & \multicolumn{1}{r|}{11} \\
          \cline{2-3}
        \end{array}
      \right), \mbox{~where~} I = \{2, 3\} \mbox{~and~} J = \{2,3\}
    \]
}
\only<2>{%
    \[A =
      \left(
        \begin{array}{rrr}
          \cline{1-2}
          \multicolumn{1}{|r}{1} & \multicolumn{1}{r|}{4} & \multicolumn{1}{r}{7} \\
          \multicolumn{1}{|r}{3} & \multicolumn{1}{r|}{0} & \multicolumn{1}{r}{5} \\
          \cline{1-2}
          \multicolumn{1}{r}{-1} & \multicolumn{1}{r}{9} & \multicolumn{1}{r}{11} \\
        \end{array}
      \right), \mbox{~where~} I = \{1,2\} \mbox{~and~} J = \{1,2\}
    \]
}
\end{overlayarea}
\end{frame}

\end{document}