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.

For more information, refer to the following texdoc resources:

1494 questions
39
votes
1 answer

Feasible TeX projects to get started with (expl3?)

I'm a pretty decent LaTeX user in the sense that I write LaTeX documents all the time and I can do pretty much everything that I need to do (with some occasional help from you lovely people). But I don't know much about plain TeX and TeX's inner…
dbmrq
  • 1,299
21
votes
2 answers

Usage of \lastbox

As part of our LaTeX3 work, we provide a consistent interface to TeX programming through the expl3 package. We've recently been discussing the TeX primitive \lastbox, which is used to inspect or unpack whatever just came before in the…
18
votes
5 answers

Use recursion in LaTeX3

I want to use recursion to calculate n! in LaTeX3, but found that the result is not correct, mwe is as follows \documentclass{article} \ExplSyntaxOn \cs_set:Nn \froac:n { \int_compare:nNnTF{#1}={0}{1} { …
ljguo
  • 1,213
  • 1
  • 4
  • 12
16
votes
1 answer

What does greedy \bool_if:n(TF) mean?

In the latest CTAN update, \bool_if:n(TF) has been made greedy: ... Any code which still assumes lazy evaluation for \bool_if:n(TF) will therefore need adjustment. What does it mean that \bool_if:n(TF) is greedy? What does lazy evaluation mean…
mhchem
  • 3,485
  • 12
  • 37
14
votes
1 answer

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' I suspect an hyphen to be lacking in…
F. Pantigny
  • 40,250
14
votes
5 answers

shuffle elements of a LaTeX3 sequence

I am looking for a way to shuffle the elements of an expl3 sequence variable. The following code which initialises and outputs such a sequence variable could serve as a starting…
AlexG
  • 54,894
13
votes
3 answers

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 { A } \tl_set:Nn \l_myb_tl { B } \tl_set:Nf…
AlexG
  • 54,894
13
votes
2 answers

Write LaTeX3 variable to aux file and recover it

I was wondering how to write a LaTeX3 variable to an aux file and read it in at the very beginning of a document. The motivation of this problem is that I would like to get rid of my LaTeX2 counters and implement them via LaTeX3 variables. A LaTeX2…
Max Maier
  • 859
13
votes
2 answers

Text within ExplSyntaxOn/Off

As below, I would like to test whether a user has input some custom text, and if not, then to display default text. \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \tl_new:N \l_empty_tl \NewDocumentCommand{\dostuff}{}{ …
Scott H.
  • 11,047
11
votes
2 answers

Effiency and speed of expl3 "datatypes"

Context: For teaching purposes I'm planning to implement a binary tree in expl3 (please no "implement-it-in-another-language-comments"). I wonder whether to use token lists or clists or something different. Observation: While browsing some questions…
TeXnician
  • 33,589
11
votes
3 answers

expl3 variables and functions

I am trying to learn how to use expl3 and am a little confused and could use some direction. I'm trying to figure out this whole naming scheme for variables and functions as addressed in the expl3 documentation, and cannot figure it out. There is…
Bob
  • 1,270
  • 9
  • 14
11
votes
1 answer

determine character code in LaTeX3 (equivalent for backtick notation)

Is there some dedicated expl3 command that is equivalent to the backtick notation of TeX in order to determine the character code?
AlexG
  • 54,894
10
votes
3 answers

Peek ahead for a digit (expl3) – or any regex, for that matter

Is there an easy way to peek ahead for a digit? Something like \peek_charcode:NTF [0-9] The approach to nest 10 \peek_charcode:NTF is quite cumbersome. I want to match digits only. Digits, parenthesis and others share the same catcode.
mhchem
  • 3,485
  • 12
  • 37
9
votes
1 answer

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, mostly switching from x to e expansion variants. I…
User23456234
  • 1,808
9
votes
2 answers

latex3 use function by name

I have several functions defined by similar way, and they will be used later by the name base + argument. I do not find \cs_use:c, but there is \use:c and \cs_if_exist_use:c. Is this the correct way to do such thing or I should use something else…
ZhiyuanLck
  • 4,516
1
2 3
11 12