This solves a problem with commented out `\end{eqnarray}` inside an eqnarray (among other things). Closes #3113.