A friend sent me a file in LaTeX that she had received. When compiling it, one of the equations had a strange black rectangle:
The file was about 20 pages long. After minimizing and minimizing the file, I got this simplified version:
\documentclass[12pt]{article}
\usepackage[table]{xcolor}
\begin{document}
\centering
Some initial text.
\[
\begin{array}{c}
\rowcolor{red}
1 + 2 = 3 \\
\rowcolor{green}
1 + 2 = 3 \\
\rowcolor{blue}
\end{array}
\]
Some random two pages of text here \\
just to make debugging difficult.
\[
\left\{
\begin{array}{rrrrrrr}
2x &+& y &+& 4z &=& 0\\
x &+& 6y &+& 7z &=& 0\\
\end{array}
\right.
\]
Some final text.
\end{document}
Now, is it easier to find the error?
[spoiler alert]
Well, the problem is in the previous table, it has the declaration of the color of the “last” row that does not exist. In the original version, it was a commented row, making it more difficult to spot. Moreover, between one table and the equations system there were one or two pages, making it more difficult to see that the error was actually caused by something that was much earlier than the position where it appeared.
\[
\begin{array}{c}
\rowcolor{red}
1 + 2 = 3 \\
\rowcolor{green}
1 + 2 = 3 \\
\rowcolor{blue} % <---- the error is here
\end{array}
\]
Bonus: The error is in the first part, so with a trivial change in the second part we can get a matrix or table with a strange black cell.
\begin{center}
\begin{tabular}{|c|c| c|}
\hline
a & b & c \\
\hline
$1$ & $2$ & $3$ \\
\hline
\end{tabular}
\end{center}