Skip to main content
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 \...
David Carlisle's user avatar
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 ...
Skillmon's user avatar
  • 63.1k
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 \...
Skillmon's user avatar
  • 63.1k
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 ...
Joseph Wright's user avatar
  • 263k
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, ...
cfr's user avatar
  • 211k
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 \...
Skillmon's user avatar
  • 63.1k
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{...
egreg's user avatar
  • 1.2m
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 ...
Skillmon's user avatar
  • 63.1k
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 ...
wipet's user avatar
  • 75.8k
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:...
egreg's user avatar
  • 1.2m
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 ...
cfr's user avatar
  • 211k
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 “...
Ulrich Diez's user avatar
  • 30.1k
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{#...
David Carlisle's user avatar
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 ...
egreg's user avatar
  • 1.2m

Only top scored, non community-wiki answers of a minimum length are eligible