# How to color actually labels and arrows using xy/xymatrix package

I'm reading actually the xyrefer.pdf guide to give a color to the arrow and to the label. Starting from this MWE, there is not any color for the arrow (for example).

\documentclass[a4paper,12pt]{article}
\usepackage[color,cmtip,all]{xy}
%\xyoption{color}
%\UseCrayolaColors
\begin{document}
\xymatrix
{
A \ar@[red][r]^a&  B\\
}
\end{document}


How can I obtain a colour to the vector and to the label?

• Did you already try with \usepackage{xcolor} in the preamble? – leandriis Oct 15 at 20:03
• @leandriis Yes, of course. I have an error: Xy-pic error: No 'xcolor' option. [\ProcessOptions\relax]. – Sebastiano Oct 15 at 20:05
• Interesting. For me, the following MWEgives the following output: \documentclass[a4paper,12pt]{article} \usepackage{xcolor} \usepackage[color,cmtip,all]{xy} \begin{document} \xymatrix { A \ar@[red][r]^{\color{blue}a}& B\\ } \end{document}Output: i.stack.imgur.com/NRenG.png – leandriis Oct 15 at 20:07

Please use the option dvips, if you using LaTeX -> dvips -> PS2PDF and if you didn't given any option, then it will assume PDFLaTeX is the default driver:

MWE

   \documentclass[a4paper,12pt]{article}
\usepackage{color}
\usepackage[dvips,color,matrix,arrow]{xy}
\begin{document}

\xymatrix { A
\ar@[red][r]^{\color{blue}a}& B\\
}

\end{document}


• Thank you very much...for your answer...."Grazie assai". – Sebastiano Oct 16 at 9:29
• @Sebastiano It's my pleasure to give suggestion like you! (I know you are one of a LaTeX great)...and thank you so much for your complimentary comment... – MadyYuvi Oct 16 at 9:35
• Thank you very much again: "(I know you are one of a LaTeX great)"--> It is not true. – Sebastiano Oct 16 at 14:39