在 PSTricks 中绘制图形

在 PSTricks 中绘制图形
\documentclass[a4paper,12pt,twoside]{report}
\usepackage{filecontents,amsfonts,amsmath,amssymb,blkarray,multirow,graphics,amsthm,varioref,mathrsfs,amscd,amsopn,epsfig,fancyhdr,latexsym,makeidx,enumerate,titlesec,supertabular}


\begin{document}
\begin{figure}[ht]
\begin{pspicture}(3,2.5)
%\psgrid[subgriddiv=1,griddots=10,gridlabels=10pt](0,0)(12,3)
\rput(3,0){

\psellipse(2,2)(1,.5)
\pscircle(2,1){.5}
\psdot(2,1.5)
\psdot(3,2)
\psdot(6,1.5)
\rput(2.75,2){$v_2$}
\rput(1.6,2.2){$G$}
\rput(2,1.7){$v_1$}
\rput(2,1.3){$u$}

\rput(2,.75){$H$}
\psellipse(6,2)(1,.5)
\pscircle(7.5,2){.5}
\psdot(7,2)

\rput(6.76,2){$v_2$}
\rput(5.6,2.2){$G$}
\rput(6,1.7){$v_1$}
\rput(7.2,2){$u$}


\rput(2,0){$G_1$}
\rput(6.5,1){$G_2$}
\rput(7.8,2){$H$}
}
\end{pspicture}
\caption{The graph $G_2$ is obtained from $G_1$ by relocating the branch $H$ at $u$ from $v_1$ to 
$v_2$.}\label{relocate-fig}
\end{figure}

\end{document}

我正在尝试运行此代码,但没有结果。请帮忙。可能需要合适的包,但我没有得到。请帮忙。输出应该是这样的:在此处输入图片描述

答案1

代替

\usepackage{filecontents,amsfonts,amsmath,amssymb,blkarray,multirow,graphics,amsthm,varioref,mathrsfs,amscd,amsopn,epsfig,fancyhdr,latexsym,makeidx,enumerate,titlesec,supertabular}

经过

\usepackage{pstricks}

因此pstricks已加载(这里不需要其他任何包,也不epsfig应该使用它们,它用于模拟 20 世纪 80 年代的 LaTeX2.09 文档)

然后运行latex(不是 pdflatex),dvips生成ps2pdf -dALLOWPSTRANSPARENCY的文档是

在此处输入图片描述

答案2

\documentclass[a4paper,12pt,twoside]{report}
\usepackage{pstricks}

\begin{document}

\begin{pspicture}(1,-0.5)(8,2.5)
\psellipse(2,2)(1,.5)
\pscircle(2,1){.5}
\psdots(2,1.5)(3,2)(6,1.5)(7,2)
\uput[180](3,2){$v_2$}
\rput(1.6,2.2){$G$}
\uput[90](2,1.5){$v_1$}
\uput[-90](2,1.5){$u$}

\rput(2,.75){$H$}
\psellipse(6,2)(1,.5)
\pscircle(7.5,2){.5}

\uput[180](7,2){$v_2$}
\rput(5.6,2.2){$G$}
\uput[90](6,1.5){$v_1$}
\uput[0](7,2){$u$}

\rput(2,0){$G_1$}
\rput(6.5,1){$G_2$}
\rput(7.8,2){$H$}
\end{pspicture}

\end{document}

在此处输入图片描述

相关内容