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
1 vote
3 answers
68 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} \...
mrCarnivore's user avatar
  • 1,475
3 votes
1 answer
61 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{...
mrCarnivore's user avatar
  • 1,475
3 votes
2 answers
88 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 ...
mrCarnivore's user avatar
  • 1,475
2 votes
2 answers
61 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 ...
Jonatán O. Perren's user avatar
5 votes
1 answer
99 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\...
Ted Black's user avatar
  • 453
2 votes
0 answers
49 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 ...
Jinwen's user avatar
  • 8,102
3 votes
1 answer
110 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 ...
meide's user avatar
  • 1,133
0 votes
1 answer
55 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 ...
Miraino Hikari's user avatar
3 votes
1 answer
83 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 ...
Jinwen's user avatar
  • 8,102
0 votes
3 answers
59 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\...
user3250177's user avatar
0 votes
0 answers
56 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 ...
wolfrevo's user avatar
  • 503
1 vote
2 answers
99 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. ...
wolfrevo's user avatar
  • 503
2 votes
1 answer
88 views

Embed key-values in key-values using expl3

I'm trying to embed key-values in key-values in a call like the following: \showchapter{ title=My chapter, authors={ {name=Peter,affiliation=MIT}, {name=Mary,affiliation=UCLA}, ...
wolfrevo's user avatar
  • 503
2 votes
2 answers
341 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 ...
Axia's user avatar
  • 69
2 votes
1 answer
146 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 ...
Pablo González L's user avatar
1 vote
1 answer
72 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 ...
karlh's user avatar
  • 456
5 votes
1 answer
252 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,...
User23456234's user avatar
  • 1,611
2 votes
1 answer
101 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 \...
karlh's user avatar
  • 456
2 votes
2 answers
140 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 }...
mrCarnivore's user avatar
  • 1,475
3 votes
0 answers
59 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 ...
Yiannis Lazarides's user avatar
1 vote
1 answer
158 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 ...
Pablo González L's user avatar
4 votes
1 answer
102 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 ...
JamesT's user avatar
  • 3,101
4 votes
1 answer
85 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 ...
JamesT's user avatar
  • 3,101
9 votes
1 answer
351 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, ...
User23456234's user avatar
  • 1,611
5 votes
0 answers
84 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 ...
cfr's user avatar
  • 194k
5 votes
1 answer
171 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 ...
cfr's user avatar
  • 194k
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}}}
Veak's user avatar
  • 1
0 votes
1 answer
69 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 }
Veak's user avatar
  • 1
2 votes
2 answers
75 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 ...
Fabio's user avatar
  • 125
11 votes
1 answer
611 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 ...
314159265358979323's user avatar
0 votes
1 answer
96 views

Texdoc and the various files [closed]

Have been looking at texdoc and have found texdoc interface3 texdoc source3 One of the documents states that it is a reference manual, the other that it is a reference documentation, for the L3 ...
Veak's user avatar
  • 1
1 vote
0 answers
76 views

Instructional example employing \cs_generate_variant:Nn [duplicate]

With \cs_generate_variant:Nn one can derive new function variants from a base variant by just giving the original, full function name (N) and the argument specifiers for the function to derive (n). ...
Veak's user avatar
  • 1
0 votes
1 answer
119 views

Defining new functions using parameter text and using the signature [closed]

Have been reading the expl3 document interfaces3.pdf to understand how to declare and use functions. Although I have understood that there are three main methods (new, set, gset) where each method ...
Veak's user avatar
  • 1
6 votes
1 answer
84 views

Expansion in precompiled l3keys

I'm having some issues with expansion in precompiled l3keys. I'd like to define a command \NewThm{<name>}[<options>] that sets the displayed theorem name to be a titlecased version of the ...
mbert's user avatar
  • 3,460
-2 votes
1 answer
84 views

Descriptions for n, N, V, T, F [closed]

Where can I find descriptions for n, N, V, T, F. What are they called ? Generally found after commands.
Veak's user avatar
  • 1
3 votes
2 answers
266 views

Documentation for programmers regarding expl3

Does there exist documentation for programmers regarding Latex3 ? With details about \cs, \tl, \use, and so on ?
Veak's user avatar
  • 1
3 votes
1 answer
113 views

Using lthooks to locally hook into command

Following a previous question of mine, as an exercise I'm trying to mimic the behavior of thmtools with amsthm using l3keys and lthooks. Now I am stuck on the hooks part. thmtools defines prehead, ...
mbert's user avatar
  • 3,460
9 votes
2 answers
164 views

l3keys equivalent of pgfkeys' .code 2 args

What is the recommended way to emulate pgfkeys' /.code 2 args (or more generally /.code n args) handler with l3keys? For example, with pgfkeys one can do \documentclass{article} \usepackage{pgfkeys} ...
mbert's user avatar
  • 3,460
1 vote
1 answer
58 views

Expl3 - sorting and displaying a seq in Tabularray

I want to print a sequence in a tblr environment. The \sortdata command accepts the list of integers to be sorted as well as an optional argument to specify how it should be printed out. I want to ...
M. Al Jumaily's user avatar
2 votes
1 answer
46 views

Using a token list in tabularray

I am trying to expand \mydataX a tblr environment that contains a tl variable, and getting the following error: TeX capacity exceeded, sorry [input stack size=10000]. \__tl_if_novalue:w #1-NoValue-#2?#...
M. Al Jumaily's user avatar
0 votes
1 answer
43 views

Finding an int among a list of int

I'm trying to find a command or define a command that takes a list of integer and an integer and does things when the integer in in the list and does something else if it is not the case. I have seen ...
Rhylx's user avatar
  • 3
0 votes
1 answer
50 views

Fully expand an argument of a newenvironment created with expl3

In this answer, I was provided with the following code that solves my original problem. \ExplSyntaxOn \NewDocumentEnvironment{withalignment}{m} { \begin{\vincent_alignment:n { #1 }} } { \end{\...
Vincent's user avatar
  • 4,703
6 votes
2 answers
220 views

Using expl3 to load geometry parameters from a file

expl3 has defeated me again so I'm relying on the kindness of strangers again. I think the underlying problem is more about splitting input rather than the file reading. Context: I want to load the ...
Doc Octal's user avatar
  • 369
7 votes
2 answers
210 views

Expansion issues again

I seem to keep encountering the same issue. In my attempt to learn more about expansions I have written a program that starts with a sequence of 1s and then after each step increments it to generate a ...
Ted Black's user avatar
  • 453
2 votes
2 answers
67 views

Generating tensor expression with macro

I am trying to create a command that given a comma separated list of subscript indices, subscript values, superscript indices, superscript values and then name of the tensor generates the following ...
Ted Black's user avatar
  • 453
4 votes
3 answers
164 views

Generating matrices with a single command

Suppose I wanted to generate a 5x4 matrix. A good way to do it is to write the following commands: \[ \begin{tikzpicture} \matrix(m) [matrix of nodes, ampersand replacement=\&, row ...
Ted Black's user avatar
  • 453
1 vote
3 answers
79 views

Convert lines start with >> into centered text

This is actually a follow-up / the real question of this previous question. I would like to convert text start with >> into centered text. The motivation for this seemingly silly purpose would ...
Jinwen's user avatar
  • 8,102
3 votes
2 answers
218 views

Default units in expl3

So I have produced code, which I think is kind of a hack, but it seems to work so far in my testing. I have setup a new expl3 function that sets a dimen variable. If the input for the dimen expression ...
User23456234's user avatar
  • 1,611
0 votes
2 answers
42 views

having trouble calling \regex_match

This works as expected: \documentclass{minimal} \ExplSyntaxOn % USE X instead of \space for a space. \catcode`\X=\active \defX{\space } % \mycheck:nnn <regex> <string to test against ...
MarkSenn's user avatar
  • 125
1 vote
4 answers
42 views

Iterate on set and use \rowcolor

I would like to generate the table contents with pure latex. My draft is as follows: \documentclass{article} \usepackage{expl3} \usepackage{colortbl} \definecolor{lightgray}{gray}{0.9} \ExplSyntaxOn \...
koppor's user avatar
  • 3,132

1
2 3 4 5
29