![从 pst-node 复制,有很多错误,是否有其他具有相同功能的包](https://linux22.com/image/401249/%E4%BB%8E%20pst-node%20%E5%A4%8D%E5%88%B6%EF%BC%8C%E6%9C%89%E5%BE%88%E5%A4%9A%E9%94%99%E8%AF%AF%EF%BC%8C%E6%98%AF%E5%90%A6%E6%9C%89%E5%85%B6%E4%BB%96%E5%85%B7%E6%9C%89%E7%9B%B8%E5%90%8C%E5%8A%9F%E8%83%BD%E7%9A%84%E5%8C%85.png)
%% $Id: pst-node-doc.tex 696 2017-12-30 19:01:07Z herbert $
\documentclass[border=3pt]{standalone}
\listfiles
%
\input{pst-node}
\let\pstFV\fileversion
\usepackage[utf8]{inputenc}
\usepackage{pst-plot}
\let\belowcaptionskip\abovecaptionskip
%
\newcommand\xstrut{\vphantom{\tabular{c}Üg\\Üg\endtabular}}
\newcommand\psBox[3][white]{\rput(#2){\rnode{#2}{%
\psframebox[fillcolor=#1]{\xstrut\makebox[3.2cm]{\tabular{c}#3\endtabular}}}}}
%\def\bgImage{%
\begin{document}
%\psscalebox{0.85}{%
\begin{pspicture}(-1,-1)(21,7)
\psset{framearc=0.2,shadow,fillstyle=solid,shadowcolor=black!55}
\psBox[blue!30]{7,6}{politische\\Kommunikation}
\psBox[red!30]{3,4}{interpersonale\\Kommunikation}
\psBox[red!30]{13,4}{massenmediale\\Kommunikation}
\psBox[green!30]{1,2}{starke\\Beziehung}
\psBox[green!30]{5,2}{schwache\\Beziehung}
\psBox[green!30]{9,2}{Fernsehen}
\psBox[green!30]{17,2}{Zeitungen}
\psBox[cyan!30]{7,0}{öffentlich-rechtl.\\Fernsehen}
\psBox[cyan!30]{11,0}{privates\\Fernsehen}
\psBox[cyan!30]{15,0}{Boulevard-\\Zeitungen}
\psBox[cyan!30]{19,0}{Abonnement-\\Zeitungen}
\end{pspicture}
\psset{shadow=false,angleA=-90,angleB=90,linewidth=2pt}
\ncangles{7,6}{3,4}\ncangles{7,6}{13,4}
\ncangles{3,4}{1,2}\ncangles{3,4}{5,2}
\ncangles{13,4}{9,2}\ncangles{13,4}{17,2}
\ncangles{9,2}{7,0}\ncangles{9,2}{11,0}
\ncangles{17,2}{15,0}\ncangles{17,2}{19,0}
%}
%}
\newbox\filebox
\setbox\filebox=\hbox{%
\pspicture(-1,-.5)(1,.7)
\pspolygon[linearc=2pt,shadow,shadowangle=45,xunit=1.1]%
(-1,-.55)(-1,.5)(-.8,.5)(-.8,.65)(-.2,.65)(-.2,.5)(1,.5)(1,-.55)
\endpspicture}
\end{document}
答案1
\documentclass[border=3pt]{standalone}
\usepackage{pst-node}
\newcommand\xstrut{\vphantom{\tabular{c}Üg\\Üg\endtabular}}
\newcommand\psBox[3][white]{\rput(#2){\rnode{#2}{%
\psframebox[fillcolor=#1]{\xstrut\makebox[3.2cm]{\tabular{c}#3\endtabular}}}}}
\begin{document}
\begin{pspicture}(-1,-1)(21,7)
\psset{framearc=0.2,shadow,fillstyle=solid,shadowcolor=black!55}
\psBox[blue!30]{7,6}{politische\\Kommunikation}
\psBox[red!30]{3,4}{interpersonale\\Kommunikation}
\psBox[red!30]{13,4}{massenmediale\\Kommunikation}
\psBox[green!30]{1,2}{starke\\Beziehung}
\psBox[green!30]{5,2}{schwache\\Beziehung}
\psBox[green!30]{9,2}{Fernsehen}
\psBox[green!30]{17,2}{Zeitungen}
\psBox[cyan!30]{7,0}{öffentlich-rechtl.\\Fernsehen}
\psBox[cyan!30]{11,0}{privates\\Fernsehen}
\psBox[cyan!30]{15,0}{Boulevard-\\Zeitungen}
\psBox[cyan!30]{19,0}{Abonnement-\\Zeitungen}
\end{pspicture}
\psset{shadow=false,angleA=-90,angleB=90,linewidth=2pt}
\ncangles{7,6}{3,4}\ncangles{7,6}{13,4}
\ncangles{3,4}{1,2}\ncangles{3,4}{5,2}
\ncangles{13,4}{9,2}\ncangles{13,4}{17,2}
\ncangles{9,2}{7,0}\ncangles{9,2}{11,0}
\ncangles{17,2}{15,0}\ncangles{17,2}{19,0}
\def\filebox{%
\pspicture(-1,-.5)(1,.7)
\pspolygon[linearc=2pt,shadow,shadowangle=45,xunit=1.1]%
(-1,-.55)(-1,.5)(-.8,.5)(-.8,.65)(-.2,.65)(-.2,.5)(1,.5)(1,-.55)
\endpspicture}
\filebox
\end{document}
答案2
使用psmatrix
可以省去计算每个节点位置的麻烦。我添加了 的简化重新定义\psBox
,使用eqmakebox
命令,该命令用标签替换框的长度参数:所有框的\makebox[tag]
宽度均为最宽内容的自然宽度。最后,我认为在这种图表中,无衬线字体更好。
\documentclass[border=6pt]{standalone}
\usepackage{pst-node}
\usepackage{eqparbox}
%
\newcommand\xstrut{\vphantom{\tabular{c}Üg\\Üg\endtabular}}
\newcommand\psBox[2][white]{\psset{framearc=0.2, linejoin =1, shadow, fillstyle=solid, shadowcolor=black!55}\psframebox[fillcolor=#1]{\xstrut\eqmakebox[F]{\tabular{c}#2\endtabular}}}
%
\def\filebox{%
\pspicture(-1,-.5)(1,.7)
\pspolygon[linearc=2pt,shadow,shadowangle=45,xunit=1.1]%
(-1,-.55)(-1,.5)(-.8,.5)(-.8,.65)(-.2,.65)(-.2,.5)(1,.5)(1,-.55)
\endpspicture}
\begin{document}
\begin{pspicture}(-1,-1)(3,9)
\sffamily
\def\pscolhookiii{\hskip -2cm}
\begin{psmatrix}
[name=B] \psBox[blue!30]{politische\\Kommunikation} \psspan{5} \\
[name=R1] \psBox[red!30]{interpersonale\\Kommunikation} \psspan{2}
& \hskip 2cm \rnode{R2}{\psBox[red!30]{massenmediale\\Kommunikation}} \psspan{3}\\
[name=G1] \psBox[green!30]{starke\\Beziehung}
& [name=G2] \psBox[green!30]{schwache\\Beziehung}
& [name=G3] \psBox[green!30]{Fernsehen} \psspan{2}
& [name=G4] \psBox[green!30]{Zeitungen} \psspan{2} \\
& & [name=C1] \psBox[cyan!30]{öffentlich-rechtl.\\Fernsehen}
& [name=C2] \psBox[cyan!30]{privates\\Fernsehen}
& [name=C3] \psBox[cyan!30]{Boulevard-\\Zeitungen}
& [name=C4] \psBox[cyan!30]{Abonnement-\\Zeitungen}
\end{psmatrix}
\psset{shadow=false, angleA=-90, angleB=90, armA=6mm, linewidth=2pt, linejoin=1}
\foreach \S/\T in {B/R1,B/R2,R1/G1,R1/G2,R2/G3,R2/G4,G3/C1,G3/C2,G4/C3,G4/C4}{\ncangles{\S}{\T}}
\uput*{2.2}[-8](C4){\filebox}
\end{pspicture}
\end{document}