9
votes
Accepted
What are these commands in the code?
These are the L3 programming layer commands (also known as expl3)
\tl_new:N \l_lotomat_input_tl
declares a new token list variable
\seq_new:N \l_lotomat_input_seq
declares a sequence variable
\...
9
votes
Testing if a string is a hexadecimal string in LaTeX3: code review, optimization, expandability, and protection
See below.
Yes, there are functions that should be defined protected in your question, for instance \cs_new:Nn \is_hexadecimal:nnTF (and as a result all functions calling it). The reason that's the ...
7
votes
Accepted
Fast way to test if an argument is an integer in LaTeX3?
The following is evil expl3 code (because it uses two happy :D macros) that implements the check for your regular expression in a pretty fast way. One could turn it even faster by implementing the \...
6
votes
Accepted
Long and protected macros in LaTeX3
These tests are low-level and check exactly what they say - is this macro say \protected, i.e. defined by
\protected\def
(or \edef equivalent). One would not expect to need to use these low-level ...
5
votes
Accepted
Using \tl_put_right with grouping from latex3 explsyntax
I'm not entirely sure about the purpose of collecting stuff in a global variable which you don't seem to use, but if you do want to collect it while keeping the options local, as Ulrike Fischer said, ...
5
votes
Using conditionals within \tl_put_right from latex3 explsyntax
Another solution if you need forwarding of * often is to define an argument processor for it such that #1 will contain a star if a star was given and be empty otherwise:
\ExplSyntaxOn
\...
4
votes
Accepted
Using conditionals within \tl_put_right from latex3 explsyntax
You're putting \IfBooleanTF{#1}{\task*}{\task} in the token list and #1 will be evaluated at call time, not at setting time.
\IfBooleanTF{#1}
{
\tl_put_right:Nn \l_tmpa_tl { \task* #2 \\ \textit{...
3
votes
Accepted
Unable to get l3keys choices conditional to work (latex3)
Your issue is that you put the \tl_if_eq:nnTF inside your \exp_not:n block, as such the values of \l_harry_itemj_ws_tl are not inserted there but instead once your code is actually executed there is a ...
3
votes
Testing if a string is a hexadecimal string in LaTeX3: code review, optimization, expandability, and protection
You asked about optimization of compilation time. So, you can try to use TeX primitive features directly, no via expl3 language. Expl3 is a new language inside TeX language then the result will never ...
3
votes
Accepted
Testing if a string is a hexadecimal string in LaTeX3: code review, optimization, expandability, and protection
You want to define conditionals.
\documentclass[10pt]{article}
\ExplSyntaxOn
\NewExpandableDocumentCommand{\ishexadecimal}{o m m m}
{
\IfNoValueTF {#1}
{% no check on lenght
\vincent_ishex:...
2
votes
Accepted
Referencing commands in l3keys latex3 expl3
As I said before, you need to read up on the syntax to understand what's going on. expl3 (tries) (sometimes, in some ways) to wear its meaning on its sleeve. If you read the syntax, you immediately ...
2
votes
Accepted
How to detect inner spaces at the document level forwarded to token lists in LaTeX3?
Unprotected spaces are not treated as items in token lists in LaTeX3.
interface3.pdf says:
A token list (explicit, or stored in a variable) can be seen either as a list of “items”, or a list of “...
1
vote
How to detect inner spaces at the document level forwarded to token lists in LaTeX3?
You can use tl_if_in but as shown here you may need to trim first if you really only care about inner spaces.
\documentclass{article}
\begin{document}
\ExplSyntaxOn
\def\hasspace#1{\tl_if_in:nnTF{#...
1
vote
Accepted
Check if a predicate is satisfied on all tokens in LateX3 using conditionals
Your code cannot work, because you unconditionally issue \prg_return_true:.
You can add a special token at the end of the token list and check for it, so the functions know that the end has been ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
latex3 × 1041expl3 × 423
xparse × 105
macros × 81
expansion × 40
programming × 39
tikz-pgf × 28
token-lists × 28
l3regex × 27
l3keys × 27
tables × 26
conditionals × 25
pdftex × 23
luatex × 20
environments × 19
strings × 19
tex-core × 18
package-writing × 17
key-value × 17
comma-separated-list × 17
xetex × 16
errors × 16
best-practices × 12
overleaf × 11
documentation × 11