2

I want to plot graph without using tikzpictures .

I have tried this

\documentclass{beamer}
\usepackage{pstricks}
\usepackage{pst-plot,pst-math}
\title{Assignment}
\author{student}
\date{\today}
\begin{document}
\begin{pspicture}(-0.25,-4.25)(7.5,4.25)
\psset{xunit=3cm,yunit=3cm}
\psaxes{->}(0,0)(0,-1.25)(2.25,1.25)
\psplot[plotpoints=2500]{0.025}{2}{1 x div RadtoDeg sin}
\put(7,-0.5){$x$}
\put(-0.5,4){$y$}
\put(3,3){$y=\sin\frac{1}{x}$}
\end{pspicture}
\end{document}

But it is not running.

Edited part


\documentclass[pstricks,12pt,border=12pt]{standalone}
    \usepackage{pst-plot}
    \begin{document}
    \begin{pspicture}[algebraic](-0.5,-1.25)(3.75,1.5)
    \psaxes{->}(0,0)(-0.25,-1.25)(3.5,1.25)[$x$,-90][$y$,0]
    \psplot[plotpoints=1000,linecolor=red]{0.025}{3}{sin(1/x)}
    \put(1.5,.75){$y=\sin\left(\frac{1}{x}\right)$}
    \end{pspicture}
    \end{document}

4
  • edited.still it is not running .
    – Unknown
    May 23, 2020 at 11:20
  • I am using winedt10. I am not getting this option.
    – Unknown
    May 23, 2020 at 11:47
  • Actually this is my assignment problem. I am not familiar with TeXnicCenter. Although I used tikzpicture in Winedt then it runs.
    – Unknown
    May 23, 2020 at 11:51
  • But i have to run it on winedt.
    – Unknown
    May 23, 2020 at 11:56

1 Answer 1

1

Compile with latex->dvips->ps2pdf.

\documentclass[pstricks,12pt,border=12pt]{standalone}
\usepackage{pst-plot}
\begin{document}
\begin{pspicture}[algebraic](-0.5,-1.25)(3.75,1.5)
\psaxes{->}(0,0)(-0.25,-1.25)(3.5,1.25)[$x$,-90][$y$,0]
\psplot[plotpoints=1000,linecolor=red]{0.025}{3}{sin(1/x)}
\put(1.5,.75){$y=\sin\left(\frac{1}{x}\right)$}
\end{pspicture}
\end{document}

enter image description here

Having obtained the PDF output, you now ready to import it from within your presentation. Compile it with pdflatex.

\documentclass{beamer}
\usepackage{graphicx}
\usepackage{amsmath}
\begin{document}
\begin{frame}{The graph of $y=\sin\left(\tfrac{1}{x}\right)$}
    \begin{center}
        \includegraphics{yourgraphfilename}
    \end{center}
\end{frame}
\end{document}

Edit

You need to configure your editor to invoke the following batch file named combo.bat. It needs your input file without extension. Make sure you have 64-bit ghostscript installed on your machine. The path of ghostscript must be register in PATH.

rem this batch filename is combo.bat
rem %1 TeX input filename without extension

rem needs -t unknown
echo off

if exist "%~1.pdf" del "%~1.pdf"

if exist "%~1.tex" latex -shell-escape "%~1.tex"

if exist "%~1.dvi" dvips -t unknown "%~1.dvi"

if exist "%~1.ps" gswin64c -dCompatibilityLevel=1.5 -dAutoRotatePages=/None -sDEVICE=pdfwrite -o "%~1.pdf" "%~1.ps"

for %%x in (aux dvi log out ps toc nav snm) do (if exist "%~1.%%x" del "%~1.%%x")
7
  • I used but shows Undefined control sequence
    – Unknown
    May 23, 2020 at 11:40
  • I am using Winedit 10
    – Unknown
    May 23, 2020 at 11:40
  • Are you compiling with latex, not pdflatex?
    – Bernard
    May 23, 2020 at 12:58
  • Personally, I do it via xelatex, and your edited part compiles normally.
    – Bernard
    May 23, 2020 at 13:12
  • Yes, but on my system, I have problems with ps2pdf and dvipdf and I don't have time to look into what happens.
    – Bernard
    May 23, 2020 at 13:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .