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.

I'm using beamer for creating presentations. Inside a TikZ node I'd like to make a part of the content appears afterwards. I'm using the \visible command for doing so (I don't want the content to move when the hidden part is made visible).

Here's a small example:

\documentclass{beamer}
\usepackage{tikz}\begin{document}

\begin{frame}
  \visible<+->{You know\dots}
  \begin{tikzpicture}
    \node{I'm \visible<+->{very} happy. };
  \end{tikzpicture}
\end{frame}
\end{document}

The compilation fails on a classic TikZ error Giving up on this path. Did you forget a semicolon?. However if I replace \visible by \only or \alt the output is produced flawlessly. But that's not what I want :)

There's a possible workaround which consists in defining a new visible command, based on \alt:

\newcommand<>\myvisible[1]{\alt#2{#1}{\phantom{#1}}}

But \phantom may have some undesirable side effects (with line breaks for example).

Do you have any better solution? Thanks!

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

The problem arises due to the grapping of arguments of the node together with the \visible command.

In beamer a good advice is to

  1. Try and insert another group
  2. Try with the fragile option for the frame
  3. Combine 1. and 2.

You simply need to add another group inside.

\node {{ I'm \visible<+->{very} happy. }};
% or
\node {\bgroup \dots \egroup};

This will correctly produce your decired result.

share|improve this answer
    
Thanks, option 1 works, but not in every case. In TikZ if you add another group in a node, you can't add new lines anymore : \node[align=center]{{a\\b}}; doesn't compile. Should I ask another question on that issue? –  kelux Jul 20 '12 at 19:47
    
@kelux, then just do: \node[align=center] {I'm {\visible<+->{very}}\\happy.};. Just don't have \visible spanning two lines. –  zeroth Jul 22 '12 at 15:31
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.