如何控制 psmatrix 图中诊断框(带有长文本)的大小?

如何控制 psmatrix 图中诊断框(带有长文本)的大小?

对我来说问题是从底部开始的第 4 行和第 5 行

(代码来自 Herbert 的示例,问题是我尝试添加东西的地方;-))

\usepackage{amsmath,amsfonts,amssymb,latexsym}

\usepackage{pst-node}
\usepackage{pst-blur}


%\input{pssettings.tex}
\begin{document}
\psset{framearc=0.2,shadowcolor=black!70,shadowangle=-90}‎
\begin{psmatrix}[rowsep=1.75,colsep=1.5]% defines the distance between two frames
    \psframe[fillcolor=lightgray,linestyle=none,blur,shadow](-1.00,-1.00)(1.00,1.00)
    \cnode[fillstyle=solid,fillcolor=blue](0,0){0.15}{Current}
    & [name=SA] Solución Actual\\
    \psframe[fillcolor=lightgray,linestyle=none,shadow,blur](-1.00,-1.00)(1.00,1.00)
    \cnode[fillstyle=solid,fillcolor=blue](0,0){0.15}{Current}
    \cnode[fillstyle=solid,fillcolor=pink](-0.75,0.75){0.15}{Current}
    \cnode[fillstyle=solid,fillcolor=pink](0,0.65){0.15}{Current}
    \cnode[fillstyle=solid,fillcolor=pink](0.75,0.75){0.15}{Current}
    \cnode[fillstyle=solid,fillcolor=pink](-0.75,0.15){0.15}{Current}
    \cnode[fillstyle=solid,fillcolor=pink](0.65,0.15){0.15}{Current}
    \cnode[fillstyle=solid,fillcolor=pink](-0.75,0.75){0.15}{Current}
    & [name=SS] Generar Vecindad\\
    \psframe[fillcolor=lightgray,linestyle=none,shadow,blur](-1.00,-1.00)(1.00,1.00)
    \cnode[fillstyle=solid,fillcolor=pink](1,1){0.20}{Current}
    \cnode[fillstyle=solid,fillcolor=blue](0,0){0.20}{Current}
    \psline[linewidth=0.2]{->}(1,1)(0.5,0.5)
    & Elegir Mejor Vecino\\
    \psdiabox[shadow=true]{¿Is in the house of Mary?}
    &\psdiabox[shadow=true]{¿Is in the house of King?}& \\
    }}&
\end{psmatrix}
\end{document}

答案1

使用shortstack{...\\...}。我还将您的圆圈节点更改为默认圆圈:

\documentclass{article}
\usepackage{pst-node}
\usepackage{pst-blur}

\newpsobject{BDisk}{pscircle}{fillstyle=solid,fillcolor=blue}
\newpsobject{PDisk}{pscircle}{fillstyle=solid,fillcolor=pink}

%\input{pssettings.tex}
\begin{document}
\psset{framearc=0.2,shadowcolor=black!70,shadowangle=-90}‎
\begin{psmatrix}[rowsep=1.75,colsep=1.5]% defines the distance between two frames
    \psframe[fillcolor=lightgray,linestyle=none,blur,shadow](-1.00,-1.00)(1.00,1.00)
    \BDisk[fillstyle=solid,fillcolor=blue](0,0){0.15}
    & [name=SA] Solución Actual\\
    \psframe[fillcolor=lightgray,linestyle=none,shadow,blur](-1.00,-1.00)(1.00,1.00)
    \BDisk(0,0){0.15}
    \PDisk(-0.75,0.75){0.15}
    \PDisk(0,0.65){0.15}
    \PDisk(0.75,0.75){0.15}
    \PDisk(-0.75,0.15){0.15}
    \PDisk(0.65,0.15){0.15}
    \PDisk(-0.75,0.75){0.15}
    & [name=SS] Generar Vecindad\\
    \psframe[fillcolor=lightgray,linestyle=none,shadow,blur](-1.00,-1.00)(1.00,1.00)
    \PDisk(1,1){0.20}
    \BDisk(0,0){0.20}
    \psline[linewidth=0.2]{->}(1,1)(0.5,0.5)
    & Elegir Mejor Vecino\\
    \psdiabox[shadow=true]{\shortstack{¿Is in the house\\ of Mary?}}
    &\psdiabox[shadow=true]{\shortstack{¿Is in the house\\ of King?}}& \\
\end{psmatrix}
\end{document}

在此处输入图片描述

答案2

此代码是否满足您的要求?我将 dianodes 的内容放在 中\parbox。此外,最后一列中的文本左对齐,同时相对于 King 的 \dianode 居中。

     \documentclass[12pt,a4paper]{article}

    \usepackage[utf8]{inputenc}
    \usepackage{lmodern}
    \usepackage[T1]{fontenc}
    \usepackage{lmodern}
    \usepackage{amsmath,amsfonts,amssymb,latexsym}
    \usepackage[pdf, x11names]{pstricks}%
    \usepackage{pst-node}
    \usepackage{pst-blur}
    \usepackage[margin = 1.5cm, nomarginpar]{geometry}
    \usepackage{graphicx}
    \newlength{\mylen}
    \settowidth{\mylen}{Elegir Mejor Vecino}

    \newpsobject{cnodeblue}{cnode}{fillstyle=solid,fillcolor=blue}
    \newpsobject{cnodepink}{cnode}{fillstyle=solid,fillcolor=pink}
    \newpsobject{cnodegreen}{cnode}{fillstyle=solid,fillcolor=green}
    \newpsobject{psframegray}{psframe}{fillcolor=lightgray,linestyle=none,shadow,blur}

\begin{document}
\psset{framearc=0.2, shadowcolor=black!70!, shadowangle = -90}
\begin{psmatrix}[rowsep=1.75,colsep=1.5]% defines the distance between two frames
    \psframegray(-1.00,-1.00)(1.00,1.00)
    \cnodeblue(0,0){0.15}{Current}
    & [name=SA] \parbox{\mylen}{Solución Actual} \\
    \psframegray(-1.00,-1.00)(1.00,1.00)
    \cnodeblue(0,0){0.15}{Current}
    \cnodepink(-0.75,0.75){0.15}{Current}
    \cnodepink(0,0.65){0.15}{Current}
    \cnodepink(0.75,0.75){0.15}{Current}
    \cnodepink(-0.75,0.15){0.15}{Current}
    \cnodepink(0.65,0.15){0.15}{Current}
    \cnodepink(-0.75,0.75){0.15}{Current}
    & [name=SS] \parbox{\mylen}{Generar Vecindad} \\
    \psframegray(-1.00,-1.00)(1.00,1.00)
    \cnodepink(1,1){0.20}{Current}
    \cnodeblue(0,0){0.20}{Current}
    \psline[linewidth=0.2]{->}(1,1)(0.5,0.5)
    & Elegir Mejor Vecino\\
    [mnode = dia, linearc = 0.05, shadow = true] \parbox{3cm}{\centering ¿Is in the house\\ of Mary?}
    & [mnode = dia, shadow = true] \parbox{3cm}{\centering ¿Is in the house of King?}& \\
\end{psmatrix}

\end{document} 

在此处输入图片描述

相关内容