# Formating theorems

This is my best attempt to achieve the format that I want in LaTeX:

\documentclass{article}

\usepackage[a4paper, total={160mm, 247mm}]{geometry}

\usepackage{color}
\definecolor{medred}{rgb}{0.75, 0, 0} % medium red

\usepackage{amsfonts, amsmath, amsthm}

\newtheoremstyle{definition}
{12pt} % Space above
{12pt} % Space below
{\sffamily} % Body font
{0pt} % Indent amount
{: } % Punctuation after theorem head
{0pt} % Space after theorem head
{} % Theorem head spec (can be left empty, meaning ‘normal’
\theoremstyle{definition}
\newtheorem{definition}{\textcolor{medred}{Definition}}

\begin{document}

\begin{definition}{$\mathbb{N}^+$}\\
$\mathbb{N}^+$ is the set of all positive natural numbers:
\begin{equation*}
\mathbb{N}^+:=\{1, 2, 3, \ldots\}
\end{equation*}
\end{definition}

\begin{definition}{$\mathbb{N}_0$}\\
$\mathbb{N}_0$ is the set of natural numbers including $0$:
\begin{equation*}
\mathbb{N}_0:=\{0, 1, 2, 3, \ldots\}
\end{equation*}
\end{definition}

\begin{definition}{Collatz sequence}\\
A \textit{Collatz sequence} is a mapping of all numbers from the set $\mathbb{N}_0$, called indices, to numbers from the set $\mathbb{N}^+$, called sequence members …
\end{definition}

\end{document}


This is what I get:

But this is what I really want. (It was created with Microsoft Word. This unfortunately requires manual numbering of the definitions, but I need automatic numbering, which is why I prefer to write the document with LaTeX.)

As far as I can tell, a definition has 5 parts:

1. type = The string Definition . It is defined in line 20 together with its red color as an argument of the \newtheorem command. (The space character at the end of the string must not be part of that argument since latex adds it automatically.)
2. sequence number = The number that appears immediately after the type and is increased automatically for each new definition. I managed to get bold numbers (I think because they are part of the 'theorem head'), but I failed to make them red and I have no idea how to do so.
3. punctuation = the string : . It is the 7th argument of the \newtheoremstyle command that starts at line 10. Again: I can make this string bold, but I can't make it red.
4. title = the string that in my examples stands in the same line as the elements mentioned previously. It is the name of the thing that will be defined. But obviously this title and the next element that I call 'body' belong both to what is called 'theorem body' in the manuals. I can make either title and body both bold or both non-bold by changing the 4th argument of the \newtheoremstyle command. But I want to have this part bold and red and the next element black and normal.
5. body = This is the definition of the thing that is named in the title element. I want it to appear in a different format than the title (black and normal)

How can I achieve these formats?

I have two additional wishes, both of them less important ("nice to have" but not "must"):

1. I want to specify a certain font (like Arial, Calibiri or Libertine), not just a font family (like \sffamily). Where can I find a short but good documentation that describes this?

2. I also want to have $\mathbb{N}^+$ and other mathematical expressions that appear in the title of a definition to be bold too. I also couldn't do this in MS-Word (well, I could format it bold in word, but then only the subscript 0 in N₀ became bold, but neither the N nor the + changed their look), so I think it is a problem with the math-fonts that do not provide bold symbols. Is there a workaround to solve this problem?

• Not all math symbols have bold versions. Commented Mar 11, 2023 at 14:47

As @John Kormylo said, some font don't have bold version.

\documentclass{article}
\usepackage{fontspec}
\usepackage{xcolor}
\definecolor{medred}{rgb}{0.75,0,0}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[bb=boondox]{mathalpha}
\newtheoremstyle{definition}
{12pt}
{12pt}
{\fontspec{Arial}}
{0pt}
{\fontspec{Arial}\bfseries\boldmath\color{medred}}
{\newline}
{0pt}
{\thmname{#1}\space\thmnumber{#2}:\space\thmnote{#3}}
\theoremstyle{definition}
\newtheorem{definition}{Definition}
\begin{document}
\begin{definition}[$\mathbb{N}^+$]
$\mathbb{N}^+$ is the set of all positive natural numbers:
\begin{equation*}
\mathbb{N}^+:=\{1, 2, 3, \ldots\}
\end{equation*}
\end{definition}
\begin{definition}[$\mathbb{N}_0$]
$\mathbb{N}_0$ is the set of natural numbers including $0$:
\begin{equation*}
\mathbb{N}_0:=\{0, 1, 2, 3, \ldots\}
\end{equation*}
\end{definition}
\begin{definition}[Collatz sequence]
A \textit{Collatz sequence} is a mapping of all numbers from the set $\mathbb{N}_0$, called indices, to numbers from the set $\mathbb{N}^+$, called sequence members …
\end{definition}
\end{document}


• I'd put \space inside \thmnote, so it's not added when the title argument is not given. But I'd not use \fontspec, which recomputes the font setup each time it's used. Commented Mar 11, 2023 at 20:59

I don't think you want to use “whatever” font in the statements of definitions. If you want to use sans serif for them, fine, but there should be a single sans serif font in a document, or it would appear as a patchwork.

Here I define a different sans serif font, namely, Source Sans Pro. Use fontspec with XeLaTeX or LuaLaTeX if you want to have more liberty in this choice, with \setsansfont.

I added examples of unnumbered definitions or with no title, where you likely want to omit the colon.

\documentclass{article}

\usepackage[a4paper, total={160mm, 247mm}]{geometry}
\usepackage{xcolor}
\usepackage{amsfonts, amsmath, amsthm}
\usepackage[default]{sourcesanspro}

\definecolor{medred}{rgb}{0.75, 0, 0} % medium red

\newtheoremstyle{mydef}
{12pt} % Space above
{12pt} % Space below
{\sffamily} % Body font
{0pt} % Indent amount
{} % Punctuation after theorem head (the spec below take care)
{\newline} % Space after theorem head
{\thmname{#1}\thmnumber{ #2}\thmnote{: #3}}

\theoremstyle{mydef}

\newtheorem{definition}{Definition}
\newtheorem*{definition*}{Definition}% just to test

\begin{document}

\begin{definition}[$\mathbb{N}^+$]
$\mathbb{N}^+$ is the set of all positive natural numbers:
\begin{equation*}
\mathbb{N}^+:=\{1, 2, 3, \dotsc\}
\end{equation*}
\end{definition}

\begin{definition}[$\mathbb{N}_0$]
$\mathbb{N}_0$ is the set of natural numbers including $0$:
\begin{equation*}
\mathbb{N}_0:=\{0, 1, 2, 3, \dotsc\}
\end{equation*}
\end{definition}

\begin{definition*}[Collatz sequence]
A \textit{Collatz sequence} is a mapping of all numbers from
the set $\mathbb{N}_0$, called indices, to numbers from the set
$\mathbb{N}^+$, called sequence members …
\end{definition*}

\begin{definition}
This definition has no title
\end{definition}

\begin{definition*}
This definition has no title and no number
\end{definition*}

\end{document}