help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AW: Question about Latex Style files


From: Heime
Subject: Re: AW: Question about Latex Style files
Date: Tue, 07 Nov 2023 08:40:04 +0000

In this code, the third level picks up the colour value from level two.  
But I want the third level to take the default red colour value.

How does one apply a default set of keys at the start of each environment 
exactly ? Shouldn't \keys_set:nn {tlapis_keys} {#1} do that ?

    \documentclass[a4paper,10pt]{article}
    \usepackage{xcolor}
    \usepackage{enumitem}
    
    \ExplSyntaxOn
    
    \makeatletter
    \setlistdepth{13}
    \newlist{wvTlaps}{enumerate}{13}
    \setlist[wvTlaps]
      {
        label=$\langle$\the\enit@depth$\rangle$\arabic*.,
        left=0pt, parsep=0pt, itemindent=8pt,
      }
    \makeatother
    
    \tl_new:N \l_tlapis_kl_tl
    \tl_new:N \l_tlapis_lv_tl
    
    \keys_define:nn { tlapis_keys }
      %% Define Key-Value Interface within namespace tlapis_keys.
      {
        kl .tl_set:N = \l_tlapis_kl_tl,
        kl .default:n = {red},
        kl .initial:n = {red},
    
        lv .tl_set:N = \l_tlapis_lv_tl,
        lv .default:n = {},
        lv .initial:n = {},
      }
    
    \NewDocumentEnvironment {wvTlapis} { O{} }
        {
          \keys_set:nn {tlapis_keys} {#1}
    
          \tl_if_empty:NTF {\l_tlapis_lv_tl}
              {
                \begin{wvTlaps}[format=\color{\l_tlapis_kl_tl}]
              }
            {
              \begin{wvTlaps}
                [format=\color{\l_tlapis_kl_tl},
                 label=$\langle$\l_tlapis_lv_tl$\rangle$\arabic*.]
            }
          }
        { \end{wvTlaps} }
    
    \ExplSyntaxOff
    
    \begin{document}
    
    \begin{wvTlapis}
        \item First level
        \begin{wvTlapis}[kl=green]
            \item Second level
            \begin{wvTlapis}
                \item Third level
            \end{wvTlapis}
        \end{wvTlapis}
    \end{wvTlapis}
    
    \end{document}


------- Original Message -------
On Tuesday, November 7th, 2023 at 4:47 AM, Alois Steindl 
<Alois.Steindl@tuwien.ac.at> wrote:


> Hello, 
> on https://tug.org/begin.html you could find a lot of useful links.
> Further I would recommend the LaTeX Companion, which should answer quite all 
> possible questions.
> Good luck 
> Alois
> 
> ------ Originalnachricht------
> Von: Heime
> Datum: Mo., 6. Nov. 2023 17:15
> An: Heime via Users list for the GNU Emacs text editor;
> Cc:
> Betreff:Question about Latex Style files
> 
> 
> Is there any place where I can ask a question about
>  Latex Style files ?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]