Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

2
votes
1answer
20 views

How to use the token list variable from \prop_get

Here is a MWE. I use a token list, and I can get 10 and October in the final pdf file. \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \tl_new:N \l_my_tl \prop_new:N \l_my_prop \...
3
votes
2answers
133 views

How to implement \expandbefore, similarly to \expandafter?

I am trying to define a new command, but specifying the new control string "on the fly" using csname and endcsname. (This is for the purpose of implementing a dependency injection pattern.) **...
3
votes
3answers
52 views

Environment with comma separated optional arguments

Using xparse, how does one get something like this to work? \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentEnvironment{ anenvironment }{ >{\SplitArgument{1}{,}}o }{ \...
0
votes
0answers
89 views

! Argument of \@firstoftwo has an extra }

I am attempting to write macro that extracts and formats information from a label. I get the messages ! Argument of \@firstoftwo has an extra }. <inserted text> \par l.84 ......
2
votes
1answer
26 views

Trouble parsing filename in expl3

I am trying to parse the file extension of a user-given path in expl3. I have got the file extension, but I can not manage to compare it to the expected file extension. My MWE is \documentclass[]{...
3
votes
1answer
119 views

Automatic date in personal journal

I keep a personal journal using LaTeX. I'd like to create an environment that automatically keeps track of the date of every entry, without having to manually input them myself. This is the code so ...
0
votes
0answers
35 views

How is the correct way to use “\ tl_rescan: nn” and “\newlinechar” in xparse?

I am trying to implement a new environment using the xparse andfilecontentsdef packages. I have some complications with the use of \tl_rescan:nn and \newlinechar. The idea is to generate a new ...
1
vote
0answers
38 views

\ifthenelse command when using expl3 syntax

What is the equivalent of \ifthenelse{<statement>}{<iftrue>}{<iffalse>} when using expl3 syntax?
11
votes
1answer
122 views

Combine `map` and `use` expl3 macros

I'm trying to build a macro that processes a comma-separated-list of elements so that: \MapAndUse{a,b,c} would produce: My first intuition is to use a expl3 combination of \seq_map* to process each ...
2
votes
1answer
45 views

How to display string variable without hanging texworks

I was getting unexpected results storing a parameter into a string variable, and added the statement "\str_show:N \l_tmpa_str" to produce debugging output. Texworks treats the output as an error. My ...
1
vote
1answer
26 views

Write file content obeying whitespace using expl3

I want to create a control sequence using expl3 to write file content while obeying whitespace. So far I have the following MWE which does write to file, but ignores whitespace. \documentclass[]{...
4
votes
2answers
93 views

Convert token to string in LaTeX3

While trying to answer another question on this site, I was experimenting with \peek_after:Nw and \l_peek_token. I can set \l_peek_token OK, but then I want to test if this token is one of several ...
2
votes
1answer
89 views

Automatic theorem list

In the accepted answer to Code between \begin{environment} and \end{environment} stored in an array it's shown how to create an automatic list of theorems using expl3 syntax. However the \...
3
votes
1answer
85 views

Is there latex3 work being done on a boolean case statement?

Various languages have constructs like select; when <expression 1> then <action 1>; when <expression 2> then <action 2>; ... when <expression n> ...
10
votes
5answers
652 views

A command challenge

Here's a little challenge. The goal is to create a command that takes is two or three arguments without using square brackets for optional arguments. The first and second argument are separated by a ...
3
votes
1answer
46 views

Macro expansion in TikZ node

I am having some problems with macro expansion in TikZ nodes. The MWE below is supposed to draw nodes at specified coordinates and display their coordinate rounded to the nearest number, but it shows ...
3
votes
2answers
62 views

\str_case:nnF not finding match

I have written a command using expl3 that is supposed to behave differently if the optional argument is specified as * or **. The command is intended for a math environment, and is supposed to render ...
2
votes
1answer
89 views

What is the e specifier for latex3 and where is it documented/

Pages 1-2 of interface3.pdf, "The LATEX3 Interfaces The LATEX3 Project" Released 2018-10-31 only list specifiers of c, D, , F, f, N, n, o, P, T, V, v, w and x. The e specifier of \str_if_eq:eeTF is ...
4
votes
2answers
54 views

Strange behaviour in l3keys

Consider the following code which uses \keys_set_known:nnN: \documentclass{article} \usepackage{expl3} \ExplSyntaxOn \keys_define:nn {empty_module} {} \keys_define:nn {module1} {key1 .code:n = {\...
2
votes
1answer
37 views

Command defined with \NewDocumentCommand and specifiers {O{strict} m} not receiving all of the mandatory parameter

I defined a command using \NewDocumentCommand with specifiers {O{strict} m}. I expected #1 to default to strict when calling the command with only a parameter enclosed in {}, and to pick up all of the ...
0
votes
3answers
46 views

Function to redefine functions so that they operate with a modified argument

I need to locally redefine some commands taking one argument, so that they are executed with the argument modified by the addition of a prefix. For instance, I need to locally redefine \label so that \...
0
votes
1answer
62 views

Automatic bold formatting of author name in bibliography

I would like to automatically boldface a single author's entries in a bibliography generated with natbib. The bio.tex file looks like this (everything has been fictionalized): \documentclass{bio} \...
1
vote
1answer
38 views

Use value from xparse key-value store in regular expressions

This is an extension of a previous question (link). I would like to include the following xparse key-value store holding a name value into the document below: % Key-value store \ExplSyntaxOn \...
1
vote
1answer
33 views

How to create a string comparison with xparse's \NewDocumentCommand?

My MWE was created with the help of these two Q&As: 1 and 2. MWE: \documentclass{article} \usepackage{xparse} \usepackage{xstring} \usepackage{pdftexcmds} % Command declaring a global ...
0
votes
1answer
71 views

How to use xparse's NewDocumentCommand for global definition?

This is re: egreg's solution to this question. Issue: I would like the \NameOne command to replicate the \NameTwo command where it outputs only when being called on like so: \NameOne. When an ...
5
votes
1answer
382 views

Getting errors using Acro for abbreviations and acronyms: Undefined Control Sequence in acro.sty

I've been trying to use acro for abbreviating terms in a report. It mostly works but each compile requires intervention to complete and does something to my first page, leaves an =1 and a page break. ...
7
votes
3answers
532 views

Who ate my space? (How to stop \exp_args:Nf from consuming a space?)

I have a macro that uses \prg_replicate:nn to produce a number of spaces, then pass those spaces, after f-expanding \prg_replicate:nn, to another macro. The problem is that when I use \exp_args:Nf, it ...
2
votes
0answers
147 views

recent l3kernel package and TikZ library calligraphy are not compatible [duplicate]

Today I update my MikTeX installation. Among updated packages is l3kernel which doesn't work with calligraphy library, even if it is not used in TikZ picture: \documentclass[border=1mm, tikz]{...
0
votes
0answers
65 views

l3keys2e's option with accent: \UseTextAccent… \@curr@enc error

The following expl3 class, that provides an option (mykeyword) thanks to l3keys2e, works like a charm: \begin{filecontents*}{myclass.cls} \RequirePackage{l3keys2e} \RequirePackage{expl3} \...
3
votes
2answers
39 views

Special treatment for first and last items in \seq_map_inline

It is rather common to have to apply special treatment for first and last items of a sequence. I wonder what the best ways to treat these cases in expl3's \seq_map_inline. For instance, suppose I'd ...
2
votes
1answer
61 views

What's the expl3 way to access TeX insertions?

Is there an established expl3 way of working with insertions defined in TeX? The issue came up for me with trying to modify \footins. I don't see anything in the documentation other than the renamed ...
3
votes
2answers
207 views

LaTeX 3 string variable with braces

I want to include some braces in my string variable: \documentclass{article} \usepackage{expl3} \begin{document} \ExplSyntaxOn \str_new:N \l_example_var \int_new:N \l_example_int \...
6
votes
1answer
75 views

Protected expansion in expl3

I am trying to understand whether there is a proper expl3 way to achieve the same result as the latex2e \protected@edef, that is expanding a token list while respecting the \protect mechanism of ...
0
votes
0answers
47 views

Why is \tex_par:D behaving differently from \par?

As illustrated in the MWE, using \tex_par:D rather than \par within a list environment leads to unexpected side-effects. Is this intended behavior? If so, it's likely to break a lot of code. I ran ...
3
votes
1answer
123 views

Proper LaTeX3 syntax for \usepackage{<name of .sty file>} - \ProvidesPackage{<name of .sty file>}

The MWE_1 defines a document command which in turn calls a \cs_ macro. Both are defined in the document's preamble section sandwiched between \ExplSyntaxOn \ExplSyntaxOff statements, as is the ...
3
votes
1answer
33 views

Locally redefining ~ in code that uses expl3 facilities

I am trying to rewrite a package to use expl3 facilities. Here I need to define an \initializeplaintitle command that stores a "purified" version of the document title, retrieved from \@title into a ...
4
votes
2answers
50 views

latex3 / expl3 equivalent of \raisebox with lenght expression

I am trying to learn expl3 by re-implementing some macros and little packages to take advantage of it. I am now wondering if there is a more latex3-ish way of doing something like \raisebox{-\height+...
3
votes
1answer
93 views

Issue with \@ifl@ter and expl3 date style

I use MiKTeX on windows and am currently having trouble loading expl3. I recently updated the LaTeX3 packages. The following code is sufficient to generate the error: \documentclass{article} \...
3
votes
1answer
91 views

Undefined control sequence \g__prg_map_int [duplicate]

I'm trying to improve an answer of mine and I've found a solution which works perfectly on Overleaf (I looked at the log, not only what is displayed). \listfiles \documentclass[12pt,fleqn]{article} \...
12
votes
2answers
436 views

What is the best practice to pass spaces to Lua from expl3?

In LuaTeX, using the \directlua primitive (within a standard LaTeX2e setup) \directlua{tex.print("Hello World!")} will produce "Hello World!" to the output PDF. On the other hand, in expl3 code \...
0
votes
1answer
64 views

Biblatex: brackets and no bracket

I would like to know whether it is possible with biblatex and pdflatex to automatically select the in-text look of the \cite command, with the author-year style. For instance, I would like citations ...
0
votes
1answer
40 views

Can `function`s called in `\tl_map_` and `\seq_map_function`s be defined with more than one argument?

In providing an answer to my recent post "Preserving spaces when scanning tl variables into a sequence using \seq_set_split" Enrico Gregorio defined \__rn_add:n to be called by \tl_map_function. In ...
4
votes
1answer
60 views

Question about the booleans in expl3 (of LaTeX3)

In expl3, there are the commands \int_zero_new:N, \tl_clear_new:N, \str_clear_new:N , \seq_clear_new:N, \clist_clear_new:N, etc., but there is no similar command for the booleans (something like \...
1
vote
2answers
55 views

Testing a tl variable for being a special character

Following on from my question yesterday (Testing items in a tokenlist variable for special characters using tokenlist constants) and the brief discussion and answer I had from egreg, the least I would ...
2
votes
1answer
40 views

Testing items in a tokenlist variable for special characters using tokenlist constants

My attempts to test individual items in a tokenlist variable for special characters using the constants provided in interface3 VII.9: Constant token lists are failing miserably. Passing a special ...
2
votes
1answer
45 views

How to test a \newif conditional in expl3

Suppose I want to test an \ifSomething conditional that is defined by a package which may or may not be loaded. I know how to do this in plain LaTeX, but I'd like to define an expl3 conditional to do ...
4
votes
3answers
120 views

Preserving spaces when scannig `tl` variables into a sequence using `\seq_set_split`

As stated in the interface3 document (Part IX, 1. Creating and initializing sequences) \seq_set_split: does not preserve spaces. Wishing to scan the text contained in a _tl variable into a sequence ...
2
votes
2answers
52 views

Math subscript inside ExplSyntax switches

I'd tried to rewrite @egreg answer given in this Reusing of DeclarePairedDelimiter in a foreach manner thread to solve another 'code reuse' issue, but I've got some problem with math subscript between ...
4
votes
1answer
48 views

Where does the \par come from with \hbox:n

I don't know anything about expl3. I naively thought that I would get the same output for both lines \documentclass{article} \usepackage{expl3} \begin{document} \makeatletter A \def\par{1\global\let\...
15
votes
2answers
495 views

Passing arguments to a macro hidden in the text

Context: I'm trying to write a macro that behaves somewhat like C's printf family of functions. For instance, the following C code: #include <stdio.h> int main() { printf("Hello %s! Today'...