2

In my code, I was using the amsmath package and some others and the command \widehat was working just fine, but when I added the package amsfonts, the output of \widehat started producing an error: the variable inside the command is duplicated in the output. For example, \widehat{y}_{t_q} produces:

enter image description here

If I remove the amsfonts package from the code, then the problem disappears. I would like to know how can I use both packages and avoid this error in the \widehat command. Thank you in advance for your attention and advice!

Erica

A short version of my code follows:

\documentclass[11pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{indentfirst}
\usepackage{float}
\usepackage{array}
\usepackage{breqn}
\usepackage{natbib}
\usepackage{hyperref}
\usepackage{amsfonts}

\bibpunct{(}{)}{,}{a}{,}{,}
\newcommand{\BibTeX}{{\sc Bib}\TeX}
\renewcommand{\baselinestretch}{1.2}

\newenvironment{proof}[1][Proof]{\noindent\textbf{#1.} }{\ \rule{0.5em}{0.5em}}
\usepackage{a4wide}

\begin{document}

\begin{equation} \label{70}
\left( \begin{array}{c}
              v_{t_m} \\
              u_{t_m} 
   \end{array} \right) \sim N \left( 0, \left[ \begin{array}{cc}
              \Sigma_{vv} & 0 \\
              0 & \Sigma_{ww} 
   \end{array} \right] \right)
\end{equation}

where $\Phi_f(.)$ is a $p$ th-order polynomial on $\mathbb{R}$ and $\Phi_u(.)$ is a $q$ th-order polynomial on $\mathbb{R}^{N \times N}$. In order to have identification, we assume $\Lambda:= [I,\Lambda'_2]'$ and $\Phi_u (.)$ and $\Sigma_{ww}$ diagonal. 

\begin{equation} \label{73}
\widehat{y}_{t_q} = \alpha + \beta \widehat{f}_{t_q}
\end{equation}

\bibliographystyle{apa}

\end{document}    
Erica
  • 21
  • 1
    Your \widehat command comes from which package? – Bernard Aug 17 '16 at 10:51
  • 5
    all we know is you have a local incompatible definition somewhere. Impossible to say anything. Please make a small document and add it to your question begin{document}$\widehat{y}_{t_q}$\end{document} preceded by whatever class and package commands are needed to show the bad output in your image. – David Carlisle Aug 17 '16 at 10:56
  • Your MWE compiles just fine for me. Do you mind posting your .log file. Also, it might be a good idea to minimize the MWE even futher, for example that \bibliographystyle is probably not needed. Try making the smallest doc possible that still show the error (this is often how the rest of us debug such things) – daleif Aug 17 '16 at 13:29
  • Thank you so much @daleif, in the mean time Willie Wong has found where the problem was. But thanks anyway for the suggestions. Thank you all for all your fast replies and kind attention! – Erica Aug 17 '16 at 14:08

1 Answers1

3

The culprit is breqn. The breqn package is known to have incompatibilities with other packages that deal with the mathematics environments, which means most of the ams* packages. For example:

The simple solution is to load breqn after loading any of the AMS packages. For example:

\documentclass[11pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{amsfonts}

\usepackage{breqn}

\begin{document}

\begin{equation} \label{70}
\left( \begin{array}{c}
              v_{t_m} \\
              u_{t_m} 
   \end{array} \right) \sim N \left( 0, \left[ \begin{array}{cc}
              \Sigma_{vv} & 0 \\
              0 & \Sigma_{ww} 
   \end{array} \right] \right)
\end{equation}

where $\Phi_f(.)$ is a $p$ th-order polynomial on $\mathbb{R}$ and $\Phi_u(.)$ is a $q$ th-order polynomial on $\mathbb{R}^{N \times N}$. In order to have identification, we assume $\Lambda:= [I,\Lambda'_2]'$ and $\Phi_u (.)$ and $\Sigma_{ww}$ diagonal. 

\begin{equation} \label{73}
\widehat{y}_{t_q} = \alpha + \beta \widehat{f}_{t_q}
\end{equation}


\end{document} 

compiles without the duplication of y. But if you move \usepackage{breqn} before \usepackage{amsfonts} as you do in your example, you get the problem you showed in your post.

Willie Wong
  • 24,733
  • 8
  • 74
  • 106
  • Thank you so much @Willie Wong! That was exactly the problem! Now it works just fine, even for the whole code. Thanks a lot for your help! – Erica Aug 17 '16 at 14:06