The goal is to have an environment that can, depending on a trigger, either create this:
Hypothesis 1 The better the answer, the higher the score.
or that
Hypothesis 2a Higher score is positive correlated with shoesize.
Hypothesis 2b Lower score is negative correlated with shoesize.
I tried a code I found in Google Groups, and it works. However it produces some error messages which I don't understand. Please see the minimal example below:
\documentclass{article}
\usepackage{ntheorem}
\newtheorem{hyp}{Hypothesis}
\newcounter{subhyp}
\newcommand{\subhyp}{
\setcounter{subhyp}{0}
\renewcommand\thehyp{\protect\stepcounter{subhyp}%
\arabic{hyp}\alph{subhyp}\protect\addtocounter{hyp}{-1}}
}
\newcommand{\normhyp}{
\renewcommand\thehyp{\arabic{hyp}}
\stepcounter{hyp}
}
\begin{document}
\normhyp
\begin{hyp}
The better the answer, the higher the score.
\end{hyp}
\subhyp
\begin{hyp}
Higher score is positive correlated with shoesize.
\end{hyp}
\begin{hyp}
Lower score is negative correlated with shoesize.
\end{hyp}
\end{document}
Best Answer
I'd avoid abusing
\thehyp
: you'll be in trouble if you want to get a list of hypotheses, for instance.In my opinion, the best approach is to enclose the "subhypotheses" in an environment that changes the meaning of the
hyp
counter and of some related things.You can still use
\subhyp
and\normhyp
, if you prefer, but it's better to profit of the group structure of LaTeX.