1

This question is a little harder to explain without a brief description of the Maximal Working Example which includes the main functionality of a package I'm writing, so I've included this below before actually getting to the point:

% arara: lualatex
% arara: lualatex
\documentclass{article}
\usepackage{xparse}
\usepackage{expl3}
\usepackage{l3keys2e}
\usepackage{chngcntr}

\setlength\parindent{0pt}

\ExplSyntaxOn

\cs_new:Nn \__teachingtools_print_question: {
    \str_clear_new:N \l__teachingtools_question_str
    \str_put_left:Nn \l__teachingtools_question_str { Question }
    \bool_if:NT \l__teachingtools_numbered_question_bool {
        \refstepcounter{question}
        \str_put_right:Nn \l__teachingtools_question_str { ~ }
        \__teachingtools_print_question_label:
        \str_put_right:Nx \l__teachingtools_question_str { \l__teachingtools_question_label_str }
    }
    \str_put_right:Nx \l__teachingtools_question_str { \l__teachingtools_suffix_character_str }

    % Prints format string of label in terminal: how can I use this to change the
    % printing of \refl{qu:label}?
    % \tl_show:N \l__teachingtools_question_label_format_tl
    % It can be used as an argument to `\renewcommand\thequestion`, and appears to work, with the caveat that the redefinition is local to the group created by each environment instance.
    \renewcommand\thequestion{ \l__teachingtools_question_label_format_tl }

    \par \skip_vertical:N \l__teachingtools_questionbefore_skip
    \group_begin:
    \bfseries \l__teachingtools_question_str \par\nopagebreak
    \group_end:
}
\cs_new:Nn \__teachingtools_print_question_label: {
    \str_clear_new:N \l__teachingtools_question_label_str
    \tl_clear_new:N \l__teachingtools_question_label_format_tl
    \bool_if:NT \l__teachingtools_question_prefix_bool {
        \str_put_right:Nx \l__teachingtools_question_label_str { \l__teachingtools_question_prefix_tl }
        \str_put_right:Nx \l__teachingtools_question_label_str { \l__teachingtools_prefix_separator_str }
        \tl_put_right:NV \l__teachingtools_question_label_format_tl { \l__teachingtools_question_prefix_tl }
        \tl_put_right:NV \l__teachingtools_question_label_format_tl { \l__teachingtools_prefix_separator_str }
    }
    \str_put_right:Nx \l__teachingtools_question_label_str { \l__teachingtools_question_label_tl }
    \tl_put_right:NV \l__teachingtools_question_label_format_tl { \l__teachingtools_question_label_tl }
}
\newcounter{question}
\keys_define:nn { teachingtools / question } {
    reset .default:n = section,
    reset .choices:nn = {
        part, chapter, section, subsection, subsubsection, paragraph, subparagraph
    }
    {
        \counterwithin*{question}{ \tl_to_str:N \l_keys_choice_tl }
    },
    reset / none .code:n = {
        \counterwithout*{question}{section}
    },
}
\bool_new:N \l__teachingtools_numbered_question_bool
\keys_define:nn { teachingtools } {
    question / number .code:n = {
        \int_set_eq:NN \l_tmpa_int #1
        \int_decr:N \l_tmpa_int
        \setcounter{question}{ \int_use:N \l_tmpa_int }
    },
}
\str_new:N \l__teachingtools_prefix_separator_str
\keys_define:nn { teachingtools } {
    prefix-separator .choice:,
    prefix-separator / dash .code:n = {
        \str_set:Nn \l__teachingtools_prefix_separator_str { - }
    },
    prefix-separator / dot .code:n = {
        \str_set:Nn \l__teachingtools_prefix_separator_str { . }
    },
    prefix-separator / colon .code:n = {
        \str_set:Nx \l__teachingtools_prefix_separator_str { \c_colon_str }
    },
    prefix-separator / none .code:n = {
        \str_gclear:N \l__teachingtools_prefix_separator_str
    },
    prefix-separator .default:n = none,
    prefix-separator .initial:n = none,
}
\tl_new:N \l__teachingtools_question_prefix_tl
\bool_new:N \l__teachingtools_question_prefix_bool
\keys_define:nn { teachingtools / question } {
    prefix .choice:,
    prefix / part .code:n = {
        \tl_set:Nn \l__teachingtools_question_prefix_tl { \thepart }
        \keys_set:nn { teachingtools } {
            question / reset = part,
            prefix-separator = dash,
        }
        \bool_set_true:N \l__teachingtools_question_prefix_bool
    },
    prefix / chapter .code:n = {
        \tl_set:Nn \l__teachingtools_question_prefix_tl { \thechapter }
        \keys_set:nn { teachingtools } {
            question / reset = chapter,
            prefix-separator = dash,
        }
        \bool_set_true:N \l__teachingtools_question_prefix_bool
    },
    prefix / section .code:n = {
        \tl_set:Nn \l__teachingtools_question_prefix_tl { \thesection }
        \keys_set:nn { teachingtools } {
            question / reset = section,
            prefix-separator = dash,
        }
        \bool_set_true:N \l__teachingtools_question_prefix_bool
    },
    prefix / subsection .code:n = {
        \tl_set:Nn \l__teachingtools_question_prefix_tl { \thesubsection }
        \keys_set:nn { teachingtools } {
            question / reset = subsection,
            prefix-separator = dash,
        }
        \bool_set_true:N \l__teachingtools_question_prefix_bool
    },
    prefix / subsubsection .code:n = {
        \tl_set:Nn \l__teachingtools_question_prefix_tl { \thesubsubsection }
        \keys_set:nn { teachingtools } {
            question / reset = subsubsection,
            prefix-separator = dash,
        }
        \bool_set_true:N \l__teachingtools_question_prefix_bool
    },
    prefix / paragraph .code:n = {
        \tl_set:Nn \l__teachingtools_question_prefix_tl { \theparagraph }
        \keys_set:nn { teachingtools } {
            question / reset = paragraph,
            prefix-separator = dash,
        }
        \bool_set_true:N \l__teachingtools_question_prefix_bool
    },
    prefix / subparagraph .code:n = {
        \tl_set:Nn \l__teachingtools_question_prefix_tl { \thesubparagraph }
        \keys_set:nn { teachingtools } {
            question / reset = subparagraph,
            prefix-separator = dash,
        }
        \bool_set_true:N \l__teachingtools_question_prefix_bool
    },
    prefix / none .code:n = {
        \tl_gclear:N \l__teachingtools_question_prefix_tl
    },
    prefix .default:n = none,
    prefix .initial:n = none,
}
\tl_new:N \l__teachingtools_question_label_tl
\keys_define:nn { teachingtools / question } {
    label .choice:,
    label / arabic .code:n = {
        \tl_set:Nn \l__teachingtools_question_label_tl { \arabic{question} }
    },
    label / alph .code:n = {
        \tl_set:Nn \l__teachingtools_question_label_tl { \int_to_alph:n { \value{question} } }
    },
    label / lower-alph .code:n = {
        \tl_set:Nn \l__teachingtools_question_label_tl { \int_to_alph:n { \value{question} } }
    },
    label / upper-alph .code:n = {
        \tl_set:Nn \l__teachingtools_question_label_tl { \int_to_Alph:n { \value{question} } }
    },
    label / roman .code:n = {
        \tl_set:Nn \l__teachingtools_question_label_tl { \roman{question} }
    },
    label / lower-roman .code:n = {
        \tl_set:Nn \l__teachingtools_question_label_tl { \roman{question} }
    },
    label / upper-roman .code:n = {
        \tl_set:Nn \l__teachingtools_question_label_tl { \Roman{question} }
    },
    label .default:n = arabic,
    label .initial:n = arabic,
}
\str_new:N \l__teachingtools_suffix_character_str
\keys_define:nn { teachingtools } {
    suffix-character .choice:,
    suffix-character / dot .code:n = {
        \str_set:Nn \l__teachingtools_suffix_character_str { . }
    },
    suffix-character / colon .code:n = {
        \str_set:Nx \l__teachingtools_suffix_character_str { \c_colon_str }
    },
    suffix-character / bracket .code:n = {
        \str_set:Nx \l__teachingtools_suffix_character_str { ) }
    },
    suffix-character / none .code:n = {
        \str_gclear:N \l__teachingtools_suffix_character_str
    },
    suffix-character .default:n = dot,
    suffix-character .initial:n = dot,
}
\skip_new:N \l__teachingtools_questionbefore_skip
\skip_new:N \l__teachingtools_questionafter_skip

\skip_set:Nn \l__teachingtools_questionbefore_skip { 1.0ex plus -1ex minus -0.25ex }
\skip_set:Nn \l__teachingtools_questionafter_skip { 1ex plus 0.25ex }

\NewDocumentEnvironment { question } { s O { } } {
    \IfBooleanTF #1
    { \bool_set_false:N \l__teachingtools_numbered_question_bool }
    { \bool_set_true:N \l__teachingtools_numbered_question_bool }

    \keys_set:nn { teachingtools / question } {#2}
    \__teachingtools_print_question:

    \itshape
    }
{\par \skip_vertical:N \l__teachingtools_questionafter_skip \thequestion} % The `\thequestion` here is simply to illustrate the changing definition

\NewDocumentCommand \ttsetup { m } {
    \keys_set:nn { teachingtools } {#1}
}
\ProcessKeysOptions { teachingtools }
\ExplSyntaxOff

\begin{document}

% Most options set with `\ttsetup` can also be applied on specific instances
% of the `question` environment.  Of most use in this scenario is the
% `number` option, which has the same effect as `\setcounter{question}`; the
% others are of limited use but I've made them available anyway.
\ttsetup{
    % prefix-separator = dash,             % (dash|dot|colon|none)
    question / prefix = section,           % (part|chapter|section|subsection|subsubsection|paragraph|subparagraph|none)
    question / reset = none,               % (part|chapter|section|subsection|subsubsection|paragraph|subparagraph|none)
    question / label = upper-alph,         % (arabic|lower-alph|upper-alph|lower-roman|upper-roman)
    suffix-character = bracket,            % (dot|colon|bracket|none)
    % question / number = 1,               % any integer
}

\section{A section}

\begin{question}
    The question in a section
\end{question}

\thequestion  % Should be 1-A, prints 1 instead

\subsection{A subsection}

\begin{question}
    The question in a subsection
\end{question}

\begin{question}[number = 7]
    Another question in a subsection
\end{question}

\subsubsection{A subsubsection}

\begin{question}\label{qu:test}
    The question in a subsubsection
\end{question}

\begin{question}
    Another question in a subsubsection
\end{question}

\section{Another section}

\begin{question}
    Another question in another section
\end{question}

See also \ref{qu:test}.

\begin{question}
    Another question in another section
\end{question}

\subsection{A subsection}

\begin{question}
    The question in a subsection
\end{question}

\begin{question}
    Another question in a subsection
\end{question}

\begin{question}
    Another question in a subsection
\end{question}

\subsubsection{A subsubsection}

\begin{question}
    The question in a subsubsection
\end{question}

\begin{question}
    Another question in a subsubsection
\end{question}

\subsubsection{A subsubsection}

\begin{question}
    The question in a subsubsection
\end{question}

\begin{question}
    Another question in a subsubsection
\end{question}

\end{document}

In a nutshell, this package will define environments to typeset question/answer pairs, as well as a few other things, for use in academic worksheets, like tutorials, textbooks, exams, lecture notes, etc. In order to provide for the most flexibility, the numbering style of these environments can be changed on-the-fly, either with a dedicated command or by passing options to the environment instances. The MWE above does these things, as can be demonstrated by changing various options in the \ttsetup macro.

My current problem is that I want to also change the way references to labelled questions are printed, so that if the question number is 3-B, the reference will print "3-B" instead of "2". Is this possible, and if so, how might I go about doing this? I've been looking at cleveref for some hints, but I think I'll need to make my modifications at the level below; once I get it working I can always add a patch to cleveref later.

So far, I've managed to get it to print out the correct label format in the terminal, using the string \l__teachingtools_question_label_format_tl; passing that through to \renewcommand{\thequestion} via a l3→2e wrapper macro breaks in rather weird ways, as could be expected. My hunch is that I'm part way there, but I don't know nearly enough about 2e or l3 to get the interfaces to behave in a sensible manner.

  • 1
    I don't mean to discourage you writing your package but have seen xsim? – Henri Menke Dec 13 '17 at 3:58
  • Isn't this how the default system works without your package: if the question number is '3-B', \ref produces '3-B'. – cfr Dec 13 '17 at 4:08
  • 2
    @cfr xsim (formerly exsheets) solves the exact same problem teachingtools attempts to solve, i.e. typeset question-answer pairs for exercise sheets. – Henri Menke Dec 13 '17 at 4:11
  • 2
    Off-topic: a new environment always initiates a group, so you don't need to group the contents explicitly. And \itshape is a switch. Treating itshape as an environment works by (intentional on Lamport's part) sleight of hand. But it is still a switch. I'm no expert, but \cs_new_eq:cN {endexample*} \endexample really doesn't look right, even setting aside the wholesale repudiation of the l3 naming guidelines. And what is the point of \cs_new:cpn {example*} {\example*}? – cfr Dec 13 '17 at 4:23
  • 2
    You really, really, really should read the naming guidelines. Not only your macros, but your variables all ignore them, too. There's a system to the naming - it isn't required for code to work, but it is required for it to play nicely with other code and to be easily readable by others. \skip_new:N \questionbefore is wrong. It should be something like \skip_new:N \l_teachingtools_questionbefore_skip or \skip_new:N \g_teachingtools_questionbefore_skip, depending on whether you are treating it as local (with e.g. _set_, _clear_) or global (e.g. _gset_, _gclear_). – cfr Dec 13 '17 at 4:29
1

This code seems to do the trick. The \g__teachingtools_question_label_format_tl needs to be rendered by a separate function, and then called once at the beginning of the document to generate the initial value. After that it will be regenerated each time a question environment is created, and that sets the references correctly.

% arara: lualatex
% arara: lualatex
\documentclass{article}
\usepackage{xparse}
\usepackage{expl3}
\usepackage{l3keys2e}
\usepackage{chngcntr}

\setlength\parindent{0pt}

\ExplSyntaxOn

\cs_new:Nn \__teachingtools_print_question: {
    \teachingtools_generate_question_label_format:
    \str_clear_new:N \l__teachingtools_question_str
    \str_put_left:Nn \l__teachingtools_question_str { Question }
    \bool_if:NT \l__teachingtools_numbered_question_bool {
        \refstepcounter{question}
        \str_put_right:Nn \l__teachingtools_question_str { ~ }
        \__teachingtools_print_question_label:
        \str_put_right:Nx \l__teachingtools_question_str { \l__teachingtools_question_label_str }
    }
    \str_put_right:Nx \l__teachingtools_question_str { \l__teachingtools_suffix_character_str }

    % Prints format string of label in terminal: how can I use this to change the
    % printing of \refl{qu:label}?
    % \tl_show:N \l__teachingtools_question_label_format_tl
    % \cs_gset_nopar:cpx { thequestion } { } { \l__teachingtools_question_label_format_tl }

    \par \skip_vertical:N \l__teachingtools_questionbefore_skip
    \group_begin:
    \bfseries \l__teachingtools_question_str \par\nopagebreak
    \group_end:
}
\cs_new:Nn \__teachingtools_print_question_label: {
    \str_clear_new:N \l__teachingtools_question_label_str
    \bool_if:NT \l__teachingtools_question_prefix_bool {
        \str_put_right:Nx \l__teachingtools_question_label_str { \l__teachingtools_question_prefix_tl }
        \str_put_right:Nx \l__teachingtools_question_label_str { \l__teachingtools_prefix_separator_str }
        \tl_gput_right:NV \g__teachingtools_question_label_format_tl { \l__teachingtools_question_prefix_tl }
        \tl_gput_right:NV \g__teachingtools_question_label_format_tl { \l__teachingtools_prefix_separator_str }
    }
    \str_put_right:Nx \l__teachingtools_question_label_str { \l__teachingtools_question_label_tl }
    \tl_gput_right:NV \g__teachingtools_question_label_format_tl { \l__teachingtools_question_label_tl }
}
\tl_new:N \g__teachingtools_question_label_format_tl
\cs_new:Nn \teachingtools_generate_question_label_format: {
    \tl_gclear:N \g__teachingtools_question_label_format_tl
    \bool_if:NT \l__teachingtools_question_prefix_bool {
        \tl_gput_right:NV \g__teachingtools_question_label_format_tl { \l__teachingtools_question_prefix_tl }
        \tl_gput_right:NV \g__teachingtools_question_label_format_tl { \l__teachingtools_prefix_separator_str }
    }
    \tl_gput_right:NV \g__teachingtools_question_label_format_tl { \l__teachingtools_question_label_tl }
}
\newcounter{question}
\keys_define:nn { teachingtools / question } {
    reset .default:n = section,
    reset .choices:nn = {
        part, chapter, section, subsection, subsubsection, paragraph, subparagraph
    }
    {
        \counterwithin*{question}{ \tl_to_str:N \l_keys_choice_tl }
    },
    reset / none .code:n = {
        \counterwithout*{question}{section}
    },
}
\bool_new:N \l__teachingtools_numbered_question_bool
\keys_define:nn { teachingtools } {
    question / number .code:n = {
        \int_set_eq:NN \l_tmpa_int #1
        \int_decr:N \l_tmpa_int
        \setcounter{question}{ \int_use:N \l_tmpa_int }
    },
}
\str_new:N \l__teachingtools_prefix_separator_str
\keys_define:nn { teachingtools } {
    prefix-separator .choice:,
    prefix-separator / dash .code:n = {
        \str_set:Nn \l__teachingtools_prefix_separator_str { - }
    },
    prefix-separator / dot .code:n = {
        \str_set:Nn \l__teachingtools_prefix_separator_str { . }
    },
    prefix-separator / colon .code:n = {
        \str_set:Nx \l__teachingtools_prefix_separator_str { \c_colon_str }
    },
    prefix-separator / none .code:n = {
        \str_gclear:N \l__teachingtools_prefix_separator_str
    },
    prefix-separator .default:n = none,
    prefix-separator .initial:n = none,
}
\tl_new:N \l__teachingtools_question_prefix_tl
\bool_new:N \l__teachingtools_question_prefix_bool
\keys_define:nn { teachingtools / question } {
    prefix .choice:,
    prefix / part .code:n = {
        \tl_set:Nn \l__teachingtools_question_prefix_tl { \thepart }
        \keys_set:nn { teachingtools } {
            question / reset = part,
            prefix-separator = dash,
        }
        \bool_set_true:N \l__teachingtools_question_prefix_bool
    },
    prefix / chapter .code:n = {
        \tl_set:Nn \l__teachingtools_question_prefix_tl { \thechapter }
        \keys_set:nn { teachingtools } {
            question / reset = chapter,
            prefix-separator = dash,
        }
        \bool_set_true:N \l__teachingtools_question_prefix_bool
    },
    prefix / section .code:n = {
        \tl_set:Nn \l__teachingtools_question_prefix_tl { \thesection }
        \keys_set:nn { teachingtools } {
            question / reset = section,
            prefix-separator = dash,
        }
        \bool_set_true:N \l__teachingtools_question_prefix_bool
    },
    prefix / subsection .code:n = {
        \tl_set:Nn \l__teachingtools_question_prefix_tl { \thesubsection }
        \keys_set:nn { teachingtools } {
            question / reset = subsection,
            prefix-separator = dash,
        }
        \bool_set_true:N \l__teachingtools_question_prefix_bool
    },
    prefix / subsubsection .code:n = {
        \tl_set:Nn \l__teachingtools_question_prefix_tl { \thesubsubsection }
        \keys_set:nn { teachingtools } {
            question / reset = subsubsection,
            prefix-separator = dash,
        }
        \bool_set_true:N \l__teachingtools_question_prefix_bool
    },
    prefix / paragraph .code:n = {
        \tl_set:Nn \l__teachingtools_question_prefix_tl { \theparagraph }
        \keys_set:nn { teachingtools } {
            question / reset = paragraph,
            prefix-separator = dash,
        }
        \bool_set_true:N \l__teachingtools_question_prefix_bool
    },
    prefix / subparagraph .code:n = {
        \tl_set:Nn \l__teachingtools_question_prefix_tl { \thesubparagraph }
        \keys_set:nn { teachingtools } {
            question / reset = subparagraph,
            prefix-separator = dash,
        }
        \bool_set_true:N \l__teachingtools_question_prefix_bool
    },
    prefix / none .code:n = {
        \tl_gclear:N \l__teachingtools_question_prefix_tl
    },
    prefix .default:n = none,
    prefix .initial:n = none,
}
\tl_new:N \l__teachingtools_question_label_tl
\keys_define:nn { teachingtools / question } {
    label .choice:,
    label / arabic .code:n = {
        \tl_set:Nn \l__teachingtools_question_label_tl { \arabic{question} }
    },
    label / alph .code:n = {
        \tl_set:Nn \l__teachingtools_question_label_tl { \int_to_alph:n { \value{question} } }
    },
    label / lower-alph .code:n = {
        \tl_set:Nn \l__teachingtools_question_label_tl { \int_to_alph:n { \value{question} } }
    },
    label / upper-alph .code:n = {
        \tl_set:Nn \l__teachingtools_question_label_tl { \int_to_Alph:n { \value{question} } }
    },
    label / roman .code:n = {
        \tl_set:Nn \l__teachingtools_question_label_tl { \roman{question} }
    },
    label / lower-roman .code:n = {
        \tl_set:Nn \l__teachingtools_question_label_tl { \roman{question} }
    },
    label / upper-roman .code:n = {
        \tl_set:Nn \l__teachingtools_question_label_tl { \Roman{question} }
    },
    label .default:n = arabic,
    label .initial:n = arabic,
}
\str_new:N \l__teachingtools_suffix_character_str
\keys_define:nn { teachingtools } {
    suffix-character .choice:,
    suffix-character / dot .code:n = {
        \str_set:Nn \l__teachingtools_suffix_character_str { . }
    },
    suffix-character / colon .code:n = {
        \str_set:Nx \l__teachingtools_suffix_character_str { \c_colon_str }
    },
    suffix-character / bracket .code:n = {
        \str_set:Nx \l__teachingtools_suffix_character_str { ) }
    },
    suffix-character / none .code:n = {
        \str_gclear:N \l__teachingtools_suffix_character_str
    },
    suffix-character .default:n = dot,
    suffix-character .initial:n = dot,
}
\skip_new:N \l__teachingtools_questionbefore_skip
\skip_new:N \l__teachingtools_questionafter_skip

\skip_set:Nn \l__teachingtools_questionbefore_skip { 1.0ex plus -1ex minus -0.25ex }
\skip_set:Nn \l__teachingtools_questionafter_skip { 1ex plus 0.25ex }

\NewDocumentEnvironment { question } { s O { } } {
    \IfBooleanTF #1
    { \bool_set_false:N \l__teachingtools_numbered_question_bool }
    { \bool_set_true:N \l__teachingtools_numbered_question_bool }

    \keys_set:nn { teachingtools / question } {#2}
    \__teachingtools_print_question:

    \itshape
    }
{\par \skip_vertical:N \l__teachingtools_questionafter_skip }
\cs_new:cpn {question*} {\question*}
\cs_new_eq:cN {endquestion*} \endquestion

\NewDocumentCommand \ttsetup { m } {
    \keys_set:nn { teachingtools } {#1}
}
\ProcessKeysOptions { teachingtools }

\renewcommand\thequestion{ \g__teachingtools_question_label_format_tl }

\ExplSyntaxOff

\usepackage{hyperref}
\hypersetup{
    colorlinks=false,
    hidelinks}
\usepackage[all]{hypcap}

\begin{document}

% Most options set with `\ttsetup` can also be applied on specific instances
% of the `question` environment.  Of most use in this scenario is the
% `number` option, which has the same effect as `\setcounter{question}`; the
% others are of limited use but I've made them available anyway.
\ttsetup{
    % prefix-separator = dash,             % (dash|dot|colon|none)
    question / prefix = section,           % (part|chapter|section|subsection|subsubsection|paragraph|subparagraph|none)
    question / reset = none,               % (part|chapter|section|subsection|subsubsection|paragraph|subparagraph|none)
    question / label = lower-alph,         % (arabic|lower-alph|upper-alph|lower-roman|upper-roman)
    suffix-character = dot,                % (dot|colon|bracket|none)
    % question / number = 1,               % any integer
}

\section{A section}

\begin{question}\label{qu:first}
    The question in a section
\end{question}

\subsection{A subsection}

\begin{question}
    The question in a subsection
\end{question}

\begin{question}[number = 7, label = lower-roman]\label{qu:lowerroman}
    Another question in a subsection
\end{question}

\subsubsection{A subsubsection}

\begin{question}\label{qu:test}
    The question in a subsubsection
\end{question}

\begin{question}
    Another question in a subsubsection
\end{question}

\section{Another section}

\begin{question}
    Another question in another section, which refers to
    \ref{qu:lowerroman}.
\end{question}

See also \ref{qu:test}, and \ref{qu:first}.

\begin{question}
    Another question in another section
\end{question}

\subsection{A subsection}

\begin{question}
    The question in a subsection
\end{question}

\begin{question}
    Another question in a subsection
\end{question}

\begin{question}
    Another question in a subsection
\end{question}

\subsubsection{A subsubsection}

\begin{question}
    The question in a subsubsection
\end{question}

\begin{question}
    Another question in a subsubsection
\end{question}

\subsubsection{A subsubsection}

\begin{question}
    The question in a subsubsection
\end{question}

\begin{question}
    Another question in a subsubsection
\end{question}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.