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 creating a beamer presentation, in which I use TikZ.

I am making a figure, on which I would like to highlight something (using \only<> command). My figure contains an ellipse that is decorated with random steps:

...
\node[ellipse,minimum width=1cm,black!30,decorate,decoration={random steps,segment length=0.2cm,amplitude=.1cm}] {}; 
\only<1>{
\node (n) at (0,0) {A};
}
\only<2>{
\node (n) at (0,0) {B};
}

The ellipse is rendered in differenlty. How can I make it to render the same? or what other decoration can I use to get a similar effect to random steps?

share|improve this question
    
Welcome to TeX.SX! You can highlight code using the braces ({}) button over the edit window, or with backticks (`) for inline code. –  Count Zero Sep 7 '12 at 15:25
    
Welcome to TeX.SX. It is always preferable to post complete minimal working examples rather than code snippets because this helps people to answer you. –  Claudio Fiandrino Sep 7 '12 at 15:30
add comment

1 Answer 1

up vote 13 down vote accepted

The problem was due to the seed: if you add \pgfmathsetseed{<integer number>} before the first \node the seed used to generate random numbers is reset in each slide, forcing the path to be the same.

Here's a complete example (I took some liberty with the size of the shape):

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,decorations,decorations.pathmorphing}

\begin{document}

\begin{frame}{Title frame}
\begin{tikzpicture}
\pgfmathsetseed{23654}
\node[thick,draw,ellipse,minimum width=3cm,minimum height=1.5cm,black!30,decorate,decoration={random steps,segment length=0.3cm,amplitude=.3cm}] {}; 
\only<1>{
\node (n) at (0,0) {A};
}
\only<2>{
\node (n) at (0,0) {B};
}
\end{tikzpicture}
\end{frame}

\end{document}

Result:

enter image description here

share|improve this answer
    
thanks, works excellent! –  jfu Sep 7 '12 at 15:53
    
Glad of having helped you. I would courteously suggest for the future to upvote all answers you find useful, including those to others' questions and to check/accept the best answers to your own questions by clicking the green tick on the left-hand side of the answer. –  Claudio Fiandrino Sep 7 '12 at 15:57
    
I'd love to upvote, but I don't have enough reputation yet :) –  jfu Sep 7 '12 at 16:07
    
No problems: my comment should be intended as good recommendation for new users. :) –  Claudio Fiandrino Sep 7 '12 at 16:10
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.