编辑

编辑

我想绘制图形而不使用tikz图片

我试过

\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}

但它没有运行。

编辑部分


\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}

答案1

用 编译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}

在此处输入图片描述

获得 PDF 输出后,您现在可以从演示文稿中导入它。使用 进行编译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}

编辑

您需要配置编辑器以调用名为的以下批处理文件combo.bat。它需要您的输入文件(不带扩展名)。确保您的机器上安装了 64 位。必须在中注册ghostscript的路径。ghostscriptPATH

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")

相关内容