I type a series of mathematical equations in Latex, but output is wrongly displayed (They are highlighted in yellow), how could I fix this problem.

enter image description here

The packages used:



and the corresponding codes in yellow

    \Omega^{i}_{k\mid {k}} &=  \Omega^{i}_{k\mid {k-1}}+ |\mathcal{N}|\sum_{j\in \mathcal{N}} \pi_{L,k}^{i,j} (H_k^j)^T (R_k^j)^{-1}H_k^j  \notag\\
    q_{k\mid {k}}^i &=  q^{i}_{k\mid {k-1}}+ |\mathcal{N}|\sum_{j\in \mathcal{N}} \pi_{L,k}^{i,j} (H_k^j)^T (R_k^j)^{-1} z_k^j
  • 2
    The culprit seems to be the oldlfont package. It seems to turn \mathcal into a switch like \small and not into a macro like \emph{...}. Why do you load that package? From what I could find on the internet, this package is for legacy documents for backward compatibility. – moewe Sep 27 '15 at 12:46
  • 2
    Besides oldlfont which is the source of the problem, also epsfig and latexsym are obsolete; the former should be replaced by graphicx, the latter removed altogether (amssymb replaces it). – egreg Sep 27 '15 at 12:57
  • 1
    While we're at it: amssymb internally loads amsfonts (see What does each AMS package do?), so you can drop the call to amsfonts. – moewe Sep 27 '15 at 13:05

You get this behaviour because you load the package oldlfont which restores the old font behaviour of LaTeX 2.09.

As a result in your example \mathcal doesn't take an argument any more, but acts as a switch (much like \small still does). So in order to keep its effect limited to the N we need to say {\mathcal N} instead of \mathcal{N}.

As far as I can see, oldlfont is really only there to support legacy documents and should not be used in new documents you write. (In in mathrm doesn't change back pdflatex (pre-install of texmaker) egreg writes: "oldlfont [...] is a package to be used only for typesetting documents written with LaTeX2.09, that's been obsolete for more than twenty years.")

You had better drop oldlfont:


    \Omega^{i}_{k\mid {k}} &=  \Omega^{i}_{k\mid {k-1}}+ \abs{\mathcal{N}}\sum_{j\in \mathcal{N}} \pi_{L,k}^{i,j} (H_k^j)^T (R_k^j)^{-1}H_k^j \\
    q_{k\mid {k}}^i &=  q^{i}_{k\mid {k-1}}+ \abs{\mathcal{N}}\sum_{j\in \mathcal{N}} \pi_{L,k}^{i,j} (H_k^j)^T (R_k^j)^{-1} z_k^j
  • If you want to minimize the example, fine; but then remove amsfonts. – egreg Sep 27 '15 at 13:00
  • @egreg Thank you for the suggestion. It is done. – moewe Sep 27 '15 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.