Text FormattingUsing l3keys module for a command

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Borgia
Posts: 4
Joined: Sun Nov 05, 2023 10:51 pm

Using l3keys module for a command

Post by Borgia »

I'd like to understand how to use the l3keys module.

After defining a set of keys with

Code: Select all

\keys_define:nn { mykeys } { ... }
how do I write a command that applies these keys?

For example, I have the following command:

Code: Select all

\NewDocumentCommand {\bh} { o }
  {
    \tl_if_single:nF {#1}
      { \keys_set:nn {mykeys} {#1} }
  }
I'm not entirely sure how to make this command accept key-value
options from the user and apply the definitions I set up with
\keys_define:nn.

Could it be explained how to properly structure such a command so that
it processes keys both from the user input and from the predefined key
set?

A minimal working example of how to define keys and use them in a command
would be important.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Post Reply