2

Is there a way to use \setlist in the enumitem package to get a structure like

FF 1: This is research question 1.
H_1.1: This is statistical hypothesis 1.1.
H_1.2: This is statistical hypothesis 1.2.
FF 1: This is research question 2.
H_2.1: This is statistical hypothesis 2.1.
H_2.2: This is statistical hypothesis 2.2.

So technically I have to change the prefix for the labels for different levels of the list. All I have achieved until now is:

\documentclass{article}
\usepackage{enumitem}

\newlist{forschungsfragen}{enumerate}{2}    

\setlist[forschungsfragen,1]{label=FF \arabic*:, ref=\arabic*} 
\setlist[forschungsfragen,2]{label=$H_{\arabic*}$:, ref=\arabic*}

\begin{document}

\begin{forschungsfragen}
     \item This is research question 1
        \begin{forschungsfragen}
            \item This is statistical hypothesis 1.1.
            \item This is statistical hypothesis 1.2.
        \end{forschungsfragen}  
     \item This is research question 2
        \begin{forschungsfragen}
            \item This is statistical hypothesis 2.1.
            \item This is statistical hypothesis 2.2.
        \end{forschungsfragen}  
\end{forschungsfragen}

\end{document}

So how can I get the counter of the research question level shown on while having "H_" as a prefix?

1 Answer 1

2

Depending on the value ref= option, one has to make some choices, but basically, all comes down to the fact that the counter value of the first level must be included here.

Since \newlist{forschungsfragen}{enumerate}{2} is applied, corresponding counters named forschungsfrageni and forschungsfragenii are defined, the first one responsible for the first level, as such \theforschungsfrageni is the relevant counter formatter command. (From a native German speaker point of view: forschungsfrageni does look weird :D)

The i and ii indicate the level number in roman figures

If the ref - format for the first level is changed, I suggest to use \arabic{forschungsfrageni} however rather than \theforschungsfrageni.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{enumitem}

\newlist{forschungsfragen}{enumerate}{2}    

\setlist[forschungsfragen,1]{label={FF \arabic*:}, ref={\arabic*}} 
\setlist[forschungsfragen,2]{label={$H_{\theforschungsfrageni.\arabic*}$:}, ref={H\arabic{forschungsfrageni}.\arabic*}}

\begin{document}

\begin{forschungsfragen}
\item This is research question 1 \label{frage}
  \begin{forschungsfragen}
  \item This is statistical hypothesis 1.1. 
  \item This is statistical hypothesis 1.2.
  \end{forschungsfragen}  
\item This is research question 2
  \begin{forschungsfragen}
  \item This is statistical hypothesis 2.1. \label{foo}
  \item This is statistical hypothesis 2.2. \label{foobar}
  \end{forschungsfragen}  
\end{forschungsfragen}

In \ref{foobar} gab es eine extrem wichtige Hypothese, während \ref{frage} noch nicht abschliessend geklärt ist!
\end{document}

enter image description here

1
  • I suggest the usage of cleveref in order to make the reference formating nicer
    – user31729
    Commented Aug 30, 2016 at 12:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .