[Tex/LaTex] Why don’t I get non-italic, normal font inside theorem environment using newmdtheoremenv and mdfdefinestyle

italictheorems

The theorem text is written in italic even if I set font=\normalfont\normalsize. Maybe related to that, Portuguese "-ção" is not properly recognized in that text.

\documentclass[a4paper,10pt]{book}

\usepackage[brazilian]{babel}
\usepackage{mdframed}
\usepackage{amsmath}
\usepackage{xcolor}

\mdfdefinestyle{definitionSty}{font=\normalfont\normalsize, backgroundcolor=blue!10, linewidth=0pt, innerleftmargin=3ex, innerrightmargin=3ex, innertopmargin=3ex, innermargin =+1cm, outermargin =+1cm}

\newcounter{definitionCounter}[chapter]
\numberwithin{definitionCounter}{chapter}

\newmdtheoremenv[style=definitionSty]{definition}[definitionCounter]{Defini\c{c}\~{a}o}

\begin{document}

\begin{definition}{Medição, grandeza e medida}

 \begin{itemize}
  \item medição: \textit{processo} pelo qual se mede algo
  \item grandeza: \textit{propriedade} quantificada por medição
  \item medida: \textit{resultado} do processo de medição
 \end{itemize}

\end{definition}

\end{document}

Note that text is in italic and without sequence "çã".

Best Answer

The documentation on this is opaque, but includes an example use that starts

\theoremstyle{<some style>} 
\newmdtheoremenv[linecolor=blue]{lemma}{Lemma}[section]

The crucial thing here is the \theoremstyle command, which is not mdframed based, but refers to the amsthm styling commands. So you need to load amsthm, and that has to be done before loading mdframed.

Sample output

\documentclass[a4paper,10pt]{book}

\usepackage[brazilian]{babel}
\usepackage{amsthm}
\usepackage{mdframed}
\usepackage{amsmath}
\usepackage{xcolor}

\mdfdefinestyle{definitionSty}{backgroundcolor=blue!10, linewidth=0pt, innerleftmargin=3ex, innerrightmargin=3ex, innertopmargin=3ex, innermargin =+1cm, outermargin =+1cm}

\newcounter{definitionCounter}[chapter]
\numberwithin{definitionCounter}{chapter}

\theoremstyle{definition}
\newmdtheoremenv[style=definitionSty]{definition}[definitionCounter]{Defini\c{c}\~{a}o}

\begin{document}

\begin{definition}Medição, grandeza e medida
 \begin{itemize}
  \item medição: \textit{processo} pelo qual se mede algo
  \item grandeza: \textit{propriedade} quantificada por medição
  \item medida: \textit{resultado} do processo de medição
 \end{itemize}
\end{definition}

\begin{definition}[Medição, grandeza e medida]\leavevmode
 \begin{itemize}
  \item medição: \textit{processo} pelo qual se mede algo
  \item grandeza: \textit{propriedade} quantificada por medição
  \item medida: \textit{resultado} do processo de medição
 \end{itemize}
\end{definition}

\end{document}

Note that I am not quite sure how I should be interpreting your argument in the definition environment. Either print it straight as in the first version or put it in square brackets, then there is then an extra \leavevmode tweak needed because of the itemize.

Instead of loading amsthm you can load ntheorem, either with the amsthm option and still use \theoremstyle, or using its own styling commands. You can also use the thmtools interfaces to either of these packages.