%% LaTeX2e file `etocsnippet-25.tex'
%% generated by the `filecontentshere' environment
%% from source `etoc' on 2023/01/21.
%%
\makeatletter
\newcommand*\firstsubname   {}  \newcommand*\lastsubname    {}
\newcommand*\firstsubnumber {}  \newcommand*\lastsubnumber  {}
\newcommand*\thisspecialstatsaux{}
\newcommand*{\thisspecialstats}{%
  \setcounter{mycounti}{0}%
  \def\thisspecialstatsaux{%
         \let\firstsubname\etocthelinkedname
         \let\firstsubnumber\etocthelinkednumber
         \def\thisspecialstatsaux{}}
  \begingroup
  \etocsetstyle{subsection} {} {}
    {\thisspecialstatsaux
     \stepcounter{mycounti}%
     \let\lastsubname\etocthelinkedname
     \let\lastsubnumber\etocthelinkednumber }
    {Here are some statistics for this section. It contains \arabic{mycounti}
      subsections. The name of its first is \emph{\firstsubname{}} and the
      corresponding number is {\firstsubnumber}. The name of the last
      subsection is \emph{\lastsubname{}} and its number is {\lastsubnumber}.}%
   \etocsettocstyle {}{}
   \etocinline
   \etocsetnexttocdepth {1}%
   \localtableofcontents % to be used within a section
  \endgroup
}
\makeatother
