我正在尝试使用 pstricks 构建流程图,代码如下。但是当我编译它时,生成的 PDF 不会显示流程图,而是看起来好像所有信息都叠加在一个非常小的框中。我不知道我的错误在哪里。
\documentclass{article}
\usepackage[pdf]{pstricks}
\usepackage{epsfig}
\usepackage{pst-grad} % For gradients
\usepackage{pst-plot} % For axes
\usepackage{auto-pst-pdf}
\begin{document}
\begin{postscript}
%\psscalebox{1.0 1.0} % Change this value to rescale the drawing.
\begin{pspicture}(0,-7.8)(19.2,7.8)
\psframe[linecolor=black, linewidth=0.04, dimen=outer](14.8,7.8)(9.2,5.8)
\rput[bl](10.0,7.0){Input:}
\psdots[linecolor=black, dotsize=0.08](10.0,6.6)
\rput[bl](10.4,6.6){Load geo.xyz}
\psdots[linecolor=black, dotsize=0.08](10.0,6.2)
\rput[bl](10.4,6.2){Load basis-set, charge, SM}
\psframe[linecolor=black, linewidth=0.04, dimen=outer](6.4,4.6)(0.0,2.6)
\rput[bl](0.8,3.8){Initial guess for orbitals}
\psdots[linecolor=black, dotsize=0.08](1.2,3.4)
\psdots[linecolor=black, dotsize=0.08](1.2,3.0)
\rput[bl](1.6,3.4){Core Hamiltonian (OK)}
\psline[linecolor=black, linewidth=0.04, arrowsize=0.05291666666666667cm 2.0,arrowlength=1.4,arrowinset=0.0]{->}(9.2,6.6)(3.2,6.6)(3.2,4.6)
\rput[bl](1.6,3.0){Huckel Hamiltonian (No)}
\psframe[linecolor=black, linewidth=0.04, dimen=outer](14.8,4.6)(9.2,2.6)
\rput[bl](10.0,3.8){Compute the Fock}
\rput[bl](10.0,3.4){Matrix}
\psline[linecolor=black, linewidth=0.04, arrowsize=0.05291666666666667cm 2.0,arrowlength=1.4,arrowinset=0.0]{->}(12.0,5.8)(12.0,4.6)
\psline[linecolor=black, linewidth=0.04, arrowsize=0.05291666666666667cm 2.0,arrowlength=1.4,arrowinset=0.0]{->}(6.4,3.8)(9.2,3.8)
\psframe[linecolor=black, linewidth=0.04, dimen=outer](14.8,1.4)(9.2,-3.4)
\rput[bl](9.6,0.6){Solve Eigen-system:}
\rput[bl](10.0,-0.2){RHF}
\rput[bl](10.0,-1.8){UHF}
\psline[linecolor=black, linewidth=0.04, arrowsize=0.05291666666666667cm 2.0,arrowlength=1.4,arrowinset=0.0]{->}(12.0,2.6)(12.0,1.4)
\psdiamond[linecolor=black, linewidth=0.04, dimen=outer](12.0,-6.2)(2.8,0.8)
\rput[bl](10.8,-6.2){SCF converged?}
\psline[linecolor=black, linewidth=0.04, arrowsize=0.05291666666666667cm 2.0,arrowlength=1.4,arrowinset=0.0]{->}(12.0,-3.4)(12.0,-5.4)
\psframe[linecolor=black, linewidth=0.04, dimen=outer](19.2,0.6)(15.6,-2.6)
\rput[bl](16.0,-0.2){Updates}
\psdots[linecolor=black, dotsize=0.08](16.4,-1.0)
\rput[bl](16.8,-1.0){Orbitals}
\psdots[linecolor=black, dotsize=0.08](16.4,-2.2)
\rput[bl](16.8,-2.2){Charge density}
\psline[linecolor=black, linewidth=0.04, arrowsize=0.05291666666666667cm 2.0,arrowlength=1.4,arrowinset=0.0]{->}(14.8,-6.2)(17.6,-6.2)(17.6,-2.6)
\psline[linecolor=black, linewidth=0.04, arrowsize=0.05291666666666667cm 2.0,arrowlength=1.4,arrowinset=0.0]{->}(17.6,0.6)(17.6,3.8)(14.8,3.8)
\rput[bl](16.0,-6.2){No}
\psframe[linecolor=black, linewidth=0.04, dimen=outer](6.4,-4.2)(0.0,-7.8)
\rput[bl](0.4,-5.0){Get Post-Hartree-Fock start-up:}
\psline[linecolor=black, linewidth=0.04, arrowsize=0.05291666666666667cm 2.0,arrowlength=1.4,arrowinset=0.0]{->}(9.2,-6.2)(6.4,-6.2)
\rput[bl](7.6,-6.2){Yes}
\end{pspicture}
%}
\end{postscript}
\end{document}
答案1
将其重新缩放到文档的线宽:
\begin{document}
\noindent
\resizebox{\linewidth}{!}{%
\psframebox*[fillstyle=solid,fillcolor=black!10,framesep=10pt]{%
\begin{pspicture}(0,-7.8)(19.2,7.8)
\psframe[linewidth=0.04, dimen=outer](14.8,7.8)(9.2,5.8)
\rput[l](10.0,7.0){\tabular{@{}ll@{}}
\rlap{Input:}\\
\textbullet & Load geo.xyz\\
\textbullet & Load basis-set, charge, SM\endtabular}
\psframe[linewidth=0.04, dimen=outer](6.4,4.6)(0.0,2.6)
\rput[l](0.8,3.8){\tabular{@{}ll@{}}
\rlap{Initial guess for orbitals}\\
\textbullet & Core Hamiltonian (OK)\\
\textbullet & Huckel Hamiltonian (No)\endtabular}
\psline[style=aline]{->}(9.2,6.6)(3.2,6.6)(3.2,4.6)
\psframe[linewidth=0.04, dimen=outer](14.8,4.6)(9.2,2.6)
\rput[bl](10.0,3.8){Compute the Fock}
\rput[bl](10.0,3.4){Matrix}
\psline[style=aline](12.0,5.8)(12.0,4.6)
\psline[style=aline](6.4,3.8)(9.2,3.8)
\psframe[linewidth=0.04, dimen=outer](14.8,1.4)(9.2,-3.4)
\rput[bl](9.6,0.6){Solve Eigen-system:}
\rput[bl](10.0,-0.2){RHF}
\rput[bl](10.0,-1.8){UHF}
\psline[style=aline](12.0,2.6)(12.0,1.4)
\psdiamond[linewidth=0.04, dimen=outer](12.0,-6.2)(2.8,0.8)
\rput[bl](10.8,-6.2){SCF converged?}
\psline[style=aline](12.0,-3.4)(12.0,-5.4)
\psframe[linewidth=0.04, dimen=outer](19.2,0.6)(15.6,-2.6)
\rput[bl](16.0,-0.2){Updates}
\psdots[dotsize=0.08](16.4,-1.0)
\rput[bl](16.8,-1.0){Orbitals}
\psdots[dotsize=0.08](16.4,-2.2)
\rput[bl](16.8,-2.2){Charge density}
\psline[style=aline](14.8,-6.2)(17.6,-6.2)(17.6,-2.6)
\psline[style=aline](17.6,0.6)(17.6,3.8)(14.8,3.8)
\rput[bl](16.0,-6.2){No}
\psframe[linewidth=0.04, dimen=outer](6.4,-4.2)(0.0,-7.8)
\rput[bl](0.4,-5.0){Get Post-Hartree-Fock start-up:}
\psline[style=aline](9.2,-6.2)(6.4,-6.2)
\rput[bl](7.6,-6.2){Yes}
\end{pspicture}%
}}
\end{document}
然而,PSTricks 也知道\psTextFrame
哪些可以让生活变得更轻松......