[Xy-pic] diamond-shaped frames
Maja Karaga
karaga at math.hr
Thu Nov 6 19:50:10 CET 2003
Many thanks to Ross Moore for his swift answer. However, there is a slight
problem still remaining in using so defined diamond-shaped frames, namely,
the arrows are either too short or too long for new objects. Here is my
code, so you can see it yourselves:
\documentclass[12pt]{report}
\usepackage[all]{xy}
\thispagestyle{empty}
\begin{document}
\newcommand{\match}{*=<3.4ex>[F-]{\txt{\scriptsize{$\hspace{1cm}$}}}}
\newcommand{\matchm}{*=<3.4ex>[F-]{\txt{\scriptsize{$M_j$}}}}
\newcommand{\matchb}{*=<3.4ex>[F-]{\txt{\tiny{Begin}}}}
\newcommand{\matche}{*=<3.4ex>[F-]{\txt{\tiny{End}}}}
\newcommand{\deleted}{*=<4ex>[o][F-]{\txt{\scriptsize{$D_j$}}}}
\newcommand{\delete}{*=<4ex>[o][F-]{\txt{\scriptsize{$\hspace{1cm}
$}}}}
%
% \diamondframe[6] for drawing a diamond-shaped frame
% around the current <pos>
%
% (just a quick hack, by Ross Moore 2003/11/6)
%
\newcommand{\diamondframe}[6]{%
\save % save the current state
c!C % center on the current <pos>
,*#1+=\frm{}% % drop empty frame with modifiers, equalized
="@f@" % name it
,"@f@"+U,{\ar@{#2}"@f@"+R#3}% draw each side, allowing labels
,"@f@"+R,{\ar@{#2}"@f@"+D#4}% (could be more efficiently done
,"@f@"+D,{\ar@{#2}"@f@"+L#5}% as a single \PATH)
,"@f@"+L,{\ar@{#2}"@f@"+U#6}%
\restore % return to the saved state
}
% allow the 1st argument to be of variable-length, pre-{
\def\dframe#1#{\diamondframe{#1}}
% redefine these user-commands using the new methods
\newcommand{\diam}{\txt{\footnotesize\phantom{$I_j$}}%
\dframe{-}{}{}{}{}}
\newcommand{\diami}{\txt{\footnotesize{$I_j$}}%
\dframe{-}{}{}{}{}}
\newcommand{\diamx}{\txt{\footnotesize\phantom{$I_j$}}%
\dframe{}{}{}{}{}}
\xymatrix@!=1.7pc{ & \delete \ar[d] \ar[r] \ar[ddr]
& \deleted \ar[d]
\ar[r] \ar[ddr] & \delete \ar[d] \ar[ddr] & \\
\diamx \dframe++{-}{}{}{}{} \ar@(dl,ul)[] \ar[dr] \ar[ur]&
\diam \ar@(dl,ul)[] \ar[dr] \ar[ur] & \diami \ar@(dl,ul)[] \ar[dr]
\ar[ur]& \diam \ar@(dl,ul)[] \ar[dr] & & \\
\matchb \ar[u] \ar[r] \ar[uur] & \match \ar[u] \ar[r]
\ar[uur] &
\matchm \ar[u] \ar[r] \ar[uur]& \match \ar[u]\ar[r]& \matche \\
}
\end{document}
I belive that this most likely can be solved by simple shortening or
prolongation of arrows, but I don't know how to do it.
Any suggestions?
Maja
M.Karaga,
Department of Mathematics,
University of Zagreb
More information about the xy-pic
mailing list