4

I'm typing up solutions to a problem set. I've defined a theorem and solution environment, as in the following document.

\documentclass{article}

\usepackage{amsthm} 
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}
\theoremstyle{definition}
\newtheorem{problem}{Problem}
\theoremstyle{remark}
\newtheorem*{solution}{Solution}

\begin{document}
\begin{theorem}
 The word ``theorem'' at the beginning of a theorem is bold, unless it appears inside a solution.
\end{theorem}

\begin{problem}
 What is $2+2$?
\end{problem}

\begin{solution}
 We use the following theorem.
\begin{theorem} Numbers can be added.\end{theorem} 
The result is therefore $2+2=4$.
\end{solution}

\end{document}

For the theorem that is outside the solution, the word "Theorem" appears correctly as bold. However, inside the solution environment, the title for the theorem environment is italic, matching the style for the solution environment.

How do I get the theorem inside the solution to be correctly boldface?

enter image description here

2

This is a shortcoming of amsthm. You can cure it by using thmtools:

\documentclass{article}

\usepackage{amsthm,thmtools}

\declaretheoremstyle[
  headfont=\bfseries,
  bodyfont=\itshape,
]{myplain}
\declaretheoremstyle[
  headfont=\bfseries,
  bodyfont=\normalfont,
]{mydefinition}
\declaretheoremstyle[
  headfont=\itshape,
  bodyfont=\normalfont,
]{myremark}

\declaretheorem[
  style=myplain,
  name=Theorem,
]{theorem}
\declaretheorem[
  style=mydefinition,
  name=Problem,
]{problem}
\declaretheorem[
  style=myremark,
  unnumbered,
  name=Solution,
]{solution}

\begin{document}

\begin{theorem}
 The word ``theorem'' at the beginning of a theorem is bold, unless it appears inside a solution.
\end{theorem}

\begin{problem}
 What is $2+2$?
\end{problem}

\begin{solution}
 We use the following theorem.
\begin{theorem} Numbers can be added.\end{theorem} 
\begin{problem} Numbers can be added.\end{problem} 
The result is therefore $2+2=4$.
\end{solution}

\end{document}

enter image description here

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.