# [Xy-pic] color for different elements in xypic

David Marceau davidmarceau at sympatico.ca
Sat May 1 06:24:37 CEST 2004

 > Hi there Mr. Ross,
>
> I thought maybe you could help me with an xypic question please.
>
> I'm having a problem displaying a pipe symbol "|" in an xypic diagram.
> \xymatrix{
> % column 1
> *++[][F=]\txt{\color{blue}EXPONENT\\\color{blue}([eE]\\(+?\vert\ -)
> \\{INTEGER})}
> \ar[r]
> \ & \\}
>\vert is a math-mode symbol.
>Within the \txt object you need $\vert$ or $|$.
>If you want some space around the pipe,
>then  $\mid$ may be better.

This worked wonderfully Thank you.

Please if you would permit me to bother you for two more questions:
1)How do I activate and control xy color of:
-frame boxes
-arrows
-arrow tips
2)Is there any way of controlling/reducing the y spacing between the
rows of stuff in the xymatrix?  I would like to get more stuff on a page
if I can.

My goal is to assign a color in the regex expression and then match the
path that follows in lines/boxes with the same color.
i.e. _? has one color for showing different the path options responsible
for this processing this expression, and (blah)* has another color for
showing iteration.  Then plain old tokens take the standard path with
black obviously.

I tried the following example from the xyrefer.ps but it turned out all
black which seems to mean my color is not active.  I use an
hpdeskjet3820 and it seems to be already ok for ghostcript/postscript
output because when I use emacs, I can do psnup 4 no problem along with
printing out color.
\xy *+<1.5pt>[F**:white]++[F**:red] \txt{text with background}
,+!D+/d1pc/,*++[F**:black][white] \txt\bf{bold white on black}\endxy

I have the following at the top of my .tex file:
\documentclass [12pt,english,epsf]{report}
\usepackage[english]{babel}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{color}
\input xy
\xyoption{all}
\xyoption{color}

Any suggestions to get the xy colors active?

Thank you for taking the time to consider my request Mr. Ross.

Below is where I'm at with my stuff in order for you to see where I'm
going with this.

Cheers,
David Marceau

\xymatrix{
*++[][F=]\txt{\color{blue}DIGIT \\ \color{blue}[0-9] \\}
\ar[rr]
\arr[dr][drr][drr]
\arr[ddr][ddrr][ddrr]
\arr[dddr][dddrr][dddrr]
\arr[ddddr][ddddrr][ddddrr]
\arr[dddddr][dddddrr][dddddrr]
\arr[ddddddr][ddddddrr][ddddddrr]
\arr[dddddddr][dddddddrr][dddddddrr]
\arr[ddddddddr][ddddddddrr][ddddddddrr]
\arr[dddddddddr][dddddddddrr][dddddddddrr]
\  & & *++[o][F-]{0}
\ar[rr]
\  & & \\
\  & & *++[o][F-]{1}
\arr[ur][urr][urr]
\  & & \\
\  & & *++[o][F-]{2}
\arr[ur][uurr][uurr]
\  & & \\
\  & & *++[o][F-]{3}
\arr[ur][uuurr][uuurr]
\  & & \\
\  & & *++[o][F-]{4}
\arr[ur][uuuurr][uuuurr]
\  & & \\
\  & & *++[o][F-]{5}
\arr[ur][uuuuurr][uuuuurr]
\  & & \\
\  & & *++[o][F-]{6}
\arr[ur][uuuuuurr][uuuuuurr]
\  & & \\
\  & & *++[o][F-]{7}
\arr[ur][uuuuuuurr][uuuuuuurr]
\  & & \\
\  & & *++[o][F-]{8}
\arr[ur][uuuuuuuurr][uuuuuuuurr]
\  & & \\
\  & & *++[o][F-]{9}
\arr[ur][uuuuuuuuurr][uuuuuuuuurr]
\  & & \\
}

\xymatrix{
*++[][F=]\txt{\color{blue}EXTENDED\_DIGIT\\\color{blue}[0-9a-fA-F]\\}
\ar[rr]
\arr[dr][drr][drr]
\arr[ddr][ddrr][ddrr]
\ & & *++[o][F-]\txt{[0-9]}
\ar[rr]
\ & & \\
\ & & *++[o][F-]\txt{[a-f]}
\arr[ur][urr][urr]
\ & & \\
\ & & *++[o][F-]\txt{[A-F]}
\arr[uur][uurr][uurr]
\ & & \\
}

\xymatrix{
% column 1
*++[][F=]\txt{\color{blue}INTEGER\\\color{blue}({DIGIT}(\_?{DIGIT})*)}
\ar[r]
% column 2
\ & *++[o][F-]\txt{DIGIT} \ar[rrrrr] \arr[dd] d[ddr] [ddrr]
% column 3
\ &
% column 4
\ &
% column 5
\ &
% column 6
\ &
% column 7
\ & \\
& & & & & & & \\
% column 1
\
% column 2
\ &
% column 3
\ & \arr[u][ru][rru][rrr][rrr]
% column 4
\ & *++[o][F-]\txt{''\_''} \ar[rr]
% column 5
\ &
% column 6
\ & *++[o][F-]\txt{DIGIT}
\arr[u] u[uur] [uur]
\arr[d]d[dl][dlll][lll][ll]
% column 7
\ &
% column 8
\ & \\
\ & & & & & \\
}

\xymatrix{
% column 1
*++[][F=]\txt{EXPONENT\\([eE]\\(\color{blue}+?$\vert$\color{red}-\color{black})\\{INTEGER})}
\ar[rr]
% column 2
\ &
% column 3
\ & *++[o][F-]\txt{[eE]}
% column 4
\ &
% column 5
\ &
% column 6
\ &
% column 7
\ & \\}