以下代码似乎有效(我正在使用 Texmaker 和 MiKTeX):
\documentclass[12pt,letterpaper]{article}
\usepackage{pstricks}
\usepackage{pst-plot}
\begin{document}
\begin{center}
\psset{unit=.4cm}
\begin{pspicture}(-11,-11)(11,11)
\psaxes[Dx=5,Dy=5](0,0)(-11,-11)(11,11)
\psplot[plotstyle=curve,linecolor=red]{-2}{2}{2 x 2 exp mul}
\end{pspicture}
\end{center}
\begin{center}
\psset{unit=.4cm}
\begin{pspicture}(-11,-11)(11,11)
\psaxes[Dx=5,Dy=5](0,0)(-11,-11)(11,11)
\psplot[plotstyle=curve,linecolor=red]{-2}{2}{x 3 exp}
\end{pspicture}
\end{center}
\end{document}
我在一页上得到了两个图表。但是,如果我将 psset 命令更改为 .5cm,以便强制第二张图表出现在第 2 页上,我会收到 MiKTeX 问题报告,如下所示:
MiKTeX Problem Report
Message: Some PostScript specials could not be rendered.
Data: Error: /undefined in tx@Dict
Operand stack:
--nostringval-- PermitFileReading --nostringval-- PermitFileWriting --nostringval--
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval--
2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false
1 %stopped_push 1914 1 3 %oparray_pop 1913 1 3 %oparray_pop
1897 1 3 %oparray_pop 1787 1 3 %oparray_pop --nostringval--
%errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval--
2 %stopped_push --nostringval--
Dictionary stack:
--dict:1166/1684(ro)(G)-- --dict:0/20(G)-- --dict:78/200(L)--
--dict:95/300(L)-- --dict:37/200(L)--
Current allocation mode is local
MiKTeX GPL Ghostscript 9.00: Unrecoverable error, exit code 1
Source: Libraries\MiKTeX\Dvi\Ghostscript.cpp
Line: 372
MiKTeX: 2.9
OS: Microsoft Windows 7 Business Edition, 64-bit Service Pack 1 (build 7601)
Invokers: explorer/texmaker
SystemAdmin: yes
PowerUser: no
Root0: C:\Users\Ken\AppData\Roaming\MiKTeX\2.9
Root1: C:\Users\Ken\AppData\Local\MiKTeX\2.9
Root2: C:\ProgramData\MiKTeX\2.9
Root3: C:\Program Files (x86)\MiKTeX 2.9
UserInstall: C:\Users\Ken\AppData\Roaming\MiKTeX\2.9
UserConfig: C:\Users\Ken\AppData\Roaming\MiKTeX\2.9
UserData: C:\Users\Ken\AppData\Local\MiKTeX\2.9
CommonInstall: C:\Program Files (x86)\MiKTeX 2.9
CommonConfig: C:\ProgramData\MiKTeX\2.9
CommonData: C:\ProgramData\MiKTeX\2.9
我是新手。有人能帮我了解发生了什么吗?
答案1
使用 编译您的 MWE 时我没有遇到任何问题0.5cm
。无论如何,您可以使用algebraic
选项来2*x^2
代替2 x 2 exp mul
。使用\newpage
来获取新页面。并使用figure
来获取文档中的浮动图形。
\documentclass[12pt,letterpaper]{article}
%\usepackage{pstricks}
\usepackage{pst-plot} % loads pstricks automatically
\begin{document}
\begin{figure}
\centering
\psset{unit=.4cm}
\begin{pspicture}(-11,-11)(11,11)
\psaxes[Dx=5,Dy=5](0,0)(-11,-11)(11,11)
\psplot[plotstyle=curve,linecolor=red,algebraic]{-2}{2}{2*x^2}
\end{pspicture}
\caption{Quadratic}
\label{fig:Quadratic}
\end{figure}
\newpage
\begin{figure}
\centering
\psset{unit=.4cm}
\begin{pspicture}(-11,-11)(11,11)
\psaxes[Dx=5,Dy=5](0,0)(-11,-11)(11,11)
\psplot[plotstyle=curve,linecolor=red,algebraic]{-2}{2}{x^3}
\end{pspicture}
\caption{Cubic}
\label{fig:Cubic}
\end{figure}
\end{document}