[Tex/LaTex] Problem compiling when I use symbols less than or greater than

babelbreqnmath-mode

I am writing a document with Texmaker and when I write some equation with the less than (<) or greater than (>) symbols, then it doesn't compile (it doesn't end compiling and I don't get error message).

If I write the equation without one of these symbols all is correct and the program compile.
I have no idea why that happens.

The code is:

\documentclass[12pt,a4paper,oneside]{article}
\setlength{\headheight}{15pt}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{listingsutf8}
\usepackage[spanish]{babel}
\usepackage{fancyhdr}
\usepackage[framed,numbered,autolinebreaks,useliterate]{mcode}
\lstset{breakatwhitespace=false}
\usepackage{lscape}
\usepackage{float}
\usepackage{breqn}
\bibliographystyle{plain}
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\usepackage{graphicx}
\usepackage{subfigure}
\graphicspath{{images/}}
\renewcommand{\baselinestretch}{1.5}
\lstset{
literate=%
         {á}{{\'a}}1
         {í}{{\'i}}1
         {é}{{\'e}}1
         {ó}{{\'o}}1
         {ú}{{\'u}}1
         {ñ}{{\~n}}1
         {Á}{{\'A}}1
         {Í}{{\'I}}1
         {É}{{\'E}}1
         {Ó}{{\'O}}1
         {Ú}{{\'U}}1
         {Ñ}{{\~N}}1
         {¿}{{?`}}1
         {¡}{{!`}}1
}
\begin{document}
$D_{P} < D < D_{o}$
\end{document}

Thanks

Best Answer

If you reduce your example further, you end up with the following:

\documentclass{article}
\usepackage[spanish]{babel}
\usepackage{breqn}
\begin{document}
$<$
\end{document}

So there is some interaction with breqn and babel which causes the problem. If no features of the breqn package are used, you can just remove \usepackage{breqn}.

However, it appears that this is a case where the loading order of packages matter; by swapping the order the example works.

\documentclass{article}
\usepackage{breqn}
\usepackage[spanish]{babel}
\begin{document}
$<$
\end{document}