Graphics, Figures & Tablespstricks in Beamer

Information and discussion about graphics, figures & tables in LaTeX documents.
wwli7p
Posts: 5
Joined: Sun Jun 05, 2011 4:26 pm

pstricks in Beamer

Post by wwli7p »

Trying to use pstricks inside Beamer. I am unable to hide psline and other pscommands while going through a beamer made slide. The ps parts appear right away and when cycling through slide elements the text added to figure appears when the entire figure should be appearing.

I need elements of figure to appear one at a time or the entire pstricks figure to not appear until it is called for in Beamer.

This works in seminar for me, just trying to switch to Beamer but not getting desired results. It is almost as if Beamer and pstricks don't really want to work together.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

5gon12eder
Posts: 126
Joined: Sun Feb 13, 2011 8:36 pm

pstricks in Beamer

Post by 5gon12eder »

I recently did the same thing in beamer without facing any difficulties. Please post an example that shows your problem.

Best
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).
wwli7p
Posts: 5
Joined: Sun Jun 05, 2011 4:26 pm

Re: pstricks in Beamer

Post by wwli7p »

The first page show the first slide for that page. The axis and red vector should not be there. Then then I get up to the point where it should be there and the labels appear.
Attachments
text1_813.pdf
(19.64 KiB) Downloaded 564 times
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

pstricks in Beamer

Post by CrazyHorse »

wwli7p wrote:The first page show the first slide for that page. The axis and red vector should not be there. Then then I get up to the point where it should be there and the labels appear.
the pdf is not interesting! Show your code!
wwli7p
Posts: 5
Joined: Sun Jun 05, 2011 4:26 pm

Re: pstricks in Beamer

Post by wwli7p »

OK, well I am using LEd. I really wish I was using Emacs and a linux machine.


\documentclass[utf8, xcolor=pst, dvips]{beamer}

\mode<presentation>
{
%\usetheme{Warsaw}
% or ...

\setbeamercovered{transparent}
% or whatever (possibly just delete it)
}


\special{! /landplus90 true store}
\usepackage{graphics,graphicx,pstcol,color}
\usepackage{pst-ghsb}
\usepackage{pst-grad}
\usepackage{pstricks}
\usepackage{auto-pst-pdf}
\usepackage{pst-node}
\usepackage{pst-tree}
\usepackage{pst-3d}
\usepackage{pst-text}
\usepackage{pst-coil}
\usepackage{wrapfig}
\usepackage{epsfig}
\usepackage{epstopdf}
\usepackage{amsmath}
\usepackage{msc}


%
% this makes list spacing much better.
%
\newenvironment{sitemize}{
\begin{itemize}
\setlength{\itemsep}{1pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}}{\end{itemize}
}

\begin{document}

%------------------------------------------------------------------------------------------------------------------------

\begin{frame}{Newton's Three Laws of Motion}%{Subtitles are optional.}

\begin{itemize}
\item<1->
"An object at rest or traveling in uniform motion will remain at
rest or traveling in uniform motion unless and until an external force
is applied."
\begin{itemize}
\visible{\item<2-> Uniform motion is defined as constant velocity.}
\uncover{\item<3-> Galileo's principle, The law of inertia.}
\end{itemize}
\item<4->[II] The time rate of change of a body's momentum is directly
proportional to the net force action on it, the direction of the change
in momentum is in the direction of the net force.
\begin{itemize}
\uncover{\item<5->[] {\large
\begin{displaymath}
\vec{F}=\frac{d\vec{p}}{dt}
\end{displaymath}}}
\end{itemize}
\item<6->[III] ``All forces occur in pairs, and these two forces are equal
in magnitude and opposite in direction.''
\begin{itemize}
\uncover{\item<7->[] {\large
\begin{displaymath}
\vec{F}_{12}=-\vec{F}_{21}
\end{displaymath}}}
\end{itemize}
\end{itemize}

\end{frame}
%------------------------------------------------------------------------------------------------------------------------

\begin{frame}{Torque}
\small
We realized with Newton's second law of motion that a force causes an
acceleration. What about angular acceleration? The ability for a force
to cause a rotation or twisting motion depends on three factors.
\pause
%\vspace{-.5cm}
\begin{sitemize}
\pause
\item The magnitude $F$ of the force.
\pause
\item The distance $r$ from the point of application to the pivot.
\pause
\item The angle at which the force is applied.
\end{sitemize}

% begin picture ===================================================
\begin{wrapfigure}[5]{r}[0pt]{4.5cm}
\setlength{\unitlength}{1.0cm}
\begin{pspicture}(-1,-1)(1,1)\thicklines

% lines and arrows of diagram
\psline[linewidth=2pt]{->}(-.5,0)(1.5,0)
\psline[linewidth=2pt]{->}(0,-.5)(0,1.5)


\psline[arrowsize=3pt 2, linewidth=0.06, linecolor=red]{->}(-0.00,0)(1.25,1.25)
%\psline[arrowsize=3pt 2, linewidth=0.06, linecolor=red]{->}(-0.03,0)(1.3,0.0)
%\psline[arrowsize=3pt 2, linewidth=0.06, linecolor=red]{->}(0,-0.03)(0.0,1.3)

% text
\put(-0.1,1.7){y}
\put(1.6,-0.1){x}
\put(0.5,1.0){$\vec{A}$}
%\put(0.5,-0.5){$\vec{A}_x$}
%\put(-0.6,0.75){$\vec{A}_y$}

\end{pspicture}
\end{wrapfigure}
%= end picture ======================================================
\pause
The quantity {\bf Torque}
is defined as
\begin{equation*}
\tau=rF\sin\phi
\end{equation*}
Torque measures the effect of the force at causing an object to rotate
about a pivot, so torque is the {\it rotational} equivalent of force.
The units of torque are $Nm$. Previously we defined
Joules to be $Nm$ but torque is not energy related so we do not
use joules as a measure of torque.

\end{frame}

\end{document}
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

pstricks in Beamer

Post by CrazyHorse »

wwli7p wrote:OK, well I am using LEd. I really wish I was using Emacs and a linux machine.
use it this way:

Code: Select all

\documentclass[utf8, xcolor=pst, dvips]{beamer}
\setbeamercovered{transparent}
\usepackage{pstricks}
\usepackage{wrapfig}
\usepackage{amsmath}
\usepackage{msc}

\begin{document}

\begin{frame}{Torque}\small
We realized with Newton's second law of motion that a force causes an
acceleration. What about angular acceleration? The ability for a force
to cause a rotation or twisting motion depends on three factors.
\pause
%\vspace{-.5cm}
\begin{itemize}[<+->]
\item The magnitude $F$ of the force.
\item The distance $r$ from the point of application to the pivot.
\item The angle at which the force is applied.
\end{itemize}

% begin picture ===================================================
\begin{wrapfigure}[5]{r}[0pt]{4.5cm}
\setlength{\unitlength}{1.0cm}
\begin{pspicture}(-1,-1)(1,1)\thicklines

% lines and arrows of diagram
\only<1-4>{\psline[linewidth=2pt,linecolor=black!20]{->}(-.5,0)(1.5,0)}
\only<1-4>{\psline[linewidth=2pt,linecolor=black!20]{->}(0,-.5)(0,1.5)}
\only<1-4>{\psline[arrowsize=3pt 2, linewidth=0.06, linecolor=red!20]{->}(-0.00,0)(1.25,1.25)}
\only<4->{\psline[linewidth=2pt]{->}(-.5,0)(1.5,0)}
\only<4->{\psline[linewidth=2pt]{->}(0,-.5)(0,1.5)}
\only<4->{\psline[arrowsize=3pt 2, linewidth=0.06, linecolor=red]{->}(-0.00,0)(1.25,1.25)}
\put(-0.1,1.7){y}
\put(1.6,-0.1){x}
\put(0.5,1.0){$\vec{A}$}
\end{pspicture}
\end{wrapfigure}

\pause
The quantity {\bf Torque}
is defined as
\begin{equation*}
\tau=rF\sin\phi
\end{equation*}
Torque measures the effect of the force at causing an object to rotate
about a pivot, so torque is the {\it rotational} equivalent of force.
The units of torque are $Nm$. Previously we defined
Joules to be $Nm$ but torque is not energy related so we do not
use joules as a measure of torque.
\end{frame}

\end{document}
Herbert
wwli7p
Posts: 5
Joined: Sun Jun 05, 2011 4:26 pm

Re: pstricks in Beamer

Post by wwli7p »

It shows up later, but still to early and then the labels show up. So there is something funny going on bedsides the fact it puts it into the bottom left corner of a page. I might just give up on Beamer and move back to seminar, I have too much work written using seminar to start all over with Beamer.
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

pstricks in Beamer

Post by CrazyHorse »

wwli7p wrote:It shows up later, but still to early and then the labels show up. So there is something funny going on bedsides the fact it puts it into the bottom left corner of a page. I might just give up on Beamer and move back to seminar, I have too much work written using seminar to start all over with Beamer.
then use powerdot, it is the successor of seminar ...
5gon12eder
Posts: 126
Joined: Sun Feb 13, 2011 8:36 pm

pstricks in Beamer

Post by 5gon12eder »

I'm still not sure if I understand correctly what you actually want. It would be great if you could try to make your problem "a bit more minimal" and maybe explain better what is your desired result. (Using code tags would also help making it easier to read your code...)

However, building upon Herbert's suggestion, I have made two more examples.

I also made a few changes to your code not directly related to your problem. That is tuning the wrapfigure such that it doesn't overprint the text and throwing out packages that are not needed for this example. I also dropped out the doubled PSTricks elements. What are they good for?

If you want the picture appear all at once after the items are complete, the following might be appropriate:

Code: Select all

\documentclass[utf8, xcolor=pst, dvips]{beamer}
\setbeamercovered{transparent}
\usepackage{pstricks}
\usepackage{wrapfig}

\begin{document}
  \begin{frame}{Torque}\small
    \begin{wrapfigure}{R}{3.1cm}
      \setlength{\unitlength}{1.0cm}
      \begin{pspicture}(-1,-1)(2,2)
        \invisible<-4>
            {
              \psline[linewidth=2pt]{->}(-.5,0)(1.5,0)
              \put(1.6,-0.1){x}
              \psline[linewidth=2pt]{->}(0,-.5)(0,1.5)
              \put(-0.1,1.7){y}
              \psline[arrowsize=3pt 2, linewidth=0.06,linecolor=red]{->}(-0.00,0)(1.25,1.25)
              \put(0.5,1.0){$\vec{A}$}
            }
      \end{pspicture}
    \end{wrapfigure}

    We realized with Newton's second law of motion that a force causes an
    acceleration. What about angular acceleration? The ability for a force
    to cause a rotation or twisting motion depends on three factors.
    \pause

    \begin{itemize}[<+->]
    \item The magnitude $F$ of the force.
    \item The distance $r$ from the point of application to the pivot.
    \item The angle at which the force is applied.
    \end{itemize}
    \pause
    
    The quantity {\bf Torque} is defined as
    \begin{equation*}
      \tau=rF\sin\phi
    \end{equation*}
    Torque measures the effect of the force at causing an object to
    rotate about a pivot, so torque is the {\it rotational} equivalent
    of force.  The units of torque are $Nm$. Previously we defined
    Joules to be $Nm$ but torque is not energy related so we do not
    use joules as a measure of torque.
  \end{frame}
\end{document}
But if you wish one vector to appear after the other together with its respective label, try the following:

Code: Select all

\documentclass[utf8, xcolor=pst, dvips]{beamer}
\setbeamercovered{transparent}
\usepackage{pstricks}
\usepackage{wrapfig}

\begin{document}
  \begin{frame}{Torque}\small
    \begin{wrapfigure}{R}{3.1cm}
      \setlength{\unitlength}{1.0cm}
      \begin{pspicture}(-1,-1)(2,2)
        \invisible<-4>
            {
              \psline[linewidth=2pt]{->}(-.5,0)(1.5,0)
              \put(1.6,-0.1){x}
            }
        \invisible<-5>
            {
              \psline[linewidth=2pt]{->}(0,-.5)(0,1.5)
              \put(-0.1,1.7){y}
            }
        \invisible<-6>
            {
              \psline[arrowsize=3pt 2, linewidth=0.06,linecolor=red]{->}(-0.00,0)(1.25,1.25)
              \put(0.5,1.0){$\vec{A}$}
            }
      \end{pspicture}
    \end{wrapfigure}

    We realized with Newton's second law of motion that a force causes an
    acceleration. What about angular acceleration? The ability for a force
    to cause a rotation or twisting motion depends on three factors.
    \pause

    \begin{itemize}[<+->]
    \item The magnitude $F$ of the force.
    \item The distance $r$ from the point of application to the pivot.
    \item The angle at which the force is applied.
    \end{itemize}

    \uncover<8->
        {    
          The quantity {\bf Torque} is defined as
          \begin{equation*}
            \tau=rF\sin\phi
          \end{equation*}
          Torque measures the effect of the force at causing an object
          to rotate about a pivot, so torque is the {\it rotational}
          equivalent of force.  The units of torque are
          $Nm$. Previously we defined Joules to be $Nm$ but torque is
          not energy related so we do not use joules as a measure of
          torque.
        }
  \end{frame}
\end{document}
Note how I'm using \uncover instead of \pause for the last paragraph.

Please see the beamer user guide for the differences between \pause, \only, \invisible and \uncover.

Hope this helps.

Best

P.S. Please don't forget to mark the thread as solved if you don't need any more help on this issue.
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).
CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

pstricks in Beamer

Post by CrazyHorse »

5gon12eder wrote:I'm still not sure if I understand correctly what you actually want. It would be great if you could try to make your problem "a bit more minimal" and maybe explain better what is your desired result. (Using code tags would also help making it easier to read your code...)
the problem is to have the image also greyed out until it is
visible! And that is not possible with the default commands.

Herbert
Post Reply