# Why when I use \hat it does not work?

Source code

\documentclass[a4paper,twoside]{article}
\usepackage{upquote}
\usepackage{pgfkeys}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{courier}
\usepackage{caption}
\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{\parbox{\textwidth}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}\vskip-4pt}}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}

\lstset{
basicstyle=\footnotesize\ttfamily,
numbers=left,
numberstyle=\tiny,
stepnumber=2,
numbersep=5pt,
tabsize=2,
extendedchars=true,
breaklines=true,
keywordstyle=\color{red},
stringstyle=\color{blue}\ttfamily,
showspaces=false,
showtabs=false,
xleftmargin=6pt,
framexleftmargin=6pt,
framexrightmargin=6pt,
framexbottommargin=4pt,
backgroundcolor=\color{yellow},
showstringspaces=false
}
\usepackage{aeguill}
\usepackage{prerex}
\usepackage{helvet}
\renewcommand{\rmdefault}{\sfdefault}
\usepackage[printonlyused,withpage]{acronym}%
\usetikzlibrary{chains,positioning}
\usepackage{verbatim}
\usepackage{xcolor}
\usepackage{pdfpages}
\DefineNamedColor{named}{BrickRed}{cmyk}{0,0.89,0.94,0.28}
\DefineNamedColor{named}{DarkRed}{cmyk}{0.4,0.89,0.94,0.28}
\renewcommand{\familydefault}{\sfdefault}
\usetikzlibrary{calc,shapes,positioning,arrows,positioning,shapes.geometric,fit,trees}
\usetikzlibrary{arrows,calc,fit}
\tikzset{box/.style={draw, rectangle, rounded corners, thick, node distance=7em, text width=6em, text centered, minimum height=3.5em}}
\tikzset{container/.style={draw, rectangle, dashed, inner sep=2em}}
\tikzset{line/.style={draw, thick, -latex'}}
\tikzstyle{every picture}=[sibling distance=3cm, shorten >=1pt, node distance=2cm]%>=stealth', bend angle=10, auto, initial text=]
\newcommand*{\stereotype}[1]{
\guillemotleft {#1}\guillemotright%
}
\usepackage{tikz}
%\usepackage{tikz-uml}
%\usepackage{pgf-umlsd}
\usepackage{lmodern,smartdiagram}
\smartdiagramset{set color list={
white!20!white,
white!20!white,
white!70!white,
white!40!white,
white!20!white,
} }
\tikzstyle{b} = [rectangle, draw, fill=blue!20, node distance=4.5cm, text width=8em, text centered, rounded corners, minimum height=4em, thick]
\tikzstyle{c} = [rectangle, draw, node distance=3cm, minimum height=1cm, minimum width=1cm, dashed]
\tikzstyle{l} = [draw, -latex,thick]
\usepackage{epsfig}
\usepackage[ruled,vlined]{algorithm2e}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsmath, amsthm, amssymb, amsfonts}
\interdisplaylinepenalty=2500
\usepackage[cmintegrals]{newtxmath}
\hyphenation{op-tical net-works semi-conduc-tor}

\usepackage{epsfig}
\usepackage{subfigure}
\usepackage{calc}
\usepackage{amssymb}
\usepackage{amstext}
\usepackage{multicol}
\usepackage{pslatex}
\usepackage{apalike}
%\usepackage{SCITEPRESS}     % Please add other packages that you may need BEFORE the SCITEPRESS.sty package.

\subfigtopskip=0pt
\subfigcapskip=0pt
\subfigbottomskip=0pt

\begin{document}

$\hat{\boldsymbol{U}}_{K}$ and its old position $\hat{\boldsymbol{X}}_{K}$ at k:
$$\hat{\boldsymbol{X}}_{k+1}=f(\hat{\boldsymbol{X}}_{k},\hat{\boldsymbol{U}}_{k})=\left[\begin{array}{c}x_{k+1}\\y_{k+1}\\ \theta_{k+1} \end{array}\right]=\left[\begin{array}{c} x_{k}+\Delta D_{k}\cos\theta_{k}\\y_{k}+\Delta D_{k}\sin\theta_{k}\\ \theta_{k}+\Delta \theta_{k} \end{array}\right]$$
Where $\Delta D_{k}$, $\Delta \theta_{k}$, $X_{k}$ and $U_{k}$ are:

\end{document}


• Thank you for posting a working example! At the same time, much of your code does not seem to be relevant to the question you're asking here. Please limit the example to only the code required for your issue to appear. You can have a look at this guide for how to prune your code for this purpose. Jun 4 '16 at 20:37
• if the line \usepackage[T1]{fontenc} is moved to follow \usepackage[cmintegrals]{newtxmath} this seems to fix the problem, although i haven't tried to figure out why. Jun 4 '16 at 20:53
• are you sure you want to use \usepackage{pslatex} (I wrote it last century, but I wouldn't use it this century) (similarly don't use epsfig) Jun 4 '16 at 20:55

Your preamble is quite a mess. It's difficult to understand what is the font you want to use. In any case, there are several packages you must not load.

1. aeguill is obsolete and deprecated
2. pgfkeys is loaded by tikz
3. epsfig is deprecated
4. lmodern is quite useless if you load helvet and set sans serif as default
5. subfigure is obsolete and should not be loaded along with caption anyway
6. pslatex is obsolete

I left them, but \tikzstyle is deprecated.

\documentclass[a4paper,twoside]{article}
\usepackage[T1]{fontenc}

\usepackage{amsmath}
\usepackage{amssymb} % not along with newtxmath
\usepackage{amsthm}
\usepackage{bm}

\usepackage{helvet}
\usepackage{courier}
\usepackage[cmintegrals]{newtxmath}

\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{pdfpages}

\usepackage{caption}

\usepackage{upquote}
\usepackage{listings}
\usepackage{prerex}
\usepackage[printonlyused,withpage]{acronym}
\usepackage{verbatim}
\usepackage[ruled,vlined]{algorithm2e}

\usepackage{tikz}
%\usepackage{tikz-uml}
%\usepackage{pgf-umlsd}
\usepackage{smartdiagram}

\usepackage{calc}
\usepackage{multicol}
\usepackage{apalike}
%\usepackage{SCITEPRESS}     % Please add other packages that you may need BEFORE the SCITEPRESS.sty package.

\renewcommand{\rmdefault}{\sfdefault}

\DeclareCaptionFont{white}{\color{white}}
\DeclareCaptionFormat{listing}{%
\parbox{\textwidth}{\colorbox{gray}{\parbox{\textwidth}{#1#2#3}}\vskip-4pt}%
}
\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white}

\lstset{
basicstyle=\footnotesize\ttfamily,
numbers=left,
numberstyle=\tiny,
stepnumber=2,
numbersep=5pt,
tabsize=2,
extendedchars=true,
breaklines=true,
keywordstyle=\color{red},
stringstyle=\color{blue}\ttfamily,
showspaces=false,
showtabs=false,
xleftmargin=6pt,
framexleftmargin=6pt,
framexrightmargin=6pt,
framexbottommargin=4pt,
backgroundcolor=\color{yellow},
showstringspaces=false
}

\DefineNamedColor{named}{BrickRed}{cmyk}{0,0.89,0.94,0.28}
\DefineNamedColor{named}{DarkRed}{cmyk}{0.4,0.89,0.94,0.28}

\usetikzlibrary{chains,positioning}
\usetikzlibrary{calc,shapes,positioning,arrows,positioning,shapes.geometric,fit,trees}
\usetikzlibrary{arrows,calc,fit}

\tikzset{
box/.style={
draw,
rectangle,
rounded corners,
thick,
node distance=7em,
text width=6em,
text centered,
minimum height=3.5em
}
}
\tikzset{
container/.style={
draw,
rectangle,
dashed,
inner sep=2em
}
}
\tikzset{line/.style={draw, thick, -latex'}}
\tikzstyle{every picture}=[
sibling distance=3cm,
shorten >=1pt,
node distance=2cm,
% >=stealth',
% bend angle=10,
% auto,
% initial text=
]
\tikzstyle{b}=[
rectangle,
draw,
fill=blue!20,
node distance=4.5cm,
text width=8em,
text centered,
rounded corners,
minimum height=4em,
thick
]
\tikzstyle{c}=[
rectangle,
draw,
node distance=3cm,
minimum height=1cm,
minimum width=1cm,
dashed
]
\tikzstyle{l}=[draw, -latex,thick]

\smartdiagramset{set color list={
white!20!white,
white!20!white,
white!70!white,
white!40!white,
white!20!white,
} }

\newcommand*{\stereotype}[1]{%
\guillemotleft {#1}\guillemotright
}
\interdisplaylinepenalty=2500
\hyphenation{op-tical net-works semi-conduc-tor}

\begin{document}

$\hat{\boldsymbol{U}}_{K}$ and its old position $\hat{\boldsymbol{X}}_{K}$ at $k$:
$$\hat{\boldsymbol{X}}_{k+1}=f(\hat{\boldsymbol{X}}_{k},\hat{\boldsymbol{U}}_{k})= \begin{bmatrix} x_{k+1}\\y_{k+1}\\ \theta_{k+1} \end{bmatrix}= \begin{bmatrix} x_{k}+\Delta D_{k}\cos\theta_{k}\\ y_{k}+\Delta D_{k}\sin\theta_{k}\\ \theta_{k}+\Delta \theta_{k} \end{bmatrix}$$
Where $\Delta D_{k}$, $\Delta \theta_{k}$, $X_{k}$ and $U_{k}$ are:

\end{document}


One of your packages changes definition of \hat. As a quick fix you can add

\def\hat{\mathaccent "705E\relax}


before your math, where this accent is used.