6

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 "çã".

  • It didn't work. Besides, I'm compiling with LuaLatex and remember someone told that that command is superfluous when using that compiler. Note that the word "definição" is properly shown: that problem is only for the box text, from which I conclude that the environment redefines things. I have to type "\c{c}\~a" to have "çã". – Leonardo Castro Dec 18 '15 at 13:44
  • @campa Yes, you're right! I had forgotten I had defined it that way. By the way, how do I highlight code in comments (just like you just did)? – Leonardo Castro Dec 18 '15 at 13:57
3
+50

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.

  • I've chosen \begin{definition} \textsc{Medição, grandeza e medida} ... \end{definition}. – Leonardo Castro Jan 8 '16 at 11:15
3

Your log will show

Missing character: There is no ç (U+00E7) in font cmti10!
Missing character: There is no ã (U+00E3) in font cmti10!
Missing character: There is no ç (U+00E7) in font cmti10!
Missing character: There is no ã (U+00E3) in font cmti10!
Missing character: There is no ç (U+00E7) in font cmti10!

If you add

\usepackage{fontspec}

Then it will use latin modern opentype fonts and the non ascii character swill work as expecteded.

  • 1
    Thank you, David, but I think I can't fully accept the answer because the "ç/ã" part was secondary in my question. The main subject was how to get non-italic in the theorem environment text. – Leonardo Castro Dec 18 '15 at 21:19
  • @LeonardoCastro just goes to show, you shouldn't ask two questions in one question:-) I might look at the fonts later but I don't actually know the newmdtheoremenv commands so I'd have to look what it's doing. – David Carlisle Dec 18 '15 at 21:32
  • I thought both problems were related to newmdtheoremenv reconfiguring font inside its boxes, since the problem with ç and ã didn't happen outside the boxes even without fontspec because I compiled it with LuaLaTex.. – Leonardo Castro Dec 18 '15 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.