# How do I put color on frame at \xymatrix?

I'm writing *++[o][F-,]{3} at \xymatrix for example. How can I make that the 3 will be green and the frame at red?

How can I make the *++[o][F-,]{3} that will be more dark? (the inside of *++[o][F-,]{3} and not the frame...)

How can I make the 7 like this?

Thank you!

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\setlength{\parindent}{0bp}
\usepackage[all]{xy}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\makeatletter
\newcommand{\xyR}[1]{%
\xydef@\xymatrixrowsep@{#1}
} % end of \xyR

\newcommand{\xyC}[1]{%
\xydef@\xymatrixcolsep@{#1}
} % end of \xyC

\makeatother

\begin{document}
\L{$\xymatrix{ & & *++[o][F]{3}\ar@{-}[rd]\ar@{-}[dl]\\ & *++[o][F]{6} & & *++[o][F]{7}\\ \\ }$}
\end{document}

• It would be much easier for people to test any possible answers if you supplied a document that demonstrated these rather than have fragments that can't be processed. (This is true of almost all questions) – David Carlisle Nov 16 '14 at 16:21
• @DavidCarlisle, An image it's OK? – heblyx Nov 16 '14 at 16:27
• No I mean tex source of a document, if you want people to test their answers (and most people don't answer without testing) you have a much bigger chance of someone answering if you supply a document from \documentclass to \end{document} and say how you want its output to change. Otherwise just making a test case is too much work. – David Carlisle Nov 16 '14 at 16:31
• @DavidCarlisleת Yes, but I'm using LyX, it still be useful? – heblyx Nov 16 '14 at 19:23
• well would a small tex document be useful to you as an answer if so you should make one, to save everyone trying to help having to make one. especially as xypic isn't so common these days making a document that sets it up correctly makes it more likely to get an answer – David Carlisle Nov 16 '14 at 20:16

There may be a more "native" xypic way but I didn't see anything about fill styles with a quick look at the manual. You can however not draw the frames with xy then draw framed/filled nodes with anything else, pstricks, tikz, or as here, picture mode

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\setlength{\parindent}{0bp}
\usepackage[all]{xy}
\usepackage{color,pict2e}
\newcommand\cfill[2]{%
\begin{picture}(0,0)%
\put(0,0){{\color[gray]{#1}\circle*{18}}}%
\put(0,0){{\circle{18}}}%
\put(0,0){\makebox(0,0){#2}}%
\end{picture}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\makeatletter
\newcommand{\xyR}[1]{%
\xydef@\xymatrixrowsep@{#1}
} % end of \xyR

\newcommand{\xyC}[1]{%
\xydef@\xymatrixcolsep@{#1}
} % end of \xyC

\makeatother

\begin{document}
\L{$\xymatrix{ & & *++{\color{red}\cfill{1}{\textcolor{green}{3}}}\ar@{-}[rd]\ar@{-}[dl]\\ & *++[o][F]{6} & & *++{\cfill{.9}{7}}\\ \\ }$}
\end{document}

• Can you explain me more please about what you added? What is the meaning of '\put(0,0){{\color[gray]{#1}\circle*{18}}}'? Thank you! – heblyx Nov 17 '14 at 11:52
• And why do use the number 2 at: \newcommand\cfill[2] ?? Thank you so much!! – heblyx Nov 17 '14 at 11:53
• @Yoar the command has two arguments: the fill colour and the text content – David Carlisle Nov 17 '14 at 12:08
• @Yoar \put is a standard latex command (it does not need any package) to put text at a specified coordinate. pict2e just makes the command use postscript/pdf drawing at the back to get nicer circles and lines than the original version, which uses special latex drawing fonts. – David Carlisle Nov 17 '14 at 12:10
• @Yoar as written it takes a numeric argument between 0 and 1 as the definition has \color[gray]{#1} you could change it to \color{#1} then it would take a defined colour name so you would need to change \cfill{1} to \cfill{white} and \cfill{.9} to \cfill{mygray} and use \definecolor to define mygray. but could then use red or any other colour you wanted (but it is best not to ask new questions in comments, the system is warning about the length of this thread already) – David Carlisle Nov 17 '14 at 14:39

As a reminder, the *++[o][F:red]{3} will draw text 3 surrounded by red circle frame.
Do remember to include \usepackage{color} and \xyoption{color} at the head of your tex file.