I would like to write some theorems down like this:
\begin{theorem}
\begin{preconditions}
$A := \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}$\\
$B := \begin{pmatrix} 2 & 2 \\ 3 & 4 \end{pmatrix}$\\
$n \in \mathbb{N}$
\end{preconditions}
\begin{claim}
$\sqrt{2} \notin \mathbb{Q}$
\end{claim}
\begin{proof}{directly}
[... the proof ...]
\end{proof}
\end{theorem}
It should look like this:
**Theorem 123**
**Preconditions**:
$A := \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}$\\
$B := \begin{pmatrix} 2 & 2 \\ 3 & 4 \end{pmatrix}$\\
$n \in \mathbb{N}$
**Claim**: √2 ∉ Q
**Proof**: directly
[... the proof ...]
[.. the end] ■
(Theorem 123
, Preconditions
, Claim
and Proof
should be bold)
Logic behind the environment:
- the theorems should automatically get a number that starts by one and counts up by one for each theorem
- inside of the theorem environment, only the
preconditions
,claim
andproof
environments are allowed - inside of the theorem environment, the
claim
andproof
environment are required to be exactly once. - the content of proof and the content of preconditions should have the same intendation.
What I've found so far:
I thought \newenvironment might be what I am searching for:
\newenvironment{name}[num]{before}{after}
but I could not figure out how to mark internal environments as required.
The amsthm package seem to have environments for proof (source), but I can't see a possibility to nest the different environments and make them look like I want them to look
ntheorem seems to offer a lot of possibilities. I have created 4 new theorem environments:
\newtheorem{theorem}{Theorem}
\newtheorem{preconditions}{Preconditions}
\newtheorem{proof}{Proof}
\newtheorem{claim}{Claim}
I have used the latex code from above and got this:
This one has no intendation of the inner environments, the inner environments are numbered although they shouldn't be numbered and no tombstone is at the end