2

I would like to add a tikz node within a text in such a way that it doesn't add space between the lines. In particular, I'd like to animate (in beamer) a frame around the text without it taking space.

Below is an example of what I'm trying to do.

Many thanks in advance!

\documentclass{beamer}
\usepackage{tikz}

\tikzset{
     alt/.code args={<#1>#2#3}{%
       \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
     },
    BeamerAlert/.style={alt=#1{draw=red,thick,rounded corners}{},anchor=base}
}

\newcommand<>{\tikzMe}[1]{
   \tikz[baseline]\node[BeamerAlert=#2] {${#1}$};
}

\begin{document}
\begin{frame}
  This is an \tikzMe<2>{\mathsf{example}} of
  text with the space between lines changed because of the tikz
  node. Here is another line whose spacing is natural.

\end{frame}
\end{document}
Beta
  • 331

0 Answers0