1

I build the following slide with a set of equations and some color effects to highlight individual symbols. It basically works, but somehow the symbols jump in some transitions, e.g., 1 -> 2 or 4 -> 5. I assume that \textcolor is the problem. Here, it is mentioned that \textcolor has some side effects in math mode, but the given macros did not solve the issue.

The code looks quite messy. This mainly results from the individual cases and my attempts to fix the problem. For example, I added \textcolor{black} to all symbols that should not be highlighted.

Any advice is highly welcome.

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{color}
\usepackage{tikz}

\begin{document}

\begin{frame}
\frametitle{Some title}
\begin{itemize}
\item Some text
{\footnotesize
\begin{align*}
% First equation
\only<2>{\textcolor{blue}{\hat{\boldsymbol{x}}}(t) &= \textcolor{black}{f \left( \textcolor{blue}{\boldsymbol{x}}(t - 1) \right)} & \\}
\only<3>{\textcolor{black}{\hat{\boldsymbol{x}}}(t) &= \textcolor{blue}{f \left( \boldsymbol{x}(t - 1) \right)} & \\}
\only<1,4->{\textcolor{black}{\hat{\boldsymbol{x}}}(t) &= \textcolor{black}{f \left( \boldsymbol{x}(t - 1) \right)} & \\}
% Second equation
\only<2>{\textcolor{blue}{\tilde{\boldsymbol{x}}}(t) &= \textcolor{blue}{\hat{\boldsymbol{x}}}(t) + \textcolor{black}{\boldsymbol{K}_f}(t) \left[ \textcolor{black}{\boldsymbol{z}}(t) - \textcolor{black}{h \left( \textcolor{blue}{\hat{\boldsymbol{x}}}(t) \right)} \right] & \\}
\only<4>{\textcolor{black}{\tilde{\boldsymbol{x}}}(t) &= \textcolor{black}{\hat{\boldsymbol{x}}}(t) + \textcolor{black}{\boldsymbol{K}_f}(t) \left[ \textcolor{blue}{\boldsymbol{z}}(t) - \textcolor{black}{h \left( \hat{\boldsymbol{x}}(t) \right)} \right] & \\}
\only<5>{\textcolor{black}{\tilde{\boldsymbol{x}}}(t) &= \textcolor{black}{\hat{\boldsymbol{x}}}(t) + \textcolor{black}{\boldsymbol{K}_f}(t) \left[ \textcolor{black}{\boldsymbol{z}}(t) - \textcolor{blue}{h \left( \hat{\boldsymbol{x}}(t) \right)} \right] & \\}
\only<6>{\textcolor{black}{\tilde{\boldsymbol{x}}(t)} &= \textcolor{black}{\hat{\boldsymbol{x}}(t)} + \textcolor{blue}{\boldsymbol{K}_f}(t) \left[ \textcolor{black}{\boldsymbol{z}(t)} - \textcolor{black}{h \left( \hat{\boldsymbol{x}}(t) \right)} \right] & \\}
\only<1,3,7->{\textcolor{black}{\tilde{\boldsymbol{x}}}(t) &= \textcolor{black}{\hat{\boldsymbol{x}}}(t) + \textcolor{black}{\boldsymbol{K}_f}(t) \left[ \textcolor{black}{\boldsymbol{z}}(t) - \textcolor{black}{h \left( \hat{\boldsymbol{x}}(t) \right)} \right] & \\}
% Third equation
\only<2>{\textcolor{blue}{\boldsymbol{x}}(t) &= \textcolor{blue}{\tilde{\boldsymbol{x}}}(t) + \textcolor{black}{\boldsymbol{K}_s}(t) \left[ \textcolor{blue}{\boldsymbol{x}}(t + 1) - \textcolor{black}{f \left( \textcolor{blue}{\tilde{\boldsymbol{x}}}(t) \right)} \right]}
\only<3>{\textcolor{black}{\boldsymbol{x}}(t) &= \textcolor{black}{\tilde{\boldsymbol{x}}}(t) + \textcolor{black}{\boldsymbol{K}_s}(t) \left[ \textcolor{black}{\boldsymbol{x}}(t + 1) - \textcolor{blue}{f \left( \tilde{\boldsymbol{x}}(t) \right)} \right]}
\only<6>{\textcolor{black}{\boldsymbol{x}}(t) &= \textcolor{black}{\tilde{\boldsymbol{x}}}(t) + \textcolor{blue}{\boldsymbol{K}_s}(t) \left[ \textcolor{black}{\boldsymbol{x}}(t + 1) - \textcolor{black}{f \left( \tilde{\boldsymbol{x}}(t) \right)} \right]}
\only<1,4-5,7->{\textcolor{black}{\boldsymbol{x}}(t) &= \textcolor{black}{\tilde{\boldsymbol{x}}}(t) + \textcolor{black}{\boldsymbol{K}_s}(t) \left[ \textcolor{black}{\boldsymbol{x}}(t + 1) - \textcolor{black}{f \left( \tilde{\boldsymbol{x}}(t) \right)} \right]}
\end{align*}
\def\arraystretch{1.1}
\begin{tabular}{@{}ll@{}}
\only<2>{\\[-\normalbaselineskip]\textcolor{blue}{$\boldsymbol{x}$} & \textcolor{blue}{state vector (joint trajectories)} \\}
\only<1,3->{\\[-\normalbaselineskip]$\boldsymbol{x}$ & state vector (joint trajectories) \\}
\only<4>{\\[-\normalbaselineskip]\textcolor{blue}{$\boldsymbol{z}$} & \textcolor{blue}{measurement vector (marker trajectories)} \\}
\only<1-3,5->{\\[-\normalbaselineskip]$\boldsymbol{z}$ & measurement vector (marker trajectories) \\}
\only<3>{\\[-\normalbaselineskip]\textcolor{blue}{$f(\boldsymbol{x})$} & \textcolor{blue}{process model (constant jerk)} \\}
\only<1-2,4->{\\[-\normalbaselineskip]$f(\boldsymbol{x})$ & process model (constant jerk) \\}
\only<5>{\\[-\normalbaselineskip]\textcolor{blue}{$h(\boldsymbol{x})$} & \textcolor{blue}{measurement model (forward kinematics)} \\}
\only<1-4,6->{\\[-\normalbaselineskip]$h(\boldsymbol{x})$ & measurement model (forward kinematics) \\}
\only<6>{\\[-\normalbaselineskip]\textcolor{blue}{$\boldsymbol{K}_f$, $\boldsymbol{K}_s$} & \textcolor{blue}{filter and smoother gains}}
\only<1-5,7->{\\[-\normalbaselineskip]$\boldsymbol{K}_f$, $\boldsymbol{K}_s$ & filter and smoother gains}
\end{tabular}
}
\end{itemize}

\begin{tikzpicture}[remember picture, overlay]
\node[anchor=north east, align=left] at (current page.north east) {
\scriptsize
$\begin{aligned}
\only<2>{\textcolor{blue}{\boldsymbol{x}}_i(t) &= \begin{bmatrix} q_i(t) & \dot{q}_i(t) & \ddot{q}_i(t) & \dddot{q}_i(t) \end{bmatrix}^T \\}
\only<1,3->{\boldsymbol{x}_i(t) &= \begin{bmatrix} q_i(t) & \dot{q}_i(t) & \ddot{q}_i(t) & \dddot{q}_i(t) \end{bmatrix}^T \\}
\only<3>{\textcolor{blue}{f_i \left( \boldsymbol{x}_i(t) \right)} &= \begin{bmatrix}
1 & \Delta t & \frac{\Delta t^2}{2} & \frac{\Delta t^3}{6}\\
0 & 1 & \Delta t & \frac{\Delta t^2}{2}\\
0 & 0 & 1 & \Delta t\\
0 & 0 & 0 & 1\\
\end{bmatrix} \boldsymbol{x}_i(t) \\}
\only<1-2,4->{f_i \left( \boldsymbol{x}_i(t) \right) &= \begin{bmatrix}
1 & \Delta t & \frac{\Delta t^2}{2} & \frac{\Delta t^3}{6}\\
0 & 1 & \Delta t & \frac{\Delta t^2}{2}\\
0 & 0 & 1 & \Delta t\\
0 & 0 & 0 & 1\\
\end{bmatrix} \boldsymbol{x}_i(t) \\}
i &= 1 \dots 36
\end{aligned}$
};
\end{tikzpicture}
\end{frame}

\end{document}
4

I get no jump if I remove all \left and \right from your code.

They really do nothing good, besides creating problems.

3

You're making your life far too complicated by switching between math mode and text mode like that. Try something like this instead.

\documentclass{beamer}

\usepackage{amsmath}
\usepackage{xcolor}


\newcommand{\blubold}[1]{{\color{blue}\boldsymbol{#1}}}


\begin{document}

    \begin{frame}
        \frametitle{Some title}
        \begin{itemize}
            \item $\blubold{x}$
        \end{itemize}
        \end{frame}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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