Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have test that psmatrix is a good way to do diagrams, but ... to do diagrams where the nodes is not displayed as a "perfect matrix/table".

What is the recommended way to do any similar to, with ps pictures in the nodes?, with fully liberty for place where I want the center of the node. enter image description here

Code example with psmatrix:

\documentclass[12pt,a4paper,x11names]{article}
\usepackage{pstricks,pst-node,pst-blur,pstricks-add}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[utf8]{inputenc}
\usepackage{eurosym}
\newpsobject{psframegray}{psframe}{fillcolor=lightgray,linestyle=none,shadow,blur}
\definecolor{azultenue}{RGB}{65,170,193}
\definecolor{rojotenue}{RGB}{192,2,3}
\definecolor{naranjatenue}{RGB}{241,101,35}
\definecolor{verdetenue}{RGB}{144,169,61}
\definecolor{gris135}{RGB}{135,135,135}

\begin{document}

\vspace{2.1cm}
 \begin{figure}[h!]
\centering

\resizebox{10cm}{!}{

\psset{framearc=0.2, shadowcolor=black!70, shadowangle=-90, unit=1.0cm,nodesep=0.12cm}
%
\def\pscolhookii{\hskip 1cm}
\def\pscolhookiii{\hskip 1cm}
\begin{psmatrix}[rowsep=0.2, colsep=5.2]% defines the distance between two frames
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
&
&
\\[2.5cm]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 [name=Inicio]
 \psframegray(-2.5,-2.5)(2.5,2.5)
%
 \rput(0,1.5){\circlenode[fillstyle=solid,fillcolor=azultenue]{p1}{\textcolor{black}{$p_1$}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
&[name=Conjunto]
\psframegray(-2.5,-2.5)(2.5,2.5)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
&[name=EM]
\psframegray(-2.5,-2.5)(2.5,2.5)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
\end{psmatrix}
%
{\psset{linewidth=3pt, linecolor=red, arrows=->, nodesep=4pt,  linearc=0.25, angleB=180, shortput=nab, npos = 0.4,nodesep=2.6cm}
\ncline{Inicio}{Conjunto}
\ncline{Conjunto}{EM}
}

}
%\vspace{3.85cm}
\vspace{2.85cm}
\caption{Esquema $(1 + \lambda)$}\label{1maslambda-ilustracion}
\end{figure}

\vspace{1cm}

\end{document} 
share|improve this question
    
With pst-tree? –  Bernard Jun 1 at 12:29
    
@Bernard, no necessarily. In any way. –  Mika Ike Jun 1 at 13:26

1 Answer 1

up vote 3 down vote accepted

It is also possible to place the frames with \rput. showgrid=true enables the grid for the coordinates and showgrid=false hide it:

\documentclass[12pt,a4paper,x11names]{article}
\usepackage{pst-blur,pstricks-add}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}

\def\myFrameNode#1(#2){\rput(#2){\rnode{#1}{%
  \psframe[framearc=0.2,shadowcolor=black!70,shadowangle=-90,shadow,
           fillstyle=solid,fillcolor=lightgray](-2.5,-2.5)(2.5,2.5)}}}

\begin{document}

\begin{figure}[htb!]
\centering
\resizebox{10cm}{!}{%
\begin{pspicture}[showgrid=true](17,6)
\myFrameNode{Inicio}(3,3)%
\myFrameNode{Conjunto}(9,3)%
\myFrameNode{EM}(15,3)
\psset{linewidth=3pt, linecolor=red, arrows=->, nodesep=2.6cm}%
\ncline{Inicio}{Conjunto}%
\ncline{Conjunto}{EM}%
\end{pspicture}%
}
\caption{Esquema $(1 + \lambda)$}\label{1maslambda-ilustracion}
\end{figure}

\begin{center}
\psscalebox{0.6}{%
\begin{pspicture}[showgrid=false](13,12)
\myFrameNode{Inicio}(3,5)%
\myFrameNode{Conjunto}(10,9)%
\myFrameNode{EM}(10,2.5)%
\psset{linewidth=3pt, linecolor=red, arrows=->, nodesep=2.6cm}%
\ncline{Inicio}{Conjunto}%
\ncline{Conjunto}{EM}%
\ncline{Inicio}{EM}%
\end{pspicture}}
\end{center}

\end{document} 

enter image description here

share|improve this answer
    
Perfect answer! I need to learn more about \def \...#1....#2 ....#2....#1. Any suggestion for that purpose?. –  Mika Ike Jun 1 at 13:49
    
look into one of the PSTricks packages or ctan.org/tex-archive/info/texbytopic, also available as a book from DANTE: dante.de/index/Literatur/tbt.html –  Herbert Jun 1 at 14:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.