Nested theorem label

  • To have the reflection environments be numbered consecutively -- 1, 2, etc -- and be reset each time either a new proposition or question environment comes along, you should delete the instruction \renewcommand{\thereflection}{} and replace it with

    \makeatletter
    \@addtoreset{reflection}{proposition}
    \@addtoreset{reflection}{question}
    \makeatother
    

    or, equivalently and also more succinctly, as pointed out by @egreg in a comment,

    \counterwithin*{reflection}{proposition}
    \counterwithin*{reflection}{question}
    

    (This works because \counterwithin*{reflection}{proposition} is equivalent to \makeatletter \@addtoreset{reflection}{proposition} \makeatother.)

  • To get the number of the reflection environment to be prefixed with either the proposition or the question number (whichever occurred most recently), while still executing a reset whenever a proposition or question environment is encountered, you should still delete the instruction \renewcommand{\thereflection}{}, but now you should replace it with

    \usepackage{etoolbox}
    \AtBeginEnvironment{proposition}{\counterwithin{reflection}{proposition}}
    \AtBeginEnvironment{question}{\counterwithin{reflection}{question}}
    
  • By the way, if you want the proposition and question counters to be reset each time the section counter is incremented via a \section directive, you should change

    \renewcommand{\theproposition}{\thesection.\arabic{proposition}}
    

    and

    \renewcommand{\thequestion}{\thesection.\arabic{question}}
    

    to

    \counterwithin{proposition}{section}
    

    and

    \counterwithin{question}{section}
    

    respectively. Alternatively, drop the two \renewcommand statements and change the statements

    \newtheorem{proposition}{Proposition}
    

    and

    \newtheorem{question}{Question}
    

    to

    \newtheorem{proposition}{Proposition}[section]
    

    and

    \newtheorem{question}{Question}[section]
    

    respectively.

Incidentally, the second and third instances of \theoremstyle{definition} in your code are redundant and could (should?!) be omitted.


You can easily number reflection according to either proposition or question:

\documentclass[10pt,a4paper]{article}

\usepackage{amsthm}

\theoremstyle{definition}

\newtheorem{proposition}{Proposition}[section]
\newcommand{\propositionautorefname}{Proposition}

\newtheorem{question}{Question}[section]
\newcommand{\questionautorefname}{Q.}

\newtheorem{reflection}{Reflection}
\newcommand{\reflectionautorefname}{Reflection}

\counterwithin*{reflection}{proposition}
\counterwithin*{reflection}{question}

\begin{document}

\section{Title}

\begin{proposition}
My proposition
\begin{reflection}
My reflection should be numbered 1
\end{reflection}
\begin{reflection}
My reflection should be numbered 2
\end{reflection}
\end{proposition}

\begin{question}
My question
\begin{reflection}
My reflection should be numbered or 1
\end{reflection}
\begin{reflection}
My reflection should be numbered or 2
\end{reflection}
\end{question}

\end{document}

enter image description here

It's a bit more complicated if you want to add the proposition or question number.

\documentclass[10pt,a4paper]{article}

\usepackage{amsthm}

\theoremstyle{definition}

\newtheorem{propositioninner}{Proposition}[section]
\newcommand{\propositioninnerautorefname}{Proposition}
\newenvironment{proposition}
  {%
   \renewcommand{\PropositionOrQuestion}{\thepropositioninner}%
   \propositioninner
  }
  {\endpropositioninner}

\newtheorem{questioninner}{Question}[section]
\newcommand{\questioninnerautorefname}{Q.}
\newenvironment{question}
 {%
  \renewcommand{\PropositionOrQuestion}{\thequestioninner}%
  \questioninner
 }
 {\endquestioninner}

\newcommand{\PropositionOrQuestion}{}
\newtheorem{reflection}{Reflection}
\newcommand{\reflectionautorefname}{Reflection}

\counterwithin*{reflection}{propositioninner}
\counterwithin*{reflection}{questioninner}
\renewcommand{\thereflection}{\PropositionOrQuestion.\arabic{reflection}}

\begin{document}

\section{Title}

\begin{proposition}
My proposition
\begin{reflection}
My reflection should be numbered 1.1.1
\end{reflection}
\begin{reflection}
My reflection should be numbered 1.1.2
\end{reflection}
\end{proposition}

\begin{question}
My question
\begin{reflection}
My reflection should be numbered or 1.1.1
\end{reflection}
\begin{reflection}
My reflection should be numbered or 1.1.2
\end{reflection}
\end{question}

\end{document}

enter image description here