[Tex/LaTex] Hypothesis with amsthm package

amsthm

enter image description hereI'm trying to write a null hypothesis with my thesis, and I found this question Hypothesis in latex. But when I tried it, it did not work for me, as I had a typesetting error and the xcolor and fancyhdr page were the culprits. (I dont even understand how that is possible, but then again I'm super new at this, so maybe that's not surprising).

Anyway, I've read that I can use the amsthm package to write the hypothesis, but I haven't been able to find a working example.

\documentclass[12pt,a4paper,oneside]{book}
\usepackage{amsmath,amssymb,amsthm}
\newtheorem{hyp}{Hypothesis}
\begin{document}
\begin{hyp}
This is my first hypothesis.
\end{hyp}
\end{document}

Best Answer

Is it what you want?

\documentclass[12pt,a4paper,oneside]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{thmtools}
\declaretheoremstyle[
spaceabove=6pt, spacebelow=6pt,
headfont=\normalfont\bfseries,
notefont=\mdseries, notebraces={(}{)},
bodyfont=\normalfont,
postheadspace=0.6em,
headpunct=:
]{mystyle}
\declaretheorem[style=mystyle, name=Hypothesis, preheadhook={\renewcommand{\thehyp}{H\textsubscript{\arabic{hyp}}}}]{hyp}

\usepackage{cleveref}
\crefname{hyp}{hypothesis}{hypotheses}
\Crefname{hyp}{Hypothesis}{Hypotheses}

 \begin{document}
 \setcounter{hyp}{-1}
 \begin{hyp}[Test hypothesis] \label{hyp:a}This is my first hypothesis. \end{hyp}
 \begin{hyp} \label{hyp:b}This is my second hypothesis. \end{hyp}

  \Cref{hyp:a,hyp:b}.

 \end{document} 

enter image description here

Related Question