2

I have a beamer frame with a large matrix. I want to add some annotations to it, for which I use tikz overlays. However, the matrix (I suppose that it is the resizebox, actually) changes its width from frame to frame, which is highly undesired. Here is a minimum working example:

\documentclass{beamer}
\usepackage{tikz}

\begin{document}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node(#1) {};}

\frame
{
    \resizebox{\textwidth}{!}
    {
        $\left(\begin{array}{rrrrrrrrrrrrrrrrrrrrrrrrrr}a & b & c & d & e & f & g & h & i & j & k & l & m & n & o & p & q & r & s & t & u & v & w & x & y & z\\ a & \tikzmark{b}b & c & d & e & f & g & h & i & j & k & l & m & n & o & p & q & r & s & t & u & v & w & x & y & z\end{array}\right)$
        \only<1>
        {
            \begin{tikzpicture}[overlay,remember picture,-latex]
                \draw[->] (b.east) -- +(1,-0.5) node[below] (btext) {This is b};
            \end{tikzpicture}
        }
    }
    \only<2>
    {
        \begin{tikzpicture}[overlay,remember picture,-latex]
            \node[at=(btext)] {More text};
        \end{tikzpicture}
    }
}

\end{document}

The (undesired) effect looks like this:

enter image description here

I am using the overlay because I do not want the matrix to change its width from slide to slide. I am aware that my second text is outside of the resizebox - I want it to be overlayed with normal text size, i.e., so that it is unaffected by the resizebox.

What can I do to keep the width of the matrix unchanged between slides?

1 Answer 1

4

You have a lot of spurious spaces. When I remove them all, it works fine.

\documentclass{beamer}
\usepackage{tikz}

\begin{document}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node(#1) {};}

\frame
{%
    \resizebox{\textwidth}{!}
    {%
        $\left(\begin{array}{rrrrrrrrrrrrrrrrrrrrrrrrrr}a & b & c & d & e & f & g & h & i & j & k & l & m & n & o & p & q & r & s & t & u & v & w & x & y & z\\ a & \tikzmark{b}b & c & d & e & f & g & h & i & j & k & l & m & n & o & p & q & r & s & t & u & v & w & x & y & z\end{array}\right)$%
        \only<1>
        {%
            \begin{tikzpicture}[overlay,remember picture,-latex]
                \draw[->] (b.east) -- +(1,-0.5) node[below] (btext) {This is b};
            \end{tikzpicture}%
        }%
    }%
    \only<2>
    {%
        \begin{tikzpicture}[overlay,remember picture,-latex]
            \node[at=(btext)] {More text};
        \end{tikzpicture}%
    }%
}

\end{document}
2

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.