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
0 answers
43 views

Unknown options fail to pass with new expl3 method

Recently I switched my packages to use the new \ProcessKeyOptions method for processing package options. However, I just found out that with \keys_define:nn { projlib-theorem } { ... , ...
user avatar
  • 6,190
0 votes
0 answers
34 views

Line wrapping of l3msg messages

The L3 programming layer (aka expl3) has the l3msg package to provide infrastructure for all sorts of messages, warnings, errors etc. It has, however, a particular style of line-wrapping of the ...
user avatar
  • 11.3k
2 votes
1 answer
27 views

How to use proteced function in an expl3 conditional predicate?

I want to define a conditional function \if_is_int:n(TF) to test if the parameter is an integer, so I wrote: \documentclass{article} \begin{document} \ExplSyntaxOn \prg_new_conditional:Npnn \...
user avatar
  • 1,143
0 votes
1 answer
31 views

incompatibility of pdftex graphics driver, expl3 and xparse in TL2022 [closed]

I am running into a strange compilation error. Consider the following MWE: % file test.tex \documentclass{article} %\usepackage{mdframed} %\usepackage{color} \makeatletter \input{pdftex.def} \...
user avatar
1 vote
2 answers
43 views

LaTeX3 convert token list to string

I want to create a LaTeX class with optional parameters using LaTeX3. But I'm having problems converting the token list holding the parameter value to a string. I would like to know how to do this ...
user avatar
  • 141
0 votes
2 answers
46 views

Misplaced alignment tab character &. with tabularray and expl3

I'm trying to pass as a parameter a list of rows in tabularray. (the same list will be used a 2nd time) With Showing `\_tl` variables that contain `&` and `\hline` tokens I tried to use this code ...
user avatar
  • 647
6 votes
2 answers
299 views

How to define new key properties in l3keys

From interface3.pdf, we can see l3keys has provided several key properties such as .code:n, .tl_set:N, .usage:n. But I don't know how to define a new key property. At this time, my code is like this: \...
user avatar
  • 8,650
3 votes
3 answers
237 views

l3regex: Regular expression for a new line symbol \\

How to set regular expressions for a character \\ correctly? MWE below produce unwanded extra space character between words with \c{\\}. \documentclass[]{article} \ExplSyntaxOn \NewDocumentCommand{\...
user avatar
  • 5,006
5 votes
1 answer
108 views

As of 2022, how should one build class/package options without l3keys2e? [duplicate]

In a comment of this question,David Carlisle wrote: [l3keys2e] should be considerd legacy now, the new built in option code is based on the same core expl3 code but extended and improved so hopefully ...
user avatar
  • 6,190
4 votes
3 answers
145 views

What is the best way to expand macros inside keyval input in expl3

I think LaTeX packages rarely use macros as key names. And some users expect macros inside the keyval input will be expanded recursively first. But l3keys in expl3 doesn't provide this functionality ...
user avatar
  • 8,650
3 votes
1 answer
70 views

Use tabularray in xsim template

Is there a way to use tabularray in the xsim ExerciseTableTemplate? I copied the default template from xsim, just replacing tabular with tblr which results in an error I cannot make sense of: \...
user avatar
1 vote
1 answer
50 views

Using a CSV File to Drive Custom Macro

Background I am trying to figure out why the attached MWE is not working. My custom macro reqUser works correctly when using the xstring both inside and outside of the csvsimple environment. The expl3 ...
user avatar
  • 115
0 votes
1 answer
89 views

I want to implement a code highlighting environment using l3regex

I want to implement a code highlighting environment using l3regex.mwe is as follows: \documentclass{article} \usepackage{xcolor} \begin{document} \ExplSyntaxOn \cs_set:Npn \highlight_cmd:n #1 { \...
user avatar
  • 875
5 votes
1 answer
93 views

What is the difference between \str_case:Nn and \str_case:Vn?

In expl3, the \str_case:Nn and \str_case:Vn variants are both pre-generated. In the interface3 document, it looks as though the \str_case:Vn variant were automatically generated from the \str_case:nn ...
user avatar
  • 1,089
0 votes
2 answers
59 views

How can I read the whole file content verbatim into a (expl3) string variable?

As in the title. Example: \documentclass{article} \begin{document} % first write some file content for demo... \begin{filecontents*}{test test.txt} line 1 !?#\xyz line 2 \end{filecontents*} % what ...
user avatar
  • 2,263
0 votes
1 answer
45 views

Write lines to file in expl3 [duplicate]

Common programming languages (PL), e.g. Python allow append lines to opened file like file_object = open('sample.txt', 'a'). How it is possible to do in expl3 PL? My MWE adds only last argument of \...
user avatar
  • 5,006
0 votes
4 answers
76 views

Hyperlinks of footnotes with multiple numbers/markers

In this answer, I created two commands \footnotenumber and \multifootnote for writing footnote with multiple numbers. The problem with these commands is that hyperlinks do not work as in usual ...
user avatar
  • 6,190
2 votes
3 answers
91 views

Count the number of a given character in a token list and apply the corresponding operation

I would like to define a command that counts the number of a substring in the input and apply corresponding operation according to the result. For example, in the following code, the command should ...
user avatar
  • 6,190
5 votes
3 answers
145 views

Splitting the \jobname by hyphens in expl3 syntax

For the purpose of learning the new expl3 syntax I have decided to rewrite my varsfromjobname package that separates the jobname into diffent tokens. I am struggling however with the new syntax. So ...
user avatar
3 votes
0 answers
43 views

\regex_set:Nn is not working properly

I was testing some regular expressions in expl3 when I noticed that the method \regex_set:Nn does not seem to set a regex properly when one wants to add to it the all-matching pattern (.). That can be ...
user avatar
2 votes
1 answer
47 views

How to writing files with expl3

I'm start to study expl3 but it's so difficult for me. I'm trying to understand how file management works. How can to fix my next mwe for don't ignore the lines break at the first call to \Write ...
user avatar
1 vote
0 answers
56 views

Detect \end of an environment

I'm trying to create a macro that grabs everything till the end of the current environment and parses it. At first, I just want to put ! right after my macro and another one ! before the end of ...
user avatar
  • 2,185
0 votes
1 answer
30 views

how to expand clist_if_in parameter in expl3

How to expand parameter l_element_b in clist_if_in condition in expl3? Here is my MWE: \documentclass{article} \ExplSyntaxOn \clist_new:N \l_some_clist \clist_set:Nn \l_some_clist {A,B} \str_set:Nx ...
user avatar
1 vote
2 answers
62 views

write to file full expansion of command

I have an issue I want to resolve, maybe you can help me. When I compile the mwe the following happens: In the PDF you can see: (X/A)(Up/Down) In the file.txt write: (\frac {a}{x})(\frac {u}{d}) How ...
user avatar
0 votes
0 answers
24 views

hyperref and \addcontentsline's patch in expl3 block

I want to patch \addcontentsline command for changing \thepage to \thechapter--\thepage. However I found that things went wrong when I used expl block: \documentclass{book} \usepackage{etoolbox} % \...
user avatar
  • 1,143
1 vote
2 answers
104 views

Boolean version of `\str_if_in:nnTF` — expl3

How can I use \str_if_in:nnTF as a boolean function i.e without TF arguments so that I could use it inside \bool_lazy_and:nnTF { \str_if_in:nn {abc} {a} } { ... } { true code ...
user avatar
  • 2,185
4 votes
1 answer
135 views

Function return — expl3

How can I stop function from running rest of the code if some conditions are met in latex3? Now I have to build nested conditions and have a couple of default cases duplicated. Code readability gets ...
user avatar
  • 2,185
0 votes
0 answers
24 views

cannot generate variant of a function, deprecation error — expl3

Look at two seemingly similar codes \tl_set:Nx \first_token { \tl_head:n {\langle\rangle} } \exp_last_unbraced:Nx \token_if_eq_meaning:NNTF \first_token \langle {Tr}{Fl} \tl_set:Nx \first_token { \...
user avatar
  • 2,185
2 votes
2 answers
42 views

Save unbraced token into variable — expl3

I want to use \token_if_eq_meaning:NN that compares meaning of just two tokens. I have such a token list {\langle\rangle} that's saved via \tl_set:Nn \my_tokens_list {\langle\rangle} How can I ...
user avatar
  • 2,185
0 votes
0 answers
46 views

Unable to show the macro/command definition, when the macro/command defined with optional argument

For example, I define two commands. \mytesta with optional argument, \mytestb without optional argument. Now using \cs_meaning:N to show the command definition. The result is like this: \...
user avatar
  • 4,458
0 votes
1 answer
41 views

Expand argument before using it

This question is my attempt to solve the main problem (MWE there). I realized that using macro \newcommand{\veca}{|_{\vec{a}}} next to \bigg is being treated as a single token, so those two queries ...
user avatar
  • 2,185
0 votes
1 answer
43 views

Passing string containing "special" catcodes (especially `_`) to custom NewDocumentCommand command

How can I pass underscore to \newcommand properly? suggests the solution is to use a zero-argument command that changes the catcode of _, before expanding to the actual command. That's kind of the ...
user avatar
0 votes
1 answer
43 views

How to trim the spaces of the head of token list after using \tl_tail:N?

Here is a MWE: \documentclass{article} \begin{document} \ExplSyntaxOn \tl_new:N \l_tmpc_tl \tl_set:Nn \l_tmpa_tl {*~123} \tl_set:Nx \l_tmpb_tl { \tl_trim_spaces:n { \tl_tail:N \...
user avatar
  • 429
3 votes
1 answer
50 views

How do I get the rubber components of an l3skip?

Related to my question on l3skip to \setlength. \ExplSyntaxOn \skip_const:Nn \c__par_skip { 1ex plus 0.2ex plus 0.1ex } \skip_gimme_the_stretch:NN \g__par_stretch_fp \c__par_skip % 0.2ex \...
user avatar
1 vote
1 answer
84 views

What does ✩ (not ⋆) mean in interface3.pdf?

See the LaTeX 3 programming layer doc here: https://mirror.math.princeton.edu/pub/CTAN/macros/latex/contrib/l3kernel/interface3.pdf ⋆ seems to indicate whether a macro is expandable; e.g.: \...
user avatar
1 vote
1 answer
46 views

Alternative for \tl_if_blank:e

Recently I started to check those code I wrote when I first learned about expl3. I found that there are many usage of \tl_if_blank:e... for testing if the content of a macro is empty or not. But now I ...
user avatar
  • 6,190
2 votes
2 answers
125 views

L3 programming: \text_titlecase only seems to map properly when sequence is explicitly declared

I'm trying to perform the following conversion using the l3 interface: my_figure_title -> My Figure Title After some trial and error with sequences and strings, here's what I came up with: \...
user avatar
  • 1,382
10 votes
2 answers
281 views

LaTeX3 not enforcing argument types for user-defined control sequences, why?

From a previous question, @egreg's states: The argument types N and n are the most common. The former means that the argument must be an unbraced single token, the latter means that the argument must ...
user avatar
  • 1,382
2 votes
2 answers
93 views

Can't output the value of uppercased string with expl3

I'm trying to get to grips with how to do basic string manipulation using expl3. Here's what I have so far: \documentclass{article} \begin{document} \ExplSyntaxOn \str_set_eq:NN \l_tmpa_str \...
user avatar
  • 1,382
0 votes
0 answers
41 views

How to use regex_replace_once (l3regex) for replacing in nested environments/macros?

I am trying to have nested environments, where the outer applies some changes to the output of the inner one. Problem appears when the outer environment needs to use regex commands (regex_replace_once ...
user avatar
  • 365
1 vote
1 answer
31 views

Calling an environment using token contcats (expl3) makes some internal contents show up at the end of document

I need to dynamically apply an environment (or possibly a series of nested environments)on some text using expl3 (latex3) commands. However, the environment behaves differently when concatenate a ...
user avatar
  • 365
5 votes
3 answers
323 views

LaTeX3 - Expand nested argument

MWE: \tl_set:Nn \l_tmpa_tl {a} \tl_set:Nn \l_tmpb_tl {\mathbf{\l_tmpa_tl}} \tl_set:Nn \l_tmpa_tl {b} \(\l_tmpb_tl\) The code snippet above actually produce \(\mathbf{b}\). What I want to achieve is ...
user avatar
2 votes
1 answer
51 views

\tl_gput_right:Nx with argument containing \par causing error after a list

I accidentally ran into this issue and don't understand why this happens. Consider the following code: \documentclass{article} \begin{document} %% OK Text \ExplSyntaxOn \tl_gput_right:Nx \l_tmpa_tl {...
user avatar
  • 6,190
1 vote
2 answers
58 views

Why solutions for macros with lstlisting inside fail if tabulation in the verbatim text? [duplicate]

For instance this solution for macros with lstlisting inside works well, except if the verbatim text contains a tabulation (as shown by the following MCE). Why? \documentclass{article} \usepackage{...
user avatar
9 votes
2 answers
176 views

expl3 - rules for toplevel-macro's argument specifications if toplevel-macro of function doesn't process arguments but calls internal macros that do

The file expl3.pdf - "The expl3 package and LaTeX3 programming" explains how expl3 functions should be named, according to the scheme \⟨module⟩_⟨description⟩:⟨arg-spec⟩ or according to the ...
user avatar
  • 23.5k
9 votes
1 answer
124 views

Expl3 - \cs_generate_variant:Nn / \exp_args:N... - Which method is preferable under which conditions?

If you need arguments preprocessed/expanded before TeX passes them to a macro, you can do two things in expl3: Use \cs_generate_variant:Nn for generating a variant of the macro where the arguments ...
user avatar
  • 23.5k
5 votes
4 answers
300 views

Collecting the content between two macros and pass it to the third

Is it possible to define such two macros \mymodule_start_collecting: and \mymodule_stop_collecting: so that the content between them can be passed to a third (given) macro as argument? Motivation: I ...
user avatar
  • 6,190
0 votes
0 answers
55 views

Make \exp_not:V and \exp_args:NV work for fp variables too?

In interface3 the description of \exp_not:V command is the following: \exp_not:V ⟨variable⟩ Recovers the content of the ⟨variable⟩, then prevents expansion of this material in x-type or e-type ...
user avatar
  • 8,650
4 votes
2 answers
116 views

How do I use l3skip as an argument to setlength?

How do I recover send l3skip expressions to setlength? Or: How do I convert length + stretch - shrink to length plus stretch minus shrink\relax? \ExplSyntaxOn \skip_const:Nn \c__par_skip { 1ex +0....
user avatar
4 votes
1 answer
45 views

Spaces removed from tikzlibraries' code when loaded within \ProvidesExplPackage

I'm playing with expl3 in a project and have a weird issue. I have a package that loads tikz and some tikzlibraries. If I use \ProvidesExplPackage, it seems that spaces are removed somewhere in the ...
user avatar
  • 3,631

1
2 3 4 5
24