%% LaTeX2e file `etocsnippet-07.tex'
%% generated by the `filecontentshere' environment
%% from source `etoc' on 2023/10/29.
%%
\makeatletter
\newcommand{\MyLocalTOC}[1][section]{%
  \begingroup
  \etocsetstyle{section}{}{}
    {\l@section{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
  \etocsetstyle{subsection}{}{}
    {\l@subsection{\numberline{\etocnumber}\etocname}{\etocpage}}{}%
  \etocsetstyle{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
