\mathbb not working in \underset

The problem is caused by package flexisym. Not only \mathbb{R} is affected but also \sup is in an italic font. Anyway, \underset is not the right command for putting something below the "operator" \sup. This is done by a subscript. Compare:

\documentclass{article}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{flexisym}

\begin{document}
\[
  \underset{x \in \mathbb{R}}{\sup} = \sup_{x \in \mathbb{R}}
\]
\end{document}

Result

If you do not need package flexisym, then do not load it.


If you delete \usepackage{flexisym} it works well.

In my experience, to put so many packages, often it create conflict or bad compilation. It is important, also, the order of the list the various packages.

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amssymb,amsthm}
\usepackage{enumitem}
\usepackage{microtype}
\usepackage{idxlayout}
\usepackage{lmodern}
\usepackage{float}
\usepackage{amsthm}
%\usepackage{flexisym}
\usepackage{graphicx}
\usepackage{mathtools}

\begin{document}    

$\underset{x \in \mathbb{R}}{\sup}$
\end{document}