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.

In order to display simple figure, I began to learn pstricks package. I copied a piece of sample code to a beamer file. When I compile it, something goes wrong. How can I fix it? Process latex->dvips->ps2pdf does not work,neither with xelatex, who can help me?

Here is the code:

\documentclass{beamer}
\usepackage{xeCJK}
\usepackage{tikz}
\usepackage{pstricks}
\setCJKmainfont{SimSun}
\setbeamertemplate{items}[square]
%\setbeamerfont{title}{WenQuanYi Zen Hei Mono}
%\setbeamercolor{title}{green}

\usetheme{CambridgeUS}
\setbeamertemplate{navigation symbols}{}
\begin{document}

\title{moumou专题}
\author{author}
\institute{moumou@gmail.com}
\date{2013-07-22}

\begin{frame}
\titlepage
\end{frame}

\begin{frame}[t]
%\tiny
\scriptsize
在平面直角坐标系$xoy$中,点B与点$\text{A}(-1,1)$关于原点O对称,P是动点,且直线AP与BP的斜率之积等于$-\dfrac{1}{3}$.\\
%\begin{enumerate}
%    \item 求动点P的轨迹方程;
%    \item 设直线AP和BP分别与直线$x=3$交于点M,N,问:是否存在点P使得$\bigtriangleup\text{PAB}$与$\bigtriangleup\text{PMN}$的面积相等?若存在,求出点P的坐标;若不存在,说明理由.
(I)求动点P的轨迹方程;\\
(II)设直线AP和BP分别与直线$x=3$交于点M,N,问:是否存在点P使得$\bigtriangleup\text{PAB}$与$\bigtriangleup\text{PMN}$的面积相等?若存在,求出点P的坐标;若不存在,说明理由.
%\end{enumerate}


\begin{tikzpicture}
\draw (0,0) -- (0,2) -- (2,0)-- (0,0);
\end{tikzpicture}
\end{frame}

\begin{frame}[t]
\begin{tikzpicture}
\draw (0,0) -- (0,2) -- (2,0)-- (0,0);
\end{tikzpicture}
\end{frame}

\begin{frame}[t]
\begin{tikzpicture}[domain=0:2]
\draw[thick,color=gray,step=.5cm,
dashed] (-0.5,-.5) grid (3,3);
\draw[->] (-1,0) -- (3.5,0)
node[below right] {$x$};
\draw[->] (0,-1) -- (0,3.5)
node[left] {$y$};
\draw plot[id=x] function{x*x};
\end{tikzpicture}

\end{frame}

\begin{frame}
\begin{pspicture}(0,0)(5,2)
\psline[linecolor=blue](1,1)(2,2)(3,1)(4,2)(5,1)
\psline[linearc=0.5,linecolor=red](1,1)(2,2)(3,1)(4,2)(5,1)
\end{pspicture}
\end{fram}


\end{document}

Here is the compiling information screenshot: compiling information

share|improve this question
    
Have you tried adding the fragile option to your frames? –  Juri Robl Jul 24 '13 at 9:41
    
Whether I add the fragile it seems no difference for the below Herbert's smaple code.Thank you anyway.It works now. –  nyRobot Jul 25 '13 at 1:35

1 Answer 1

up vote 1 down vote accepted
  • Do not use two extensions for the data file. Use something like ps-beamer-x.table
  • Use [t,fragile] as optional argument for the frame with enumerate

my output with `xelatex':

enter image description here

\documentclass{beamer}
\usepackage{xeCJK}
\usepackage{tikz}
\usepackage{pstricks}
\setCJKmainfont{SimSun}
\setbeamertemplate{items}[square]
%\setbeamerfont{title}{WenQuanYi Zen Hei Mono}
%\setbeamercolor{title}{green}

\usetheme{CambridgeUS}
\setbeamertemplate{navigation symbols}{}
\begin{document}

\title{moumou专题}
\author{author}
\institute{moumou@gmail.com}
\date{2013-07-22}

\begin{frame}
\titlepage
\end{frame}

\begin{frame}[t,fragile]
%\tiny
\scriptsize
在平面直角坐标系$xoy$中,点B与点$\text{A}(-1,1)$关于原点O对称,P是动点,且直线AP与BP的斜率之积等于$-\dfrac{1}{3}$.\\
\begin{enumerate}
    \item 求动点P的轨迹方程;
    \item 设直线AP和BP分别与直线$x=3$交于点M,N,问:是否存在点P使得$\bigtriangleup\text{PAB}$与$\bigtriangleup\text{PMN}$的面积相等?若存在,求出点P的坐标;若不存在,说明理由.
(I)求动点P的轨迹方程;\\
(II)设直线AP和BP分别与直线$x=3$交于点M,N,问:是否存在点P使得$\bigtriangleup\text{PAB}$与$\bigtriangleup\text{PMN}$的面积相等?若存在,求出点P的坐标;若不存在,说明理由.
\end{enumerate}


\begin{tikzpicture}
\draw (0,0) -- (0,2) -- (2,0)-- (0,0);
\end{tikzpicture}
\end{frame}

\begin{frame}
\begin{tikzpicture}
\draw (0,0) -- (0,2) -- (2,0)-- (0,0);
\end{tikzpicture}
\end{frame}

\begin{frame}
\begin{tikzpicture}[domain=0:2]
\draw[thick,color=gray,step=.5cm,
dashed] (-0.5,-.5) grid (3,3);
\draw[->] (-1,0) -- (3.5,0)
node[below right] {$x$};
\draw[->] (0,-1) -- (0,3.5)
node[left] {$y$};
\draw plot[id=x] function{x*x};
\end{tikzpicture}

\end{frame}

\begin{frame}
\begin{pspicture}(0,0)(5,2)
\psline[linecolor=blue](1,1)(2,2)(3,1)(4,2)(5,1)
\psline[linearc=0.5,linecolor=red](1,1)(2,2)(3,1)(4,2)(5,1)
\end{pspicture}
\end{frame}

\end{document}
share|improve this answer
    
Would you please give much more details?I am new to xelatex,I even do not know ps-beamer-x.table,and how to use [t,fragile]?I always learn xelatex by reading sample code.Would you please show me some code? –  nyRobot Jul 24 '13 at 13:25
    
Instead of \begin{frame}[t] use \begin{frame}[t,fragile]. Your logfile shows that a data file wasn't found (see above)! And that one has two dots in the filename which maybe another problem. –  Herbert Jul 24 '13 at 13:27
    
Thanks for you quick respond!I modified the code,and I do not see the difference after adding "fragile" to that frame,I think there maybe something else goes wrong.I know how to draw figure using pure English beamer file.But When I typeset Chinses and English the compilation informations come out. –  nyRobot Jul 24 '13 at 13:35
    
I have no problem with your example. See my edit –  Herbert Jul 24 '13 at 17:31
    
Thank you very much.I commented the item environment.It also works,I prefer to display a plain page,I do not like the default marker.There are lots of details for me to learn ,such as the inner,outer,color themes. –  nyRobot Jul 25 '13 at 1:28

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.