Paul Smith wrote:
On 2/2/06, Herbert Voss <[EMAIL PROTECTED]> wrote:
This may be a bit out of topic. I have a matrix of ones and zeros with
which I would like to produce a picture in such a way that the ones
would be represented in black, say, and the zeros in yellow. Does
somebody know of a program (for Linux) to create my picture?
what kind of matrix?
An example follows:
x\y 0.1 0.2 0.3
0.1 1 0 1
0.2 0 1 1
0.3 1 1 0
but my matrix is much larger, i.e., with many more rows and columns.
hope, this helps
Herbert
\documentclass[12pt]{article}
\usepackage{amsmath,xcolor}
\pagestyle{empty}
\begingroup
\makeatletter
\catcode`\0=\active
\catcode`\1=\active
[EMAIL PROTECTED]
\newenvironment{makeActive}{%
\catcode`\0=\active
\catcode`\1=\active
\def0{\colorbox{black}{\phantom{I}}}%
\def1{\colorbox{yellow}{\phantom{I}}}%
}{}%
}
\makeatother
\def\zero{\string0}
\def\one{\string1}
\begin{document}
\[
\begin{makeActive}
\begin{pmatrix}
x\backslash y &\zero.\one & \zero.2 & \zero.3 & \zero.4 & \zero.5 &
\zero.6\\
\zero.\one & 1 & 0 & 1 & 1 & 0 & 1\\
\zero.2 & 0 & 1 & 1 & 1 & 0 & 1\\
\zero.3 & 1 & 1 & 0 & 1 & 1 & 0\\
\end{pmatrix}
\end{makeActive}
\]
\end{document}