4

I have a cluster with which the objects are simply bullets. I would like to group some of the bullets such as the following.

enter image description here

Somehow the edges of the box are exactly on the bullets. Here is my code

   \[
     \xymatrix@C=1cm@R=1cm{
       *={\bullet}\ar@{-}[r]&*={\bullet}\ar@{-}[r]&*={\bullet}\ar@{-}[r]\ar@{-}[d]&*={\bullet}
       \save "1,1"."2,3"*[F.]\frm{}\\
       *={\bullet}\ar@{-}[r]&*={\bullet}\ar@{-}[r]&*={\bullet}\ar@{-}[r]&*={\bullet}
     \restore}%
   \]

which resulting the following image.

enter image description here

I just need to insert paddings within the box. Or if anybody know another way to draw this with xymatrix would also be great.

Thank you in advance.

2

You can use

\save "1,1"."2,3"*+<1pc>!<.5pc,-.5pc>\frm{.}

which having saved the positions increases the size of the rectangle by 1pc in the bottom and right directions and then moves it .5pc vertically and horizontally to be centered on the original material. You do not need the extra [F.] command, the \frm{.} is sufficient.

Sample output

\documentclass{article}

\usepackage[all]{xy}

\begin{document}
\[
  \xymatrix@C=1cm@R=1cm@M=1pc{
  *={\bullet}\ar@{-}[r]&*={\bullet}\ar@{-}[r]&*={\bullet}\ar@{-}[r]\ar@{-}[d]
  &*={\bullet}
  \save "1,1"."2,3"*+<1pc>!<.5pc,-.5pc>\frm{.}\\
  *={\bullet}\ar@{-}[r]&*={\bullet}\ar@{-}[r]&*={\bullet}\ar@{-}[r]
  &*={\bullet}
  \restore}%
\]

\end{document}
2

Using tikz....

enter image description here

\documentclass{article}



\usepackage{tikz}


\begin{document}
\begin{tikzpicture}
\foreach \y in {0,2}
 {
  \foreach \x in {0,2,4,6}  \fill (\x,\y) circle(1mm);
  \draw[very thick] (0,\y)--(6,\y);
}
\draw[very thick](4,0)--(4,2);
\draw[densely dotted, very thick] (-0.2,-0.2) rectangle (4.2,2.2);
\end{tikzpicture}
\end{document}
  • 1
    Thanks! It works but I was waiting for the xy-pic version. – Cica Gustiani Feb 14 '17 at 22:31
  • Don't know anything about xy-pic, but it looks torturous. – JPi Feb 14 '17 at 23:42
  • somehow recently I've been working with this xy-pic and get used to a bit with the notation. I have no particular reason why this package instead – Cica Gustiani Feb 15 '17 at 9:18

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.