{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

4
votes
1answer
27 views

l3fp keeping trailing zero in math calc

I would like to keep the trailing zeros when the data, used for internal calculations with l3fp, are printed. For example: \documentclass{article} \usepackage{siunitx} \usepackage{expl3} ...
1
vote
2answers
74 views

Expl3: Constructing command sequences from macro arguments

In my LaTeX laboratory I am doing weird experiments with expl3 (just started to use it some days ago, so regarding l3 I am complete newbie) I am trying to generate command sequence within of another ...
6
votes
1answer
71 views

Does expl3 have arrays?

There is \seq_item:Nn to get an arbitrary item from a sequence. As far as I understand, this works by iterating the sequence items, discarding until the requested item is found, which seems not very ...
7
votes
1answer
119 views

How can I iterate over a newline-delimited text file?

Would I need to use a token list? For the purpose of removing confusion, let there be two delimiters: input delimiter (what LaTeX reads as input) output delimiter (what is seen on paper) I would ...
3
votes
1answer
42 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 ...
23
votes
5answers
1k views

Reducing fraction using LaTeX 3

Consider the following: \documentclass{article} \begin{document} \noindent Can I make \LaTeX{} reduce a fraction automatically?\\[\baselineskip] For example, I would like the fraction ...
3
votes
0answers
37 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
36 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
60 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 ...
4
votes
1answer
33 views

Can I mark an internal function or variable as 'not documented' in l3doc?

There are several internal variables I use that I do not see a need to document in the user-interface section, but I want to explain in the implementation. I'd really like to remove the warnings ...
8
votes
1answer
67 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
68 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
67 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
181 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
67 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
58 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
55 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
81 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
52 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
60 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
73 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
90 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
53 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
61 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
118 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
43 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
40 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
102 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
81 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
90 views

Immutable functions in latex3? [closed]

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
126 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
474 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
49 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
100 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
414 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
70 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
67 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
126 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
38 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
82 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 ...