Re: Help: about positioning TikZ picture
Kjell Magne Fauske <kjellmf <at> gmail.com>
2006-11-15 08:28:09 GMT
I think the problem is that the bounding box changes for each frame.
Try this instead:
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\frame[plain]{
\begin{figure}
\begin{tikzpicture}
\useasboundingbox (-2,1) rectangle (3,-1);
\only<1-2>{
\draw (-1,0) -- +(3.5,0);
\draw (1,0) ++(210:2cm) -- +(30:4cm);
\draw (1,0) +(0:1cm) arc (0:30:1cm);
\draw (1,0) +(180:1cm) arc (180:210:1cm);
\path (1,0) ++(15:.75cm) node{$\alpha$};
\path (1,0) ++(15:-.75cm) node{$\beta$};
\draw[red] (0,0) circle (2pt) node[anchor=south, color=red]
{$(0,0)$}; %
}
\only<2-3>{
\path (1,0) ++(15:-2.75cm) node{$\gamma$}; }
\end{tikzpicture}
\end{figure}
}
\end{document}
The above example works as intended. Try to experiment with the bounding box:
\useasboundingbox (-2,1) rectangle (3,-1);
You could for instance use
\useasboundingbox (0,0) rectangle (0.5,0.5);
to get a different placement.
- Kjell Magne Fauske
On 11/15/06, changfa <sc229 <at> njit.edu> wrote:
>
> Hi, all,
>
> I am new to TikZ and I tend to use it from now on. Unfortunately
> I encountered the problem of positioning the TikZ picture and still cannot
> find a way out after struggling the whole afternoon and night. Hopefully
> someone here can help me out.
>
> I met the problem when I try to use tikzpicture environment in Beamer. First
> I
> tried following codes:
>
> %----------------------------------------------------
> \documentclass{beamer}
> \usepackage{tikz}
>
> \begin{document}
>
> \frame[plain]{
> \center
> \begin{tikzpicture}
> \only<1-2>{
> \draw (-1,0) -- +(3.5,0);
> \draw (1,0) ++(210:2cm) -- +(30:4cm);
> \draw (1,0) +(0:1cm) arc (0:30:1cm);
> \draw (1,0) +(180:1cm) arc (180:210:1cm);
> \path (1,0) ++(15:.75cm) node{$\alpha$};
> \path (1,0) ++(15:-.75cm) node{$\beta$};
> \draw[red] (0,0) circle (2pt) node[anchor=south, color=red]
> {$(0,0)$}; %
> }
> \only<2-3>{
> \path (1,0) ++(15:-2.75cm) node{$\gamma$}; }
> \end{tikzpicture}
> }
> \end{document}
> %---------------------------------------------
>
> I got two problem here:
> 1. the figure is not centered, and
> 2. the overlays jump from frame to frame.
>
> I looked up the PGF/TikZ manual and did not find the solution. In fact, I am
> confused
> about the interaction between "column" environment in BEAMER and the TikZ
> picture.
> How can we put the TikZ drawing in the middle of the "column" space?
>
> Thanks in advance!
>
> changfa
>
>
> --
> View this message in context: http://www.nabble.com/Help%3A-about-positioning-TikZ-picture-tf2634341.html#a7352816
> Sent from the pgf-users mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> pgf-users mailing list
> pgf-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pgf-users
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV