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
1answer
42 views

Override package with local package [Overleaf]

For a rather large project I unfortunately need to use Overleaf. The problem with this is that it uses TexLive 2017. My question is: Is there an easy way to use packages from the newest TexLive ...
1
vote
2answers
31 views

Access nth argument after use of \SplitArgument in \NewDocumentCommand?

It is a bit artificial, but assume the following as context: First, I want to add labels for tables as tab:label, for figures as fig:label and so on. Second, I want to create some commands to include ...
2
votes
1answer
49 views

Efficiency of xstring (2e) vs. xparse (l3) in simple parsing

I understand string processing can be done on either LaTeX2e using xstring and expl3 using xparse (originally based on the 2013 thread "Tokenizing and parsing") I will be running a relatively simple ...
2
votes
1answer
167 views

Expand keyval into TikZ's node optional argument

I am willing to create matrix-like nodes, so I implemented a draft function \DrawMatrixx below. Also, I have general style for nodes called Matrixx/body for matrix, or body, itself and for dimensions,...
5
votes
1answer
44 views

Reading line from terminal in expl3

Simple question: How do you read a line from terminal to a token list variable in expl3? The following is what I tried: \documentclass{article} \usepackage{expl3} \begin{document} \ExplSyntaxOn \...
13
votes
1answer
154 views

Problem loading expl3 in plain TeX

I try to use expl3 in plain TeX with the code: \input expl3-generic % Some text \bye I have en error message with all engines. For example, with pdftex: ! I can't find file `l3backendpdfmode.def' ...
3
votes
1answer
64 views

How to use colon (':') as part of tikz syntax while in \ExplSyntaxOn environment?

I want to create a simple tikz style highlight which will draw ellipse around the object and write label at requested position. To avoid providing the font through the text argument, I've placed it ...
1
vote
0answers
55 views

How to remove the last character of a macro using a regex (expl3)?

I'm trying to remove the % sign that I added to a macro that stores in sequences to prevent (^M/ASCII-Return) that adds TeX when processing the argument using \scantokens. Everything is perfect, but, ...
1
vote
0answers
87 views

Latex Error: package too old

I am compiling a document and am running into trouble because of a supposedly outdated package. I already googled the error and found several solutions, all of which suggest I should update my ...
1
vote
1answer
34 views

Problem with expansion in xparse

I am trying to use function from this answer \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewExpandableDocumentCommand{\switchcondition}{ O{string} m m m } { \use:c { ...
0
votes
0answers
32 views

Writing into a file, strange behavior with expansion

I want to write some data into a file, but I need to replace a subtring in these data beforehand. For some reason, the expansion through the \write macro does not give the expected result. Instead, a ...
2
votes
1answer
110 views

Convert a macro from Latex2e to expl3

I'm trying to implement a \Scontents command inside a small package that behaves in two different ways: \Scontents*[opt]<del>argument<del> \Scontents[opt] { argument } With the star it ...
2
votes
1answer
3k views

File l3backend-pdfmode.def not found when loading expl3 alternative solution

I have a problem compiling documents - if I use expl3 package, I get an error l3backend error saying ! LaTeX Error: File `l3backend-pdfmode.def' not found. My problem is that installing l3backend ...
7
votes
2answers
9k views

File l3backend-pdfmode.def not found when loading expl3

I updated my TeXlive distribution a couple times in the past week, and now I get this error when I include package expl3 (or any other package that includes it, such as fontspec). Before the updates ...
3
votes
1answer
52 views

Processing separated list of separated lists

Is it possible to create function foo that takes list of arguments and this argument is also a list, e.g. to require the following semantics \foo[x:1,z,y:2], i.e. it takes three comma separated ...
3
votes
1answer
64 views

Subtleties of @@ replacement in l3doc

I'm trying to understand the exact semantics of @@ replacement in the l3doc class. What I gathered so far from the documentation is the following: No replacement happens before the %<@@=name> ...
3
votes
1answer
58 views

expl3 replacement for \lowercase trick

Given this example code: \documentclass{article} \usepackage{expl3} \ExplSyntaxOn \group_begin: \char_set_catcode_active:n { `\* } \cs_new_protected:Npn \foo #1 { \group_begin: \...
1
vote
1answer
358 views

Create a fake “\meaning” (verbatimized) for content stored in seq?

I'm trying to create a command that represents the code that is stored in a sequence without executing it (something like \meaning) . When using \cs_log:N \l_scontents_macro_tmp_tl I get in the .log ...
0
votes
0answers
34 views

foreach looping error [duplicate]

Prior to posting this question, I have read the post here: OP asks the same question two or three times or does the same strange things several times My purpose in asking same questions with ...
2
votes
1answer
83 views

foreach loop error in generating diagrams

In my previous question, How to set macro for looping with minipage?, I was suggested using a foreach loop to solve the problem. After testing, the loop works correctly as show in page 1 pdf. However, ...
2
votes
0answers
93 views

How do use {<setup>} in \tl_set_rescan:Nnn to replace \scantokens?

This question is related to (Changing escape character in \tl_set_rescan:Nnn) and (https://tex.stackexchange.com/a/496258/7832) but is not the same. I've tried to change this: \exp_args:NNx \...
5
votes
3answers
177 views

Calculating the partial sum of a expl3 sequence

How can I compute the partial sum of a sequence of integers? This is what I have so far \documentclass{article} \usepackage{calc, forloop, xparse} \ExplSyntaxOn \seq_new:N \g_tmp_seq \seq_new:N \...
2
votes
1answer
67 views

Counting days and years in personal journal

The code below is taken from this post. Is it possible to create a sequence/array that contains all the different years, and another that contains how many entries per year there are? \documentclass{...
4
votes
1answer
95 views

Can LaTeX3 clists contain quarks?

The introduction to l3clist in interface3.pdf states In addition, comma lists cannot store quarks \q_mark or \q_stop. However, this is not mentioned at any other point in the part (in contrast to ...
1
vote
1answer
55 views

Should I define expl3 functions with an explicit parameter list when I don't need to?

I am currently attempting to learn expl3 and reading interface3.pdf. Thanks to the argument expansion control provided by l3expan, I will not have to define functions with "weird" arguments very often....
0
votes
1answer
45 views

Message '! Missing \endcsname inserted.' calling \msg_error:nn

I get the message ! Missing \endcsname inserted. <to be read again> \delimiter l.58 ...ore than two arguments for {\backslash}Id} ? For this document \documentclass{...
5
votes
1answer
139 views

Changing escape character in \tl_set_rescan:Nnn

I'm playing around a bit with the \tl_set_rescan:Nnn function (originally to make this answer more concise), but I'm struggling to make even pretty simple uses of this function work. Say we want to ...
1
vote
1answer
90 views

Is there a tutorial on writing messages from expl3?

I'd like to use the message facilities of expl3, but the documentation for l3msg only gives the syntax. In particular, it does not explain which commands are only legal after \begin{body}, it does not ...
0
votes
1answer
54 views

Message about missing } in \int_case:nn

I get ! Missing } inserted. <inserted text> } l.47 Test $\Id$ , $\Id{A}$ and $\Id{A,B}$ inline. when compiling \documentclass{article} \usepackage{...
1
vote
1answer
119 views

How do you compact a code that expands \macro and store it in an expl3 sequence?

I'm trying to rewrite some of the codes I have by following the correct expl3 rules. With the following code I define the scontents environment that encapsulates the filecontentsdefmacro environment ...
5
votes
3answers
194 views

What is the correct way to replace “csxdef/foreach” with pure expl3 code?

I'm trying to remove the dependencies of the packages pgffor and etoolbox from a code I own which uses expl3, but I don't know which is the correct equivalent of \csxdef in expl3. At the moment I have ...
2
votes
0answers
192 views

how to deal with the Package lipsum Package expl3 too old error without loosing my work

i was compiling a template and i got this error : ! Package lipsum Package expl3 too old. so i was wondering if there is a way to update the expl3 package but without losing my previous work , since ...
2
votes
1answer
108 views

Custom points table for exam

I'm trying to create a custom points table for exams. Currently, the instructors in our department write these exams in MS Word, so to ease the growing pains, I'd like to emulate the old design as ...
1
vote
1answer
102 views

How to set a key in “module” and pass the rest of the keys to “module/subgroup” in l3keys?

I'm trying to create a key to pass the rest of the keys to /subgroup based on a boolean condition. That is to say that something like this works: [key in <module>, rest of keys pass to <...
2
votes
1answer
41 views

Workflow for patching and testing expl3 modules

Say I want to write a patch for one or some of the expl3 modules. As far as I can see, to test the patch I have to do the following: Edit the module's .dtx file; Run l3.ins to compile (beside others) ...
0
votes
1answer
134 views

Problem passing a key=color (separated by commas) from l3keys to tikz

After a good time searching the forum I gave up (I thought I could do it by myself), I have a problem passing a key from l3keys (separated by commas) to tikz. I've created a command that accepts ...
6
votes
2answers
124 views

Building regex from another one

I'm trying to define a command where the user can define a regex, which should then be used to create a larger regex that in turn will be matched on a token list. The naive approach to insert it from ...
0
votes
0answers
61 views

key={v,a,l} argument separated by commas in xparse [duplicate]

I'm trying to create a command to show the distributive property of multiplication (for school effects) using tikzmarks and xparse. So far so good, the code is a bit long and I would like to know if I ...
0
votes
3answers
55 views

How to automatically place number of occurrences of a certain command inside xparse environment at every occurence of that command?

There is an (xparse) environment \myEnv, and there is unspecified number of \myCo commands provided by the user inside that environment. I need to write a code for the environment which would count ...
1
vote
1answer
38 views

Put data into variable (memory) or code?

In order to (re-)write a boilerplate package (i.e. containing a lot of texts), I see two approaches. a) Have the texts in code and use a deeply nested if-then-else structure that is evaluated every ...
2
votes
1answer
77 views

How to automatically capture \prevgraf value (inside xparse environment) every time text ends with \par?

I need to declare an environment with \NewDocumentEnvironment such that every \par provided by the user inside that environment would automatically set an integer variable (inside environment-...
12
votes
3answers
242 views

f-type expansion

I am still struggling with understanding the f-type expansion. What is it all about? The explanation on page 2 in interface3.pdf is not really satisfying. In the given example \tl_set:Nn \l_mya_tl { ...
2
votes
3answers
145 views

Why \NewDocumentEnvironment within \ExplSyntaxOn/Off removes spaces from content passed to it outside of \ExplSyntaxOn/Off?

I thought turning syntax on/off at appropriate places would make everything work, but I can't use \ExplSyntaxOn/Off inside \NewDocumentEnvironment so the following code sample doesn't work: \...
2
votes
1answer
70 views

ocgx2, xparse, expl3: splitting comma separated OCMD/OCGs lists of arguments for references automation

On an applicative level, this question follows a previous one about quizzes (MCQs) with OCGs. But it seems (I suspect) that the issue might come from expansion concept and/or LaTeX3 syntax on how to ...
1
vote
1answer
34 views

Command defining nested commands

I trying to define a command \NewDerivative that defines a new derivative and a set of keys and variables for this particular derivative. The problem is, that when \NewDerivative{\Ddv}{D}[style-d = ...
5
votes
1answer
81 views

How to halt compilation and output error message to the console with expl3?

How to stop compliation and output an error message if conditional statement resolves to true? \documentclass[varwidth]{standalone} \usepackage{expl3} \begin{document} \ExplSyntaxOn \...
4
votes
2answers
250 views

Do quarks have to be defined as macros expanding to themselves?

When playing with recursive functions of expl3 it has happened several times to me that a quark got expanded unintentionally, in which case TeX will go into an infinite expansion loop. (What is extra ...
6
votes
2answers
85 views

How to set replacement text of function from token list variable?

I'm trying to define a local function with parameters in expl3 where the replacement text of that function should be the content of a token list variable. My current approach is \tl_set:Nn \...
3
votes
1answer
46 views

Why is \exp_after:wN named \exp_after:wN?

This may be a strange question, but it somehow bothers me. In expl3 we find a command named \exp_after:wN which is an alias for TeX's \expandafter. According to the expl3 naming scheme, anything that ...
4
votes
1answer
61 views

expl3 function for fixed number of expansion steps

In expl3, say we want to assign a value to a token list variable \l_foo_tl while expanding the value a certain number of times. For a single expansion the easiest way is \tl_set:No \l_foo_tl { ... } ...