如何在文章中插入pspicture

如何在文章中插入pspicture

我无法运行以下代码。如何解决。现在我正在使用 Miktex 2.9。和 Winedt。请帮我解决它。

\documentclass[a4paper,12pt]{article}
\usepackage{layout}
\usepackage{lipsum}
\usepackage{amsmath,latexsym,amssymb,amsthm,enumerate}
\usepackage{lscape}
\usepackage{enumerate}
\usepackage{epsfig}
\usepackage{pst-pdf,pst-text,pstricks-add}
\begin{document} \begin{center}
\scalebox{1} % Change this value to rescale the drawing.
{
\begin{pspicture}(0,-1.08)(3.76,1.08)
\psdots[dotsize=0.12](0.06,0.2)
\psdots[dotsize=0.12](0.86,0.2)
\psdots[dotsize=0.12](1.66,0.2)
\psdots[dotsize=0.12](2.48,0.22)
\psdots[dotsize=0.12](3.28,0.2)
\psdots[dotsize=0.12](0.06,-1.0)
\psdots[dotsize=0.12](0.88,-1.0)
\psdots[dotsize=0.12](1.68,-1.0)
\psdots[dotsize=0.12](2.48,-1.0)
\psdots[dotsize=0.12](3.26,-1.0)
\psdots[dotsize=0.12](0.48,1.0)
\psdots[dotsize=0.12](1.28,1.0)
\psdots[dotsize=0.12](2.08,1.0)
\psdots[dotsize=0.12](2.88,1.0)
\psdots[dotsize=0.12](3.68,1.0)
\psline[linewidth=0.02cm](0.04,0.22)(0.04,-0.96)
\psline[linewidth=0.02cm](0.06,-0.98)(1.7,-0.98)
\psline[linewidth=0.02cm](0.86,0.22)(0.86,-1.0)
\psline[linewidth=0.02cm](1.66,0.18)(1.66,-0.94)
\psline[linewidth=0.02cm](0.06,0.24)(0.46,1.0)
\psline[linewidth=0.02cm](0.84,0.26)(0.46,1.06)
\psline[linewidth=0.02cm](0.88,0.22)(1.28,1.02)
\psline[linewidth=0.02cm](1.66,0.22)(1.26,1.06)
\psline[linewidth=0.02cm](1.66,0.24)(2.06,1.04)
\psline[linewidth=0.02cm](2.46,0.24)(2.46,-0.98)
\psline[linewidth=0.02cm](2.46,-0.98)(3.22,-0.98)
\psline[linewidth=0.02cm](3.28,0.24)(3.28,-0.98)
\psline[linewidth=0.02cm](2.48,0.24)(2.88,1.02)
\psline[linewidth=0.02cm](2.86,1.02)(3.28,0.18)
\psline[linewidth=0.02cm](3.68,1.02)(3.28,0.22)
\psline[linewidth=0.02cm](0.46,1.02)(2.06,1.02)
\psline[linewidth=0.02cm](2.86,1.02)(3.68,1.02)
\psline[linewidth=0.02cm,linestyle=dashed,dash=0.16cm 0.16cm](2.08,1.02)(2.84,1.02)
\psline[linewidth=0.02cm,linestyle=dashed,dash=0.16cm 0.16cm](2.08,1.0)(2.44,0.24)
\psline[linewidth=0.02cm,linestyle=dashed,dash=0.16cm 0.16cm](1.7,-1.0)(2.44,-1.0)
\end{pspicture}
}

Figure 1.
\end{center}
\end{document} 

答案1

您可以使用 编译代码pdflatex,只要您在菜单中启用--enable-write18开关即可: Execution ModesOptions在此处输入图片描述

您还必须pdf向文档类添加选项。我利用这个机会使用multido包简化了您的代码。我冒昧地稍微更改了一些看起来奇怪的坐标值,以便能够对点进行编程,而不必一个接一个地对它们进行排版。以下是较短的代码:

\documentclass[a4paper,pdf, 12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{caption}
\usepackage{pst-text,pstricks-add}

\begin{document}

\begin{figure}
    \centering
    %\scalebox{1}{ % Change this value to rescale the drawing.
    \begin{pspicture}(0,-1.08)(3.76,1.08)
        \psset{dotsize=0.12,linewidth=0.02cm}
        \multido{\n=0.06+0.80,\N = 0.48 + 0.80,\i =1 +1}{5}
        {\dotnodes(\n, 0.2){A\i}(\n, -1.0){B\i}
            \dotnodes(\N, 1.0){C\i}
            \psline(B\i)(A\i)(C\i)
        }
        \psline(A2)(C1)(C3)\psline(A5)(C4)(C5)\psline(A3)(C2)
        \psline(B1)(B3)\psline(B4)(B5)
        \psset{linestyle=dashed,dash=0.16cm 0.16cm}
        \psline(A4)(C3)(C4)
        \psline(B3)(B4)
    \end{pspicture}
    %}
    \caption{}
\end{figure}
\end{document} 

在此处输入图片描述

相关内容