9

Can somebody help me to generate two overlapping boxes in a psmatrix? What I need is an ncbox from {3,3} to {8,8} and one from {3,3} to {3,8}. I know it's possible to draw them in a separate figure, but I can't manage to put them in the same psmatrix.

\documentclass[12pt,oneside,english]{book}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{geometry}
\geometry{verbose,tmargin=3cm,bmargin=3cm,lmargin=3cm,rmargin=3cm}
\pagestyle{plain}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{float}
\usepackage{amsmath,qtree, amssymb, amsthm, graphicx,graphics, makeidx,esint,bm,pstricks,pst-node,pst-tree}


\begin{document}
\begin{figure}[H]
\begin{align*}
\psmatrix[colsep=0.7cm,rowsep=0.15cm]
\cdot \\
 \cdot  &  \cdot \\
 \cdot  &  \cdot  &  \cdot \\
 \cdot  &  \cdot  &  \cdot & \cdot \\
 \cdot  &  \cdot  &  \cdot  &  \cdot &  \cdot \\
 \cdot  &  \cdot  &  \cdot  &  \cdot  &  \cdot  &  \cdot \\
 \cdot  &  \cdot  &  \cdot &  \cdot  &  \cdot  &  \cdot  &  \cdot \\
 \cdot  &  \cdot  &  \cdot &  \cdot  &  \cdot  &  \cdot  & \cdot  & \cdot 
\ncbox[nodesep=.25cm,boxsize=.25,linearc=.2]{3,3}{8,8}
\endpsmatrix
\end{align*}\caption{\label{fig:equal sets in matrix}}
\end{figure}

\end{document}
10

it has nothing to do with psmatrix. It is a problem with undefined array or tabular cells and you'll have the same problem with the length of horizontal lines with \hline. When you use \\ before you have defined all defined columns in a row then some cells are by default not defined. Define in the 3rd row all cells and everything will be fine:

\documentclass{book}
\usepackage{amsmath,pst-node}

\begin{document}
\begin{align*}
\psmatrix[colsep=0.7cm,rowsep=0.15cm]
 \cdot \\
 \cdot & \cdot \\
 \cdot & \cdot & \cdot & & & & &\\ % define all cells!
 \cdot & \cdot & \cdot & \cdot \\
 \cdot & \cdot & \cdot & \cdot & \cdot \\
 \cdot & \cdot & \cdot & \cdot & \cdot & \cdot \\
 \cdot & \cdot & \cdot & \cdot & \cdot & \cdot & \cdot \\
 \cdot & \cdot & \cdot & \cdot & \cdot & \cdot & \cdot & \cdot 
\ncbox[nodesep=.25cm,boxsize=.25,linearc=.2,
       fillstyle=solid,fillcolor=red!30]{3,3}{8,8}
\ncbox[nodesep=.25cm,boxsize=.25,linearc=.2,
       fillstyle=solid,fillcolor=blue!50,opacity=0.5]{3,3}{3,8}
\endpsmatrix
\end{align*}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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