New answers tagged expl3
2
votes
Accepted
Translating lua code into LaTeX3: how to iterate over a prop containing props?
A fairly literal translation of the Lua:
\documentclass{article}
\ExplSyntaxOn
\NewExpandableDocumentCommand{\StyleOption}{}{as} % for the key to \l_abbrev_his_prop etc
\prop_new:N \...
4
votes
\ProvidesExplFile Question
\ProvidesExplFile is based on \ProvidesFile, which then 'goes with \ProvidesPackage and \ProvidesClass. These all use the LaTeX catcode stack to save/restore @ (classically) and ExplSyntaxOn/Off ...
3
votes
LaTeX3 dynamic generation of \prg_new_conditional
I can't see the need for \cs_if_free:NTF. You're developing a package and if, by mistake, you try redefining an already defined conditional in your own namespace, you'll be welcome with an error ...
2
votes
LaTeX3 dynamic generation of \prg_new_conditional
I still think that your package is your namespace, hence your responsibility. As long as this isn't used via a user-interface to set up some internal auxiliaries I'd not advise using it and instead ...
2
votes
Accepted
LaTeX3 - Use of \__seq_use_setup:w doesn't match its definition
It is not at all clear what you want this code to do, but this runs without error
\documentclass{article}
\ExplSyntaxOn
\NewDocumentCommand{\AminoAcidPrinter}{mm}
{
\aminoacid_printer:...
3
votes
Accepted
tabularx counts expl3 more than once but LaTeX2 doesn't?
tabularx resets all latex counters (using the method used by \include) count registers allocated with \newcount or expl3 do not take part in this mechanism.
4
votes
Accepted
adrentry modifications with expl3?
You can do it without xpatch.
\documentclass{scrlttr2}
\usepackage{lipsum}
\ExplSyntaxOn
% at the end of \begin{letter}{<name>} store the <name>, which is #2,
% but without the ...
4
votes
\NewDocumentCommand vs \newcommand vs \NewExpandableDocumentCommand (to define a container for a text)
We have two cases how to save a tokens list into TeX memory and restore it.
First case is defining macros without parameter and second case is using toks
registers:
save it:...
3
votes
\NewDocumentCommand vs \newcommand vs \NewExpandableDocumentCommand (to define a container for a text)
In my LaTeX book, I have relegated \newcommand to a sidebar and \NewExpandableDocumentCommand to an appendix, preferring \NewDocumentCommand (and \NewEnvironment) for creating commands.
The biggest ...
6
votes
\NewDocumentCommand vs \newcommand vs \NewExpandableDocumentCommand (to define a container for a text)
If you want a container for text that can be delivered by expansion also in “full expansion” contexts, then \NewDocumentCommand is out of the question, because it defines a \protected command.
So the ...
4
votes
Accepted
\hspace with variable input does not work correctly with \ExplSyntaxOn
When a table cell ends, LaTeX does \unskip in order to remove spaces that may have been input.
With \ExplSyntaxOn your code is equivalent to
#1\hspace{\numberedlistitemspacing}&
and LaTeX duly ...
1
vote
Store evaluated output of expl3 macro
Not sure how you want \bookmark to work with \CountSubStr but this should work:
\documentclass{article}
\usepackage{bookmark}
\newcounter{substringcount}
\ExplSyntaxOn
% \CountSubStr{<substring&...
5
votes
Accepted
How to expand function with star using latex3?
Notwithstanding that it's common to say that \DeclareMathOperator* is a variant of \DeclareMathOperator (the same for all such commands), the command is just \DeclareMathOperator, which looks ahead to ...
1
vote
Why the ⟨code⟩ of \NewDocumentCommand{⟨cmd⟩}{⟨arg spec⟩}{⟨code⟩} isn't displayed in the terminal?
I'm not sure why you'd expect that output. For instance
\iow_term:x { LaTeX=\LaTeX }
will stop with a weird error
! Undefined control sequence.
\S@10 ->\gdef \tf@size
{10}\...
3
votes
Accepted
Why the ⟨code⟩ of \NewDocumentCommand{⟨cmd⟩}{⟨arg spec⟩}{⟨code⟩} isn't displayed in the terminal?
If you use \newcommand\macro then the \macro is defined using TeX primitives \long\def\macro. The macro is expanded inside \edef and inside \write and \message primitives, i.e. when you write an ...
1
vote
Accepted
7
votes
Accepted
Assigning commands to str does not work
The str datatype matches the result of primitives such as \string, \detokenize, ... All character tokens of catcode 12 (other) except space which is catcode 10.
So you can not store a csname token ...
2
votes
Accepted
Copying one string into another does not work expl3
You seem to have a wrong idea of what \str_show:N does. If you want to set a string to the value of another one, you do
\str_set_eq:NN \l__eur_length_temp_str \g__eur_length_str
Here's a fixed code:
\...
5
votes
Accepted
Replacement for \xspace with expl3
There is no reason whatsoever for using \xspace or variant thereof at the end of a command with arguments.
There is little reason for \xspace after commands without argument either, but that's a ...
1
vote
Accepted
LaTeX 3 - Using the align environment with scratch variables
The instruction \tl_set:Nn \l_tmpa_tl {xyz} is an assignment, just like \int_incr:N \l_tmpa_int, \dim_set:Nn \l_tmpa_dim { 1pt }.
There are many kinds of assignments and it's actually mostly ...
6
votes
LaTeX 3 - Using the align environment with scratch variables
Your question is: why & breaks the pattern? The answer is here.
The align environment is based on \halign TeX primitive. Each item in the data part of \halign (separated by &) is packed into \...
1
vote
LaTeX 3 - Using the align environment with scratch variables
Something like this?
\documentclass{article}
\usepackage{amsmath}
\ExplSyntaxOn
\NewDocumentCommand{\mycmd}{}{
\begin{align}
\tl_gset:Nn \g_tmpa_tl {1+k^2}
x &= \tl_use:N \...
4
votes
Accepted
Why do two identical clists have different element counts?
add debugging messages:
\documentclass{scrlttr2}
\ExplSyntaxOn
\clist_clear_new:N \g__timelist_median_clist
\clist_new:N \l__timelist_median_clist
\NewDocumentCommand{\setlist}{m}
{
\...
3
votes
Accepted
How to pass one element of a clist as an int argument for another function?
! Undefined control sequence.
<argument> \l__timecalc_time_minutes_testing_int
l.27 \strtime{2}{h}
?
so declare ...
Top 50 recent answers are included
Related Tags
expl3 × 1362latex3 × 382
macros × 182
xparse × 176
expansion × 98
l3keys × 60
programming × 50
tikz-pgf × 45
token-lists × 43
conditionals × 41
errors × 39
luatex × 39
package-writing × 34
l3regex × 34
key-value × 29
tables × 28
strings × 25
comma-separated-list × 25
environments × 24
catcodes × 20
siunitx × 19
l3prop × 19
external-files × 18
documentclass-writing × 18
pdftex × 17