In the MWE below, how can I reset the value of the title key, assigned to \l__lecture_title_tl, so that the third instance of \lecture doesn't print A title?




\keys_define:nn { lecture-notes } {
  title .tl_set:N = \l__lecture_title_tl,

\NewDocumentCommand{ \lecture }{ O{} }{
  \keys_set:nn { lecture-notes } { #1 }

  \tl_set:Nn \l__section_title_tl {
    \tl_if_empty:NF \l__lecture_title_tl { \l__lecture_title_tl }





\lecture[title={A title}]

\lecture % <-- this still prints 'A title'


enter image description here

  • If I enclose the definition of the \lecture command in \group_begin: ... \group_end:, the vertical spacing between the sections is affected, and the following text is indented.
    – noibe
    Oct 6, 2020 at 16:45

1 Answer 1


Given your definition of \lecture, you get \keys_set:nn { lecture-notes } {} when the optional argument is not used, so naturally no keys are reset. Instead, you want to pass title={}. So you need \NewDocumentCommand{ \lecture }{ O{title={}} }{....

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .