Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This code tries to use \multiinclude from xmpmulti inside a tikz node text to include for example a series of files pic-0.pdf, pic-1.pdf,..., etc. and doesn't compile and throws out error listed below. Is it possible to use \multiinclude in a tikz node? If it is, how to do it? Or if not, is there alternative ways to manage the same effect: showing a stack of slides inside a tikz node?

\documentclass{beamer}

\usepackage{tikz}
\usepackage{xmpmulti}

\begin{document}
\begin{frame}
  \begin{tikzpicture}
    \node {
      \multiinclude[format=pdf,graphics={width=.45\textwidth}]{pic}
    };
  \end{tikzpicture}
\end{frame}
\end{document}

The error beamer gives is

! Package tikz Error: Giving up on this path. Did you forget a semicolon?.

See the tikz package documentation for explanation.
Type  H <return>  for immediate help.
...                                              

l.14 \end{frame}

! You can't use `\lastskip' in restricted horizontal mode.
\@let@token ...{}\beamer@lastskipcover =\lastskip 
                                              \edef \beamer@lastskiptext...
l.14 \end{frame}
share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

The problem is that \multiinclude internally uses the \pause command to step between pictures. Using \pause inside a TikZ node is Dangerous as it does all sorts of trickery which cases the node to collapse. There are, thus, two solutions. One is to specify your own overlay specification, as an initial optional argument, such as:

\multiinclude[<+->][format=pdf,graphics={width=.45\textwidth}]{pic}

This avoids the \pause problem because it puts the images inside an actionenv with the given overlay specification. You'll need to experiment to see what the right overlay specification should be.

The other solution is to put the contents of the node inside another group. This seems to fix the \pause-in-node problem. Thus:

{\multiinclude[format=pdf,graphics={width=.45\textwidth}]{pic}}

However, I would be wary of this second method. The \pause command is meant to act globally. The fact that it doesn't in this circumstance may change in future versions of these packages.

To see that it is the \pause that is causing the problem, try:

\documentclass{beamer}
% \url{http://tex.stackexchange.com/q/24085/86}

\usepackage{tikz}

\begin{document}
\begin{frame}

%{hello \pause world}
  \begin{tikzpicture}
    \node {%
  hello \pause world
    };
  \end{tikzpicture}
hello world
\end{frame}
\end{document}

and you will see that you get the same error. Enclosing the node contents in a group, {...}, fixes this. To see that \pause is meant to act globally, uncomment the line before the \begin{tikzpicture}.

For completeness, here are some related questions:

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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