如何在 PSTricks 中添加图像作为背景?

如何在 PSTricks 中添加图像作为背景?

官方图片。

在此处输入图片描述

这是我的代码。

\documentclass[pstricks,border=10pt]{standalone}
\usepackage{pstricks-add,pst-node,pst-tools}
\usepackage{graphicx}
\begin{document}
    \begin{pspicture}[showgrid](0,-7)(12,1)
\sffamily
\psRegisterList{Name}{M,A,T,H,E,M,A,T,I,C,S}
\psRegisterList{Color}{red!90,yellow!80,blue!70,green!60,cyan!50,pink}
%%%
\psRegisterList{lefttext}{Matrix theory,Algebra,Trigonometry,Hilbert space,Ergodicity,}
\psRegisterList{righttext}{Analysic,Topology,Integration,,Set theory}
%%%%
\multido{\iA=1+1}{11}{\rput(\iA,0){\psDefBoxNodes{Label\iA}{\color{black} \LARGE \Name{\iA}}}}
\multido{\iA=1+1,%
         \rA=4+-0.5,
         \rB=-5.5+.75,
         \rC=0.5+-0.1,
         \rD=2+-0.25}{6}{%
    \psline[linewidth=\rA pt,
            arrowscale=\rD,
            linecolor=\Color{\iA}]{-*}(Label\iA:bC|0,-.3)(Label\iA:bC|0,\rB)
    \uput{\rC}[-85](Label\iA:bC|0,\rB){\lefttext\iA}}
\uput{.55}[-90](Label6:bC|0,-1.25){\shortstack{Measure\\theory}}
%%%%%%%%%%%%%
\multido{\iA=11+-1,\iB=5+-1,\iC=1+1,%
         \rA=4+-0.5,
         \rB=-5.5+0.75,
         \rC=0.5+-0.1,
         \rD=2+-0.25}{5}{%
    \psline[linewidth=\rA pt,
            arrowscale=\rD,
            linecolor=\Color{\iC}]{-*}(Label\iA:bC|0,-.3)(Label\iA:bC|0,\rB)
    \uput{\rC}[-85](Label\iA:bC|0,\rB){\righttext\iB}}
\uput{.4}[-90](Label10:bC|0,-4.75){\shortstack{Complex\\number}}
    \end{pspicture}
\end{document}

输出

在此处输入图片描述

问题:

如何插入图像(任何格式)background?这意味着对于任何图像,它将是clippedreduce the size of image until it is true(例如:它看起来像frame (0,-7)(12,1)

我看过这个链接使用 TikZ 在图像上绘图但我不能使用该语法。

注意:如果您想说一些新的东西,您可以重现我的代码!

完毕!

\documentclass[border=10pt]{standalone}
\usepackage{pst-node,pst-tools,pst-fun}
\usepackage{graphicx}
\begin{document}
    \begin{pspicture}(0,-7)(12,1)
\rput[lb](0,-7){\includegraphics[width=12cm,height=8cm]{anht.jpg}}
\sffamily
\psRegisterList{Name}{M,A,T,H,E,M,A,T,I,C,S}
\psRegisterList{Color}{red!90,yellow!80,blue!70,green,orange,pink}
%%%
\psRegisterList{lefttext}{Matrix theory,Algebra,Trigonometry,Hilbert space,Ergodicity,}
\psRegisterList{righttext}{Analysic,Topology,Integration,,Set theory}
%%%%
\multido{\iA=1+1}{11}{\rput(\iA,0){\psDefBoxNodes{Label\iA}{\color{white} \LARGE \Name{\iA}}}}
\multido{\iA=1+1,%
         \rA=4+-0.5,
         \rB=-5.5+.75,
         \rC=0.5+-0.1,
         \rD=2+-0.25}{6}{%
    \psline[linewidth=\rA pt,
            arrowscale=\rD,
            linecolor=\Color{\iA}]{-*}(Label\iA:bC|0,-.3)(Label\iA:bC|0,\rB)
    \uput{\rC}[-85](Label\iA:bC|0,\rB){\color{\Color{\iA}}\lefttext\iA}}
\uput{.55}[-90](Label6:bC|0,-1.25){\color{\Color{3}}\shortstack{Measure\\theory}}
%%%%%%%%%%%%%
\multido{\iA=11+-1,\iB=5+-1,\iC=1+1,%
         \rA=4+-0.5,
         \rB=-5.5+0.75,
         \rC=0.5+-0.1,
         \rD=2+-0.25}{5}{%
    \psline[linewidth=\rA pt,
            arrowscale=\rD,
            linecolor=\Color{\iC}]{-*}(Label\iA:bC|0,-.3)(Label\iA:bC|0,\rB)
    \uput{\rC}[-85](Label\iA:bC|0,\rB){\color{\Color{\iC}}\righttext\iB}}
\uput{.4}[-90](Label10:bC|0,-4.75){\color{\Color{2}}\shortstack{Complex\\number}}
    \end{pspicture}
\end{document}

图像位于此链接

我的代码是用 编译的xelatex very slow

在此处输入图片描述

答案1

使用

\begin{pspicture}[showgrid](0,-7)(12,1)
\rput[lb](0,-7){\includegraphics[width=12cm,height=8cm]{tiger}}
[...]

在此处输入图片描述

\documentclass[border=10pt]{standalone}
\usepackage{pst-node,pst-tools,multido}
\usepackage{graphicx}
\begin{document}
\psRegisterList{Name}{M,A,T,H,E,M,A,T,I,C,S}%
\psRegisterList{Color}{red!90,yellow!80,blue!70,green,orange,pink}%
%%%
\psRegisterList{lefttext}{Matrix theory,Algebra,Trigonometry,Hilbert space,Ergodicity,}%
\psRegisterList{righttext}{Analysic,Topology,Integration,,Set theory}%

\begin{pspicture}(0,-7)(12,1)
\rput[lb](0,-7){\includegraphics[width=12cm,height=8cm]{Downloads/test.jpg}}
\sffamily
%%%%
\multido{\iA=1+1}{11}{\rput(\iA,0){\rnode{C\iA}{\color{white}\LARGE\Name{\iA}}}}
\multido{\iA=1+1,%
         \rA=4+-0.5,
         \rB=-5.5+.75,
         \rC=0.5+-0.1,
         \rD=2+-0.25}{6}{%
    \psline[linewidth=\rA pt,
           arrowscale=\rD,
           linecolor=\Color{\iA}]{-*}(C\iA|0,-.3)(C\iA|0,\rB)
    \uput{\rC}[-85](C\iA|0,\rB){\color{\Color{\iA}}\lefttext\iA}}%
    \uput{.55}[-90](C6|0,-1.25){\color{\Color{3}}\shortstack{Measure\\theory}}
%%%%%%%%%%%%%
\multido{\iA=11+-1,\iB=5+-1,\iC=1+1,%
         \rA=4+-0.5,
         \rB=-5.5+0.75,
         \rC=0.5+-0.1,
         \rD=2+-0.25}{5}{%
    \psline[linewidth=\rA pt,
            arrowscale=\rD,
            linecolor=\Color{\iC}]{-*}(C\iA|0,-.3)(C\iA|0,\rB)
    \uput{\rC}[-85](C\iA|0,\rB){\color{\Color{\iC}}\righttext\iB}}
    \uput{.4}[-90](C9|0,-4.75){\color{\Color{2}}\shortstack{Complex\\number}}
\end{pspicture}
\end{document}

在此处输入图片描述

一般情况下你只需要 \multido

\documentclass[border=10pt]{standalone}
\usepackage{pst-node,pst-tools,multido,xfp}
\usepackage{graphicx}

\begin{document}
\psRegisterList{Name}{M,A,T,H,E,M,A,T,I,C,S}%
\psRegisterList{Color}{red!90,yellow!80,blue!70,green,orange,pink,orange,green,blue!70,yellow!80,red!90}%
\psRegisterList{Text}{Matrix theory,Algebra,Trigonometry,
  Hilbert space,Ergodicity,,Analysic,Topology,Integration,,Set theory}

\begin{pspicture}(0,-7)(12,1)
\rput[lb](0,-7){\includegraphics[width=12cm,height=8cm]{Downloads/test.jpg}}
\sffamily
%%%%
\multido{\iA=1+1,\rA=-3.75+0.75}{11}{%
  \rput(\iA,0){\rnode{A\iA}{\color{white}\LARGE\Name{\iA}}}
  \pnode(!\iA\space \rA\space dup 0 gt {neg} if 1 sub){B\iA}
  \pcline[nodesepA=10pt,linewidth=\fpeval{abs(\rA)}pt,arrowscale=2,
           linecolor=\Color{\iA}]{-*}(A\iA)(B\iA)
  \uput{.4}[-85](B\iA){\color{\Color{\iA}}\Text\iA}}
% 
\uput{.4}[-90](B10){\color{\Color{10}}\shortstack{Complex\\number}}
\uput{.4}[-90](B6){\color{\Color{6}}\shortstack{Measure\\theory}}
\end{pspicture}
\end{document}

这也应该有效:

\psRegisterList{Text}{Matrix theory, Algebra, Trigonometry,
        Hilbert space, Ergodicity, Measure\cr theory, Analysic,
        Topology,Integration, Complex\cr number, Set theory}

进而

    \uput{.4}[-85](B\iA){\color{\Color{\iA}}\shortstack{\Text\iA}}}

答案2

显然,我没有你的背景图片,所以我使用了一个有点类似的 eps 图片,并将其放入

\rput(6,-3){\includegraphics{Galaxie.eps}}

这得出

\documentclass[pstricks,border=10pt]{standalone}
\usepackage{pstricks-add,pst-node,pst-tools}
\usepackage{graphicx}
\begin{document}
    \begin{pspicture}[showgrid](0,-7)(12,1)
     \rput(6,-3){\includegraphics{Galaxie.eps}}
\sffamily
\psRegisterList{Name}{M,A,T,H,E,M,A,T,I,C,S}
\psRegisterList{Color}{red!90,yellow!80,blue!70,green!60,cyan!50,pink}
%%%
\psRegisterList{lefttext}{Matrix theory,Algebra,Trigonometry,Hilbert space,Ergodicity,}
\psRegisterList{righttext}{Analysic,Topology,Integration,,Set theory}
%%%%
\multido{\iA=1+1}{11}{\rput(\iA,0){\psDefBoxNodes{Label\iA}{\color{black} \LARGE \Name{\iA}}}}
\multido{\iA=1+1,%
         \rA=4+-0.5,
         \rB=-5.5+.75,
         \rC=0.5+-0.1,
         \rD=2+-0.25}{6}{%
    \psline[linewidth=\rA pt,
            arrowscale=\rD,
            linecolor=\Color{\iA}]{-*}(Label\iA:bC|0,-.3)(Label\iA:bC|0,\rB)
    \uput{\rC}[-85](Label\iA:bC|0,\rB){\lefttext\iA}}
\uput{.55}[-90](Label6:bC|0,-1.25){\shortstack{Measure\\theory}}
%%%%%%%%%%%%%
\multido{\iA=11+-1,\iB=5+-1,\iC=1+1,%
         \rA=4+-0.5,
         \rB=-5.5+0.75,
         \rC=0.5+-0.1,
         \rD=2+-0.25}{5}{%
    \psline[linewidth=\rA pt,
            arrowscale=\rD,
            linecolor=\Color{\iC}]{-*}(Label\iA:bC|0,-.3)(Label\iA:bC|0,\rB)
    \uput{\rC}[-85](Label\iA:bC|0,\rB){\righttext\iB}}
\uput{.4}[-90](Label10:bC|0,-4.75){\shortstack{Complex\\number}}
    \end{pspicture}
\end{document}

在此处输入图片描述

当然,您可以调整背景图片的宽度和高度。

相关内容