'How to define a new theorem in bookdown
I realize that bookdown does not have assumption and hypothesis defined despite being noted here. I wonder how I would define a new theorem environment in bookdown. In particular
How do I add the
typeof cross-referencing for, say, assumption, as mentioned here?How do I define a block for assumption as discussed here? I do not really understand what is written there so I hope to receive some more detailed explanation/solution.
To be more specific, this is my code
---
header-includes:
- \usepackage{amsmath}
- \newtheorem{theorem}{Theorem}
- \newtheorem{lemma}[theorem]{Lemma}
- \newtheorem{corollary}[theorem]{Corollary}
- \newtheorem{proposition}[theorem]{Proposition}
- \newtheorem{definition}{Definition}
- \newtheorem{example}{Example}
- \newtheorem{exercise}{Exercise}
- \newtheorem{assumption}{Assumption}
- \newtheorem{hypothesis}{Hypothesis}
urlcolor: blue
extension: latex_macros
numbersections: true
output:
bookdown::pdf_document2:
toc: false
biblio-style: apalike
---
\newcommand{\lessonNumber}[1]{
\renewcommand\thetheorem{#1.\arabic{theorem}}
\renewcommand\thelemma{#1.\arabic{lemma}}
\renewcommand\thecorollary{#1.\arabic{corollary}}
\renewcommand\theproposition{#1.\arabic{proposition}}
\renewcommand\thedefinition{#1.\arabic{definition}}
\renewcommand\theexample{#1.\arabic{example}}
\renewcommand\theexercise{#1.\arabic{exercise}}
\renewcommand\theassumption{#1.\arabic{assumption}}
}
\lessonNumber{1}
\begin{assumption} <!-- I would like to have a label here, for example #trial-->
If A then B
\end{assumption}
Now, let us discuss Assumption \@ref{assump:trial}.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
