{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.

learn more… | top users | synonyms

3
votes
1answer
31 views

Undefined control sequence at definition

Why would I be getting an error that the control sequence is undefined while I'm trying to define it? ! Undefined control sequence. <argument> * \cs_set:Nn \obj_this:n ...
18
votes
5answers
770 views

Reducing fraction using LaTeX 3

Consider the following: \documentclass{article} \usepackage{amsmath} \begin{document} \noindent Can I make \LaTeX{} reduce a fraction automatically?\\[\baselineskip] For example, I would like the ...
3
votes
0answers
28 views

problem with \ProcessKeysOptions / l3keys2e in texlive 2015

In my example the keys seems not to be processed ... here is file test.cls : \NeedsTeXFormat{LaTeX2e}[2001/06/01] \RequirePackage{l3keys2e} \ProvidesExplClass {test} {2013/12/23} {1.0} {Ceci est ma ...
3
votes
0answers
34 views

How can I efficiently create variants of a conditional?

Say I have the following: \prg_new_conditional:Nnn \sean_cond:n { T,F,TF } { \prg_return_false: } How can I efficiently create the following? (This list is arbitrary.) \sean_cond:nT \sean_cond:nF ...
8
votes
1answer
55 views

expl3: \keys_set_groups:nnn and unknown keys

I'm using \keys_set_groups:nnn to process only subsets of key lists. The problem is that unknown keys doesn't raise an error in this case and so typos can be overlooked easily. I can get around it ...
8
votes
1answer
66 views

LaTeX3 l3msg best practices

The LaTeX3 module l3msg provides some nice functions for messaging, errors, warnings and the like and is truly flexible. The workflow is different from what we have been using for LaTex2e packages. ...
7
votes
0answers
61 views

Table of contents with xtemplate (expl3)

Every time I typeset some book or articles, I start to renew sectioning commands (\part, \section, some \@-commands and so on), \maketitle, \tableofcontents commands by copy-pasting it to my class and ...
3
votes
2answers
76 views

Is there a 'good' way to make 'local' changes outside of a group in expl3?

I have the following function: \cs_new_protected:Nn \termmenu_prompt:NN { \__termmenu_write_out:N #1 \group_begin: \ior_get_str:NN \c_term_ior \choice \tl_gset_eq:NN #2 \choice \group_end: ...
4
votes
1answer
57 views

When is it appropriate to use scan marks?

From the documentation: Scan marks are control sequences set equal to \scan_stop:, hence will never expand in an expansion context and will be (largely) invisible if they are encountered in a ...
5
votes
1answer
65 views

Text formating depending on conditions

I have some conditions which are stored in boolean variables, such as \bool_new:N \l_word_numbered_bool \bool_new:N \l_word_lowercase_bool \bool_new:N \l_word_centering_bool I need to format words ...
13
votes
2answers
179 views

Should expl3 code be used in packages intended to be compatible with multiple formats?

Maybe this question is just not a good idea in general, but, I'm curious. This could make package development simpler for some in the future. (Of course, this would not be forced on any package ...
7
votes
1answer
75 views

Capitalization in headings - a LaTeX3 approach

In the early days of this site we had a question Automatically capitalize first letters of words in titles? with one solution. Since expl3 has matured well since then I have worked out a partial ...
3
votes
1answer
65 views

How do I load expl3 without LaTeX (or any other format)?

\input expl3-generic % hello, world \bye gives me \inf errors about undefined control sequences when processed with tex. When processed with initex, I'm greeted with an even more puzzling error ...
2
votes
1answer
34 views

What are the disandvantages for using a rule to define an \hspace-like command?

In the LaTeX2e source code \hspace and its star version are defined with \hskips. I have defined an alternative version using rules. I cannot see any obvious disantvantages of this approach other than ...
4
votes
1answer
57 views

LaTeX3 iteration and token list comparisons-code improvement

I am trying to make a fully expandable function that uses two arguments. The first one is the tokenlist to test against the second argument another tokenlist. The test is a character by character ...
2
votes
1answer
47 views

Extending xparse for new arguments

I was looking for a way of grabbing sub and superscripts as optional arguments to a command in xparse. That is, \foo_{a}^{b} would receive a as an optional argument and b as another optional argument. ...
1
vote
0answers
36 views

Finding current siunitx settings (or extracting expl3 keys)

The siunitx package provides a way of formatting (SI) units. It has a plethora of internal settings that the user can set with \sisetup. For example, \documentclass{article} \usepackage{siunitx} ...
3
votes
2answers
77 views

What is a function's signature? [LaTeX3]

I am trying to understand the interface3 documentation. The LaTeX Interface 3 documentation v. May 20, 2014 and March 1, 2015 refer to Defining new functions using the signature in section 3.3. I am ...
4
votes
1answer
63 views

pgfpositionnodelater with nested \tikz environments (Issue with PGF 2.1 -> 3.0 upgrade)

I'm trying to use \pgfpositionnodelater to create and measure nodes before placing them. (Their size influences where they should be placed) This works fine until I try to use \pgfpositionnode later ...
3
votes
2answers
50 views

Writing a token list conditional with expl3

This is a follow-up question to LaTeX3 conditional with grouping fails to compile. I would like to write a token list conditional with expl3 that is fully expandable in order to use it as a predicate ...
3
votes
1answer
59 views

LaTeX3 conditional with grouping fails to compile

I am trying to write a LaTeX3 conditional using \prg_new_conditional:Nnn from the expl3 package. Since the code in the conditional needs to make assignments to some variables, I would like to use ...
3
votes
1answer
68 views

Is there an easier way to 'corner-frame' a piece of text?

I've written a hodge-podge of LaTeX2e and expl3 to produce the following effect: What I have is ugly and ideologically incorrect. I'm looking for a better way to do the same thing. I think coffins ...
10
votes
0answers
82 views

How to best make the transition from LaTeX2e to expl3 syntax

I was peeking at the LaTeX3 github repository and specifically l3auxdata.dtx. There was a surprise for me, as I have been practicing and studying the expl3 syntax and modules for the last couple of ...
4
votes
1answer
63 views

Multiple uses of pgfpositionnodelater

I'm trying to generate and measure multiple nodes before placing them. Currently I'm using the following macros: % some helper / wrapper commands around \pgfplacenodelater % #1 = identifier for ...
2
votes
1answer
49 views

Getting sequences, macros, lists, and such expanded(confused)

I'm trying to do some very basic programming tasks(but as usual TeX makes this extremely time consuming and difficult (for me, of course) ;/) The problem is that I can't seem to get LaTeX to expand ...
6
votes
1answer
58 views

expl3: Expand every item once when adding to a clist

I want to add items to a clist and expand every item once. But the (to my eyes) natural \clist_set:No didn't work as expected as it expanded only the first item. \documentclass{article} ...
9
votes
2answers
114 views

What is the preferred way of expanding twice in expl3?

expl3 includes the o, f, and x argument specifiers for one-level and the two kinds of full expansion, respectively, before passing the argument to the base function. What is the preferred way of ...
4
votes
2answers
39 views

How can I set contents in a box of zero width and specified height, optionally rotating, using expl3 syntax?

Using Steven B. Segletes's answer, I can centre something horizontally, optionally rotating it, using \centering \makebox[0pt]{\rotatebox{<angle>}{<contents>}} \par However, I would ...
5
votes
1answer
100 views

Differences in LaTeX3 function generation methods

In l3basics module there are two methods provided for each command generating function. The one requires the function signature to be provided, whereas the second does not. Since the second is more ...
4
votes
1answer
38 views

\seq_put_right does not execute when placed in an enumerate's item

\documentclass[a4paper, titlepage, twocolumn]{article} \usepackage{expl3} \ExplSyntaxOn \seq_new:N \myStack \begin{document} \begin{enumerate} \item\seq_put_right:Nn \myStack {1} ...
9
votes
3answers
99 views

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, ...
8
votes
1answer
79 views

How can I load the table of contents into an lt3graph?

Question's in the title, really. I'd like to load the table of contents in a graph data structure. I would like to somehow keep the sections (chapters, paragraphs, etc.) ordered, but I'm not quite ...
3
votes
0answers
88 views

Immutable functions in latex3? [on hold]

Imagine we have a nonempty sequence named \l_tmpa_seq. We want to assign a name \l_tmpb_seq a value which is the result of invoking a function like \int_eval:n {#1 + 1} on every member of the ...
5
votes
1answer
96 views

Calculate quartiles of data set

Comment: The following code is taken from egreg's answer here. Code: \documentclass{beamer} \usepackage{lmodern} \usepackage{booktabs} \usepackage{siunitx} \usepackage{xparse} \ExplSyntaxOn ...
3
votes
2answers
120 views

Count the number of elements of each size in a list

Comment: The following question is somewhat similar to "Position of largest element in a list" but I'm (unfortunately) not familiar what LaTeX 3 programming so I'm forced to ask. :( Code: Consider ...
11
votes
1answer
468 views

How will the LaTeX3 format look?

Can someone give me an idea (if it is at all possible) about how the document structure will be in the LaTeX3 format. Will it still start with a \documentclass and use \begin{document} ... ...
6
votes
1answer
48 views

LaTeX3, l3keys: Combining .choice and .default

With LaTeX3 and l3keys (included in expl3), is there a way to have a choice that includes a default value (or an empty choice)? \documentclass{minimal} \usepackage{expl3} \begin{document} ...
9
votes
2answers
98 views

expl3: How to remove the final comma in a clist mapping

I want to process a clist, and I can't use \clist_use:Nn as I have to some rather complicated things with the items. But how do you remove the final separator without to much fuss when using ...
12
votes
3answers
403 views

Position of largest element in a list

Consider the following: \documentclass{article} \usepackage{expl3} \ExplSyntaxOn \cs_new_eq:NN \calc \fp_eval:n \ExplSyntaxOff \def\valueA{7} \def\valueB{19} \def\valueC{41} \def\valueD{31} ...
2
votes
0answers
67 views

Determine whether the macro/function is in subscript, in superscript, or neither

I would like to provide different formatting for an xparse command, depending on whether the command is expanded in superscript, in subscript, or neither. That is, I would like to know inside the ...
2
votes
1answer
63 views

Passing more arguments to mapping functions in LaTeX3

In LaTeX3, we may write these lines: \cs_new_nopar:Nn \module_main:nn #1#2 { \clist_map_function:NN \g_module_some_clist \module_mapping:n } \cs_new_nopar:Nn \module_mapping:n #1 { % ...
5
votes
2answers
124 views

How should I parse an ISO date in expl3?

Assuming date is ISO-formatted (YYYY-MM-DD), how can I parse out its individual parts into variables? \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \int_new:N \mytest_date_day_int ...
3
votes
1answer
74 views

How do I get the length of a type-set argument to a macro in latex3?

I would like to be able to decide how long a resulting character sequence is, in order to properly type set an expression. Consider an argument like \varepsilon or \mathscr{A} which both result in a ...
0
votes
0answers
37 views

Length of the inner-most plain-text argument (token sequence) in a nested macro expression (via expl3)

I would like to determine the length of the original token sequence passed to the inner-most macro as in \compl{\indexset{J}} where \NewDocumentCommand{\indexset}{m}{\mathsf{#1}} ...
6
votes
1answer
81 views

LaTeX3: Correct way to define a macro with :o

If I want to define a macro in LaTeX3 syntax with one-level expansion of its argument (:o), I figured that it is not enough to \cs_new it that way. Instead, I have to \cs_new it as :n and then create ...
4
votes
1answer
549 views

Why a `Missing = inserted for \ifnum` error for empty l3seq sequences?

I'm trying to use expl3 sequences in order to stored 0, 1 or more affiliations to 1 or more authors stored in a datatool database. The following MWE works nicely: \documentclass{article} ...
10
votes
2answers
134 views

Is \c_empty_box intended to be used instead of \mbox{}

At a first glance, I understood \c_empty_box as a replacement of \mbox{} but the following MWE (that points out a weird behavior of \c_empty_box: it is replaced by "æ") gives me serious doubts. ...
21
votes
2answers
543 views

Sum of finite series using LaTeX 3

Is it possible to calculate the value of a finite series, say, using LaTeX 3?
6
votes
2answers
160 views

Why does \msg_fatal: show a seemingly unrelated error?

\documentclass{article} \usepackage{expl3} \usepackage{everypage} \ExplSyntaxOn \AddEverypageHook { \sean_test: } \msg_new:nnnn { test } { message } { this ~ is ~ a ~ rubbish ~ message } { it's ...
4
votes
1answer
50 views

l3keys: how to store the value of a choice key more effectively?

I want to define with l3keys a choice key which also stores the value given to the key. That's easy enough: \documentclass{article} \usepackage{expl3} \ExplSyntaxOn \tl_new:N \curmykey ...