Questions tagged [expl3]

{expl3} is the programming "language" written for the LaTeX3 project. It is a library of common functions for storing and manipulating data and performing higher-level logical tasks than commonly provided for in TeX and LaTeX.

Filter by
Sorted by
Tagged with
8 votes
1 answer
296 views

Seeking Enhancements and Solutions for Dynamic LaTeX Command Substitution

I am engaging with the community to seek insights and possible solutions for a LaTeX macro customisation. This is inspired by a discussion in this thread, which explores the possibility of dynamically ...
2 votes
2 answers
114 views

Command that expands to `{ <output> }` instead of `<output>`

I'd like to define a command which expands to { <output> } instead of <output>. I've tried wrapping the command contents with additional { / } \bgroup / \egroup \begingroup / \endgroup \...
3 votes
2 answers
160 views

expl3 — fully expand before \use:c

Consider \def\niii{10} \def\niiii{21} I can easily obtain it via \use:c {niii} % 10 \use:c {niiii} % 21 However I would like to create csname dynamically using \int_step_inline:nn {4} {i}. I tried ...
2 votes
2 answers
113 views

Understanding expansion in \addtocontents

I am confused about how expansion works in \addtocontents, or more precisely in \protected@write. As I understand it, \addtocontents should essentially expand its second argument with \protected@edef ...
1 vote
0 answers
40 views

"Merge" subsequent counter-based commands

I'm trying to implement two simple paragraph numbering commands \verse and \subverse. When a \verse command is followed by a \subverse (irrespective of spaces and new lines), only the subverse counter ...
2 votes
0 answers
50 views

How do I use commands with spaces with Expl mode on?

The Problem I want to put a command inside an xparse section so I can do a fancy little if/else option. However, the command I am issuing includes a native space inside the options: TikZ's node ...
2 votes
1 answer
81 views

expl3 renew msg?

Using lualatex, Linux, TeXlive 2023. When fontspec cannot find a requested font, it issues a message, defined as follows (using expl3): \__fontspec_msg_new:nnn {font-not-found} { The font "#1&...
1 vote
1 answer
102 views

Braces in l3keys

In many cases, the braces surrounding values to keys in l3keys are omitted when defining keys, even when the keys themselves have n-,c-, or e-type arguments, which normally require braced arguments. ...
0 votes
1 answer
37 views

Compound glossaries command with proper sub- and superscripts and custom arguments

I would like to create a macro which helps in combining gls-symbols. Each compound symbol should consist of a body and (optionally) a super and subscript (which are itself gls symbols and get listed ...
1 vote
1 answer
71 views

\regex_match is not working as expected

I have the following macro and the following input: \def\something#1{ \regex_extract_all:nnN{ ([A-Za-z]{1}\d{1,2})\s*-\|\s*([A-Za-z]{1}\d{1,2}) }{#1}\l_my_seq \...
7 votes
1 answer
189 views

expl3's regex_replace_all has a problem with German ß, why?

EDIT: Solution for this problem below. I'm trying to have an in-text direct replacement of entire words, but it seems using regex_replace_all does not work properly as it does not find a word ending ...
2 votes
1 answer
4k views

The L3 programming layer in the LaTeX format is outdated

I'm submitting my manuscript to a journal. It required me to provide the .tex file. Everything is ok when I compile the source file on overleaf or my local texlive. But the submission system failed to ...
0 votes
0 answers
35 views

Change xeCJK without editing its source code

In xeCJK.sty there is this command: \clist_const:Nn \c__xeCJK_CJK_chars_clist { "02EA -> "02EB , "2E80 -> "2EFF , "2F00 -> "2FDF , "2FF0 -&...
2 votes
1 answer
101 views

Searching a list of words using Boolean operators

In the project I'm currently working on, the user can define, within an environment defined by the project, a list of tags, stored internally in a macro (for example, \tags). Each item in this list ...
5 votes
4 answers
1k views

Command to sum values in a list

I'm a novice to expl3. Can something list this be done? \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\sumlist}{m}{ \clist_add:n { #1 } } \ExplSyntaxOff \begin{...
3 votes
0 answers
120 views

Best practices for setting package options mid-document

I am currently working on a package where the user can set the package options mid-document or within a local group. Currently, the user can do this via the user commands \set<package>keys or \...
2 votes
2 answers
149 views

can l3keys process multiple 'submodule'?

I would like to know if I can use l3keys to process multiple submodules as pgfoption can do ? Here is a MWE to illustrate my question: a package file mypkg.sty (containing in comment the error I get ...
4 votes
3 answers
185 views

Expl3 to simplify expansion issues with loop-built Tabularray content

A follow-on from my previous question answered thanks to @egreg. (Perhaps Prof. Gregorio would be able to help me here too.) Situation I am creating a Table of Questions (ToQ) macro for creating ...
1 vote
3 answers
80 views

How to pass multiple parameters to `\clist_map_function`?

I try to use a clist for the parameters for a function. One parameter, however, can contain also additional optional parameters for the function. How can I do that? \documentclass{article} \...
3 votes
1 answer
64 views

`\str_if_eq:NcTF` does not work but `\str_case:NnTF` does?

Why is the commented code (with \str_case:NnTF) working but the code with \str_if_eq:NcTF not? I want to overwrite the value of \l__ghs_signalword only if is not set to Gefahr... \documentclass{...
3 votes
2 answers
95 views

Iterating over seq and using \str_case with content of seq does not work

I try to give multiple arguments to a function using a comma seperated list (clist). This seems to work and I can also iterate over the elements by using a seq. However, using the elements of the seq ...
2 votes
2 answers
73 views

LaTeX does not finish compiling (infinite loop, maybe) when I place multiple \tl_use commands inside the \bool_until_do loop

I am trying to retrieve data from a .aux file using expl3. I want to ignore the first line because it serves a different purpose (hence the \ior_str_get:NN \l_seccion_lista_ior \l_tmpa_tl). The ...
5 votes
1 answer
103 views

Font encoding affects \box_wd:N calculation

I have written a simple function to calculate the width of a line of text and display it using tikz: \documentclass{article} %\usepackage{mathpazo} \usepackage{domitian} \usepackage[T1]{fontenc} %\let\...
2 votes
0 answers
64 views

Undefined control sequence \tl_gput_right:Ne

A user reported to me that when using the document class Q-and-A, an error of Undefined control sequence occurs: ! Undefined control sequence. <argument> \tl_gput_right:Ne ...
3 votes
1 answer
131 views

"Label multiply defined" with new cross-referencing properties

When recording multiple different properties (see texdoc ltproperties-doc or online) for the same label, warnings are issued. I am not able to record all properties at the same time (some must be ...
0 votes
1 answer
60 views

Trying to expand items within a newglossaryentry in a generic function without causing the Improper alphabetic constant

I've looked at both these related topics, but my situation is a little bit different. improper alphabetic constant with-glossaries improper alphabetic constant The first thing I found in the ...
0 votes
2 answers
196 views

Calling a Global Variable using Expl3

I've written a macro for my document that producing a random discontinuous but otherwise smooth curve, given a few randomly assigned points. I then ask what the output is for particular (not random) ...
0 votes
2 answers
178 views

Preserving newlines in body of \NewDocumentEnvironment when writing to an external file

I am working on a system for providing hints for exercises in a different location of the typeset document. The current approach is based on saving the content of the hint environment to a file. This ...
9 votes
1 answer
362 views

New cs variants

In the very recent 2023-10-10 l3kernel update, (See: https://www.ctan.org/pkg/l3kernel), it looks like many new argument-specifier variants of existing control sequences were added to the kernel, ...
3 votes
1 answer
90 views

Test if a user command is at the end of the document

Is there any chance for a command \testcommand to test if it is the last user command before \end{document}? Since there are still hooks at enddocument, this seems a little bit tricky. I am thinking ...
2 votes
1 answer
159 views

footnotes in boxes compatible with hyperref

I am trying to implement a support for \footnote in a horizontal list (boxed) environment based on shortlst and ported (more less) to expl3. The trick used in shortlst is taken from the tabularx ...
0 votes
3 answers
62 views

Defining a command that applies an inline function to each element in a list and saves the result to multiple commads

I would like to modify/extend a collection of pre-existing macros with an inline code that the user provides as an argument. Consider we have multiple variables, for instance: \def\mon{Monday} \def\...
0 votes
0 answers
67 views

Sort a property list (`l3prop`) by keys

How to sort a property list by keys? There is a \clist_sort but no \prop_sort function. My workaround is to create a clist with the keys of the property list, sort the clist, and then create a new ...
1 vote
2 answers
110 views

Access option and argument with same name

I'm trying to understand the scope of variables in latex3 and to construct an example of a function that takes an option and an argument of a command both (option and argument) having the same name. ...
14 votes
5 answers
1k views

Sorting a comma-separated list with LaTeX?

Is there a simple way to sort a comma separated list alphabetically in LaTeX? I tried to write a macro (\sortlist{World, Hello} → "Hello, World") using the l3sort documentation example but it ...
2 votes
2 answers
360 views

How to simplify the code below by using cycles?

\documentclass{article} \newcommand[3]{\mycounter}{a=#1, b=#2, c=#3} \begin{document} \mycounter{1}{2}{3} \mycounter{4}{5}{6} Too much… and the last line is \mycounter{28}{29}{30} \end{document} I ...
1 vote
1 answer
78 views

expl3/xparse: expansion, comparing tokens and xparse-defined macros

What is the correct (preferred?) way to do comparisons of whether a particular token---in my examples, it's typically a single character, but it could be something like \mathcal{A} or \mathbf{b} and ...
5 votes
1 answer
281 views

When should we use \cs_new...nopar?

I ask about some of the best practices for programming expl3 code. Section 4 of interface3.pdf describes functions that define new control sequences that prohibit \par in their function parameters (#1,...
2 votes
1 answer
114 views

expl3: peek_charcode_remove:NTF doesn't recognize \c_math_subscript_token

I have observed that the \peek_charcode:NTF and related functions do something unexpected. The functions do what I expect when the next character is ^ and I call, say, \peek_charcode_remove:NTF \...
2 votes
2 answers
146 views

int_case leads to missing number problem when using multiple digits

Somehow my code breaks with Missing number, treated as zero... \documentclass{article} \ExplSyntaxOn \newcommand{\Hsatz}[1]{% \int_case:nn { #1 }{ { 225 } { abc } { 319​ } { def }...
2 votes
1 answer
167 views

Replace "\def" and "\@ifnextchar" with "expl3" code in list environment

I was trying to answer another question I asked here in the forum (How to modify the horizontal and vertical spacing between "\item" in shortenumerate (shortlst)?) regarding the shortlst ...
3 votes
0 answers
63 views

How can I improve the coloring of macrocode envronments?

In my opinion l3 layer code readability in macrocode environments, using the doc/docstrip system can be improved by adding a bit of color to the macros. I wrote some code to do this and an example of ...
4 votes
1 answer
93 views

How to use similar package and command keys, should they be separate or the same variable?

I am writing a expl3 package for typesetting amino acid residues and I am still getting to grips with LaTeX3 and the interfaces documentation. I have looked at the nicematrix annotated code for ...
4 votes
1 answer
108 views

Is `.code:n` still a last resort when setting LaTeX3 keys and if so, why?

I am making headway with a expl3 package I am writing, hence many questions on this subject, but I was reading an answer by @egreg to What are best practices when augmenting and building on the keys ...
6 votes
0 answers
96 views

(Corrected) updated \l_file_search_path_seq (expl3) no longer recognises `~` (TeX Live 2023 updated yesterday)

[This is an amended version of Updated \l_file_search_path_seq (expl3) no longer recognises `~` (TeX Live 2023 updated yesterday), which isn't the question I needed to ask.] After updating TeX Live ...
5 votes
1 answer
181 views

Updated \l_file_search_path_seq (expl3) no longer recognises `~` (TeX Live 2023 updated yesterday)

[This question is an erroneous version of (Corrected) updated \l_file_search_path_seq (expl3) no longer recognises `~` (TeX Live 2023 updated yesterday).] After updating TeX Live 2023 using tlmgr ...
0 votes
0 answers
61 views

Converting commands with arguments to expl3 [duplicate]

How would one convert this to expl3 version ? \newcommand{\piston_bfblue}[1]{\textcolor{blue}{\textbf{#1}}}
0 votes
1 answer
74 views

Generating variants

Does the following command just add an additional name for the function ? Would the arguments be identical to the original function ? \cs_generate_variant:Nn \feuds_newteorema_simple:nn { VV }
2 votes
2 answers
81 views

Expl3 - Fill a tabularray in xskakloop

I would like to fill a tabularray tblr or longtblr environment using the \xskakloop command of the xskak package. I would like to use expl3 if possible. I have tried looking into the xskak source code ...
11 votes
1 answer
624 views

How to create an active tilde in LaTeX 3

I have some LaTeX3 code that generates matrices and uses the hhline package internally. In LaTeX3 the ~ character is a special character, used for inserting spaces in strings, and using \c_tilde_str ...

1
2
3 4 5
30