I made a 'hypothesis' custom counter in order to let LaTeX handle my hypothesis reference. My code is
\newcounter{hypothese}
\refstepcounter{hypothese}\label{hypo:lenght_of_words}
\refstepcounter{hypothese}\label{hypo:blue_word}
I think thant the words will be longer in this condition (hypothesis
\ref{hypo:lenght_of_words}) and that the word \emph{blue} will be user more
frenquently than in the next situation (hypothesis \ref{hypo:blue_word}).
% ... statistical computing
As predicted in hypothesis \ref{hypo:blue_word}, the word \enquote{blue} is much more
used than in the natural condition.
The output is what I wanted :
I think thant the words will be longer in this condition (hypothesis 1) and that the
word blue will be user more frenquently than in the next situation (hypothesis 2).
As predicted in hypothesis 2, the word « blue » is much more used than in the natural
condition.
Now I want the hypothesis to use the \Alph{}
style for numbering (A
,B
,C
,…) but I don't know how to set the \ref{}
command to return a letter. Can someone help me?
Best Answer
By default,
\newcounter{hypothese}
will set the numbering style of the newly createdhypothese
counter to arabic (1, 2, 3,...). However, the numbering style can easily be changed. For instance, to set the style to capital letters (A, B, C,...), you should insertpreferably right after defining the counter in question (see my code below). Two compilations might be required to obtain the desired result.
Side note: You can save yourself some hassle by avoiding hardcoding "hypothesis". With your current approach, if you decide, at a later stage, to change all cross-reference instances of "Hypothesis" in your document to "Assumption", you're in for some tedious and error-prone search & replace. A more maintainable alternative is to use the
prettyref
package and its\newrefformat
and\prettyref
commands; for instance, if you decide to substitute "Assumption" for "Hypothesis" throughout your document at a later stage, you can simply substituteAssumption
forHypothesis
in the second argument of the\newrefformat
command. The change will be reflected throughout the document. An even more powerful, albeit not as straightforward to use, package for that iscleveref
.