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.

Is there a way to color certain (but not all) arrows using \xymatrix? I wish the following ignorant attempt would work!!

\usepackage{xypic,color}
\begin{document}
\[
\xymatrix
{
X\ar[r]\color{red}{\ar[d]} & Y\\
Z
}
\]
\end{document}
share|improve this question

1 Answer 1

up vote 6 down vote accepted

Specify the color option to the xy package. Then you could apply a color style by @[color].

For example:

\documentclass{article}
\usepackage{color}
\usepackage[color,matrix,arrow]{xy}
\begin{document}
\[
\xymatrix
{
X\ar[r] \ar@[red][d] & Y\\
Z
}
\]
\end{document}

alt text

Note: load xy, not xypic which produces at least a warning. To be able to provide options specifically for each package, write one \usepackage for each package. Perhaps use the enhanced package xcolor instead of color.

share|improve this answer
    
The output isn't yielding color at all. (My preliminary glance was mistaken, apparently.) I'm working within the a0poster class, but I've tried to run this as an article with the same results. –  Kristen Dec 13 '10 at 21:02
    
@Kristen: Do you mean you did not get color with my example or with your code? –  Stefan Kottwitz Dec 13 '10 at 21:05
    
I'm not getting color with your code. –  Kristen Dec 13 '10 at 21:29
    
Hm, I did ... I used pdfTeX. And you? Specifying the driver could help. In the case of pdfTeX: \usepackage[color,matrix,arrow,pdf]{xy}. And, especially if xy complains about an unknown option: update xy-pic to 3.8 or above. I'm using xy 3.8.4. –  Stefan Kottwitz Dec 13 '10 at 21:33
    
I'm also using pdfTeX. I think the problem might be with my version of xy-pic; mine is only 3.7. I also just noticed a warning: shape [red] not defined. Is the older version of xy-pic reading the argument as a shape parameter? –  Kristen Dec 13 '10 at 21:41

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.