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 want to create a series of related graphs, for instance, higlighting the traversal through a graph. It works nice using overlays in beamer frames.

Can I do analogous things in a normal document? Of course not an "overlay", but side-by-side pictures where the first gives the only<1>-part of the figure as shown in the presentation, the second the only<2>-part etc.

Martin

share|improve this question
    
Nope. The beamer class defines the primitives for incremental presentations. –  Marc van Dongen Sep 8 '12 at 8:32
    
ok. I guess I need to hack it myself. I had thought that it would be a natural enough wish that either tikz had a way to do that, or that someone had a package. I guess one need to mimick the ``counting mechanism'' (\beamer@slideinframe) and the <"slide number spec">-syntax. Maybe I look into it. –  Martin Steffen Sep 8 '12 at 11:01
    
If the pages are otherwise empty, one might probably do something like that with background and xifthen. –  Tom Bombadil Sep 8 '12 at 13:41
add comment

1 Answer 1

probably like this?

Code

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usepackage{xifthen}

\newcommand{\layerpic}[2]% layers, commands
{   \foreach \x in {1,...,#1}
    {   \begin{tikzpicture}
            \pgfmathtruncatemacro{\i}{\x+1}
            #2
        \end{tikzpicture}\\[1cm]
    }
}

\newcommand{\mylayer}[2]% layer, layer commands
{   \ifthenelse{\i>#1}
        {#2}
        {}
}

\begin{document}

\layerpic{4}
{   \mylayer{1}
    {   \fill[green!50!gray] (0,0) rectangle (12,4);    
    }
    \mylayer{2}
    {   \fill[red!50!gray] (6,2) ellipse (5.5 and 1.5);
    }   
    \mylayer{3}
    {   \fill[blue!50!gray] (1,1) circle (0.5);
        \fill[blue!50!gray] (11,1) circle (0.5);
        \fill[blue!50!gray] (1,3) circle (0.5);
        \fill[blue!50!gray] (11,3) circle (0.5);
    }
    \mylayer{4}
    {   \fill[yellow!50!gray] (3,0.1) --  (6,3.9) -- (9,0.1) -- cycle;
    }
}

\end{document}

Result

enter image description here


Edit 1: Here's a command that will act differently in beamer and non-beamer documents:

Code

\makeatletter
\@ifclassloaded{beamer}
  {\xdef\isbeamer{1}}
  {\xdef\isbeamer{0}}%
\makeatother

\newcommand{\layerpic}[2]% layers, commands
{ \ifthenelse{\isbeamer=1}
    {   \begin{tikzpicture}[scale=0.5]
            #2
        \end{tikzpicture}
    }
    {   \foreach \x in {1,...,#1}
    {   \begin{tikzpicture}
        \pgfmathtruncatemacro{\i}{\x+1}
        #2
        \end{tikzpicture}\\[1cm]
    }
  }  
}

\newcommand{\mylayer}[2]% layer, layer commands
{ \ifthenelse{\isbeamer=1} 
    {   \only<#1->{#2}
    }
    {   \ifthenelse{\i>#1}
    {#2}
    {}
  }    
}

Output

In a non-beamer document (e.g. scrartcl), the output is exactly the same as before. In beamer however (the tikzpicture is scaled to 0.5 in beamer mode, as slides are only 128mm wide):

enter image description here

share|improve this answer
    
thanks, sort of. What I still need to figure out is: the figures inside the slides and in the document should be shared, i.e., use the same syntax so that I use the "overlay"-pictures in the presentation, but for the handout, the different stages are printed side by side, showing how the graph evolves. –  Martin Steffen Sep 15 '12 at 6:42
    
So you want the macro to be aware if it is in a beamer or e.g. article documentclass and then use either the beamer overlays or the article steps? And if yes, do you need more complicated expressions like <1,2-4,7-> (because this would be kind of tricky, I think)? –  Tom Bombadil Sep 17 '12 at 9:35
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.