# [Xy-pic] Really weird behavior

Michael Barr barr at math.mcgill.ca
Tue Dec 10 17:51:57 CET 2013

If you compile the following file:

\documentclass{article}
\pdfoutput1
\usepackage{color}
\def\red{\color{red}}
\def\green{\color{green}}
\usepackage[arrow]{xy}

\begin{document}
\newcount \xytest
$$\xy \xytest0 {\red\ar@{->}^{\green f}(20,0)} \endxy$$
Test
\end{document}

you find nothing special about the output.  In particular, the word Test
is black.  Now comment out the line \xytest0 and see what happens.  On my
computer the word Test is now red.  How can this totally irrelevant
assignment make a difference in the behavior?  And how can this color
assignment, which is inside a group, make a difference outside?

This would appear to have something to do with something in xy-pic since
the simple test line: {\red Test} Test gives the expected result, the
first word in red and the second one black.

Michael

--
Every gun that is made, every warship launched, every rocket fired
signifies, in the final sense, a theft from those who hunger and are not
fed, those who are cold and are not clothed. -Dwight D. Eisenhower