Document ClassesSetting initial counter for environment

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

Setting initial counter for environment

Post by Borgia »

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

Code: Select all

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

Code: Select all

\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 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
Post Reply