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 want to add three braces to a xymatrix in a xypic environment. Here's how I got so far.

\documentclass[11pt]{article} % use larger type; default would be 10pt
\usepackage[all]{xy}
\begin{document}

\xy
\xymatrix@C=10pt@R=20pt{
&\\
 & A_1\POS*\frm{^\}},+U*++!D\txt{A to B} & B_2 & C_3 \POS*\frm{^\}},+U*++!D\txt{C to D} & D_4\\
 & E_5 & F_6 \POS*\frm{_\}},+U*++!D\txt{F to G} & G_7 & H_8
}
\endxy

\end{document}

current output

Now there are two issues:

  1. I want the braces to span from A to B, C to D and the one at the bottom from F to G. At the moment, they only embrace a single element. How can I do this using the xymatrix [rr] syntax?

  2. I want to add the label for the bottom brace from below. At the moment, it is still displayed on top.

I appreciate any comments on this issue!

share|improve this question
    
Welcome to TeX.sx! You don't have to sign with your name since it automatically appears in the lower right corner of your post. –  lockstep Nov 14 '12 at 11:33
    
Please give a completely compilable example. A screenshot would also be helpful, but as you don't have enough reputation, somebody else can do that then. –  canaaerus Nov 14 '12 at 11:52
    
@canaaerus: I added the package definitions required to compile. I would appreciate if anyone could make a screenshot. –  Chris Nov 14 '12 at 12:18
add comment

2 Answers 2

Ross Moore kindly responded to my problem in the \xypic mailing list. Here's his solution:

You can add those decorations afterwards, using the implicit names of the matrix cells. e.g.

\xy
\xymatrix "M"@C=10pt@R=20pt{
&\\
 & A_1 & B_2 & C_3 & D_4\\
 & E_5 & F_6 & G_7 & H_8
}%
 \POS"M2,2"."M2,3"!C*\frm{^\}},+U*++!D\txt{A to B} 
 ,"M2,4"."M2,5"!C*\frm{^\}},+U*++!D\txt{C to D} 
 ,"M3,3"."M3,4"!C*\frm{_\}},+D*++!U\txt{F to G} 
\endxy

output of above code

With this, you probably do not need the row-spacing to be as large as you made it ( @R=20pt ).

In the above coding below I added a name "M" for the matrix. This isn't necessary here, but would be if you wanted to draw connections between the cells of 2 or more matrices, so it is a useful technique to know about.

share|improve this answer
add comment

If using another package is an option, I would suggest you to use PGF/TikZ, perhaps in combination with tikz-cd (based on TikZ and specialized to commutative diagrams); here's a little example using a matrix of math nodes and the brace decoration from the decorations.pathreplacing library:

\documentclass[11pt]{article}
\usepackage{tikz-cd}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}

\begin{tikzpicture}[commutative diagrams/every diagram]
\matrix[matrix of math nodes, name=m,inner xsep=0pt] 
{
A_1 & B_2 & C_3 & D_4 \\
E_5 & F_6 & G_7 & H_8 \\
};
\draw[decorate,decoration={brace}]
  (m-1-1.north west) -- (m-1-2.north east) node[midway,auto] {$A$ to $B$};
\draw[decorate,decoration={brace}]
  (m-1-3.north west) -- (m-1-4.north east) node[midway,auto] {$C$ to $D$};
\draw[decorate,decoration={brace,mirror}]
  (m-2-2.south west) -- (m-2-3.south east) node[midway,auto,swap] {$F$ to $G$};
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
Thanks a lot for this. Tikz is what I'm usually using for these kinds of tasks, but I need to alter a present \xypic figure from a paper. Nevertheless, this is a pretty good example. –  Chris Nov 15 '12 at 8:35
add comment

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.