[Tex/LaTex] Section Commands Inside Enumerate Environment

#enumeratesectioning

I would like to have subsection commands both before and inside an enumerate environment:

\subsection*{Instantaneous Velocity}

\begin{enumerate}
    \item[\textsf{\textbf{Example 1}}] The table below gives the position $s$ of a car at time $t$.

    \begin{enumerate}
         \item Find the average velocity over the following intervals.
            \begin{enumerate}
                \item $0 \leq t \leq 0.4$
            \end{enumerate}
        \item Estimate the instantaneous velocity at $t=0.4$.
    \end{enumerate} 
\vfill

\subsection*{Defining Instantaneous Velocity Using the Idea of a Limit}

        \item[\textsf{\textbf{Example 2}}] Yackety yack yack

    \vfill

\end{enumerate}

When I compile this, the subsection inside the enumerate environment is indented (clearly, to match the enumerate environment) but I would like for it to align with the subsection that is outside of the enumerate environment.

I am aware of \suspend \resume and \interitemtext, but was wondering if there might be some simple(er) solution to this, or a basic concept that I might be missing.

Best Answer

You have a simple solution with the enumitempackage (no need to manually number the outer enumerate). The idea is just to close the enumerate environment at the end of the subsection and to open another one with the resume* option after the beginning of the next section:

        \documentclass[12pt, a4paper]{article}
        \usepackage[utf8]{inputenc}
        \usepackage[T1]{fontenc}
        \usepackage{lmodern}

        \usepackage{enumitem}

        \begin{document}

        \subsection*{Instantaneous Velocity}

        \begin{enumerate}[label =\textsf{\textbf{Example \arabic*. }}, wide,labelindent = 0pt]
            \item The table below gives the position $s$ of a car at time $t$.

            \begin{enumerate}
                 \item Find the average velocity over the following intervals.
                    \begin{enumerate}
                        \item $0 \leq t \leq 0.4$
                    \end{enumerate}
                \item Estimate the instantaneous velocity at $t=0.4$.
            \end{enumerate}
        \end{enumerate}
        \vfill

        \subsection*{Defining Instantaneous Velocity Using the Idea of a Limit}

        \begin{enumerate}[resume*]

                \item  Yackety yack yack

        \end{enumerate}
        \vfill
        \end{document}

enter image description here

Related Question