%% LaTeX2e file `etocsnippet-07.tex'
%% generated by the `filecontentshere' environment
%% from source `etoc' on 2026/05/05.
%%
\makeatletter
\newcommand{\MyLocalTOC}[1][section]{%
  \begingroup
  \etocsetlinestyle{chapter}{}{}
    {\l@chapter{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
  \etocsetlinestyle{section}{}{}
    {\l@section{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
  \etocsetlinestyle{subsection}{}{}
    {\l@subsection{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
  \etocsetlinestyle{subsubsection}{}{}
    {\l@subsubsection{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
  % etc... if further sectioning units are needed
  %        (i.e. not excluded by tocdepth and actually there in document)
  % Here #1 defaults to section, meaning this is appropriate
  % for local TOC in a chapter
  \etocsettocstyle{\@nameuse{#1}*{Local contents}}
                  {}%
  %
  \localtableofcontents
  \endgroup}
\makeatother
