LaTeX forum ⇒ Document ClassesSetting initial counter for environment

Information and discussion about specific document classes and how to create your own document classes.
Borgia
Posts: 3
Joined: Sun Nov 05, 2023 10:51 pm

Setting initial counter for environment

Postby Borgia » Mon Nov 06, 2023 9:54 am

How can I have the ability for the user to use an initial item counter, rather than always starting from 1 ?

Thus having the list

<21>1.
   <22>1.
   <22>2.
      <23>1.
      <23>2.
      <23>3.


\documentclass[a4paper,10pt]{article}

\usepackage{enumitem}

\ExplSyntaxOn

\makeatletter
\setlistdepth{13}
\newlist{wvTlaps}{enumerate}{13}
\setlist[wvTlaps]
  {
    label=$\langle$\the\enit@depth$\rangle$\arabic*.,
    parsep=0pt, left=0pt,
    itemindent=8pt,
  }
\makeatother

\NewDocumentEnvironment {wvTlapis} { }
    {
      \begin{wvTlaps}
    }
  { \end{wvTlaps} }

\ExplSyntaxOff

\begin{document}

\begin{wvEnum}
    \item First level
    \begin{wvEnum}
        \item Second level
        \begin{wvEnum}
            \item Third level
        \end{wvEnum}
    \end{wvEnum}
\end{wvEnum}

\end{document}

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics

Return to “Document Classes”

Who is online

Users browsing this forum: No registered users and 9 guests