0

How can you make the text normal in the frame below and not italic?

example

\documentclass[a4paper]{article}
\usepackage{mdframed}
\usepackage{ntheorem}
\definecolor{superlightred}{HTML}{F5F5F5}
\theoremstyle{nonumberplain} 
\newmdtheoremenv[backgroundcolor=superlightred, ntheorem]{example}{}[]


\begin{document}

\begin{example}[2014.1]
This is an example and here is a lot of text.  \\ \\
\textbf{a)} Find the relationship between the components. 
\end{example}

\end{document}
3

Just add \theorembodyfont{\upshape] right after \theoremstyle. This being said, I think it is better to use the empty theorem style. I also improved a bit the code, using an enumerate environment with the suitable parameters using enumitem, so that you only have to type \item to obtain the correct counter, automatically formatted.

You even have the possibility, with enumitem, to create your own dedicated list, say examples with these parameters set in the preamble, with the code:

\documentclass[a4paper]{article}
\usepackage{xcolor}
\usepackage{enumitem}
\usepackage{mdframed}
\usepackage{ntheorem}
\definecolor{superlightred}{HTML}{F5F5F5}
\theoremstyle{empty}%
\theorembodyfont{\upshape}
\newmdtheoremenv[backgroundcolor=superlightred, ntheorem]{example}{}
\newlist{examples}{enumerate}{1}% <- max depth
\setlist[examples]{label=\alph*), font=\bfseries, wide=0pt, leftmargin=*, topsep=4pt}

\begin{document}

\begin{example}[2014.1]
This is an example and here is a lot of text.
\begin{examples}
\item
Find the relationship between the components.
\end{examples}
\end{example}

\end{document} 

enter image description here

4
  • Thank you! Is it possible to call [label=\alph*), font=\bfseries, wide=0pt, leftmargin=*, topsep=4pt] once somwhere and it remember it every time I have \being{enumerate}\end{enumerate}? – Clone Apr 14 '20 at 18:12
  • 1
    Yes, it is possible. I've updated my my code. F.y.i., it is explained in the documentation of enumitem, § 7 Cloning the basic lists, pp.17-18. – Bernard Apr 14 '20 at 18:48
  • Thank you once more! – Clone Apr 14 '20 at 19:09
  • You're welcome! It's a pleasure to help. – Bernard Apr 14 '20 at 19:11
2

As indicated in ntheorem's documentation, the font of the theorem body can be changed using the \theorembodyfont command.

\documentclass[a4paper]{article}
\usepackage{mdframed}
\usepackage{ntheorem}
\usepackage{xcolor}
\definecolor{superlightred}{HTML}{F5F5F5}
\theoremstyle{nonumberplain}
\theorembodyfont{\normalfont}
\newmdtheoremenv[backgroundcolor=superlightred, ntheorem]{example}{}

\begin{document}

\begin{example}[2014.1]
This is an example and here is a lot of text.  \\ \\
\textbf{a)} Find the relationship between the components. 
\end{example}

\end{document}

0

You can also use \theoremstyle{definition} before the \newmdtheoremenv command. (However, it gave a slight error: Unknown theoremstyle `definition'. I used it together with \newtheorem{theorem}{Theorem} without error.)

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.