Skip to content

Instantly share code, notes, and snippets.

@Rmano
Created June 3, 2020 06:48
Show Gist options
  • Save Rmano/37a7a699c5e6aa1d3834777251d54b93 to your computer and use it in GitHub Desktop.
Save Rmano/37a7a699c5e6aa1d3834777251d54b93 to your computer and use it in GitHub Desktop.
Example of use of TikZ beamer styles
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{arrows,overlay-beamer-styles}
\begin{document}
% mode 1 (but you need to add an "use as bounding box"
% somewhere to avoid jumping because adding things changes
% the size of the picture
\begin{frame}
\begin{center}
\begin{tikzpicture}[>=stealth',thick]
\node at (0,0) (1) {$1$};
\node at (2,0) (2) {$2$};
\draw<2-> (1) edge[bend left,->] (2);
\draw<3-> (2) edge[bend left,->] (1);
\end{tikzpicture}
\end{center}
\end{frame}
% mode 2, better, now the arrows are drawn always but they are
% invisible on some frames
\begin{frame}
\begin{center}
\begin{tikzpicture}[>=stealth',thick]
\node at (0,0) (1) {$1$};
\node at (2,0) (2) {$2$};
\begin{scope}[visible on=<2->]
\draw (1) edge[bend left,->] (2);
\end{scope}
\begin{scope}[visible on=<3->]
% change color on <4>
\draw[alt=<4->{red}{}] (2) edge[bend left,->] (1);
\end{scope}
% you can use only too:
\only<4->{
\draw [red, ultra thick, red, ->] (2) -- (1);
}
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment