If a math display is too wide, then the \eqno appears on the next line on the left instead of on the right as it should. Does anyone know how to solve this problem? This is an example:
\documentclass[a4paper]{article}
\usepackage[cmex10]{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{mathptmx}
\newcommand{\E}{\mathbb{E}}
\newcommand{\si}[1]{\ensuremath{\sigma_{#1}^{2}}}
\begin{document}
\begin{equation}
C=
\begin{bmatrix}
{C_{11} } & {C_{12} } \\
{C_{21} } & {C_{22} } \\
\end{bmatrix}=
\begin{bmatrix}
\E\left[ {\left( {X-m_{X}} \right)^{2}} \right] & \E\left[ {\left( {X-m_{X}} \right)\left( {Y-m_{Y}} \right)} \right] \\
\E\left[ {\left( {X-m_{X}} \right)\left( {Y-m_{Y}} \right)} \right] & \E\left[ {\left( {Y-m_{Y}} \right)^{2}} \right]
\end{bmatrix}=
\begin{bmatrix}
\si{X} & C_{XY} \\
C_{XY} & \si{Y} \\
\end{bmatrix}
\end{equation}
\end{document}
Added by Hendrik Vogt:
The same happens with plain LuaTeX.
\hsize=2cm
$$a^2+b^2=c^2\eqno(1)$$
\bye
Ouput after compilation with luatex:

Ouput after compilation with pdftex:

Dear friends: I think the next code is a posible, and provisional solution:
\usepackage{environ}
\NewEnviron{equationw}
{
\begin{equation}\begin{split}
\BODY
\end{split}\end{equation}
}
xelatex. However you should use packageunicode-mathand\setmathfont{texgyretermes-math.otf}and not loadingmathptmxwhen runninglualatex– Herbert Feb 12 at 14:36:-)– Hendrik Vogt Feb 16 at 20:24