As of May 31, 2023, we have updated our Code of Conduct.

New answers tagged

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 \...
David Carlisle's user avatar
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 ...
Joseph Wright's user avatar
  • 252k
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 ...
egreg's user avatar
  • 1.1m
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 ...
Skillmon's user avatar
  • 54k
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:...
David Carlisle's user avatar
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.
David Carlisle's user avatar
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 ...
egreg's user avatar
  • 1.1m
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:...
wipet's user avatar
  • 65.9k
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 ...
Don Hosek's user avatar
  • 13.5k
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 ...
egreg's user avatar
  • 1.1m
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 ...
egreg's user avatar
  • 1.1m
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&...
mrCarnivore's user avatar
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 ...
egreg's user avatar
  • 1.1m
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}\...
egreg's user avatar
  • 1.1m
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 ...
wipet's user avatar
  • 65.9k
1 vote
Accepted

Argument not returned for some options

noseperator is not noseparator
David Carlisle's user avatar
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 ...
David Carlisle's user avatar
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: \...
egreg's user avatar
  • 1.1m
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 ...
egreg's user avatar
  • 1.1m
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 ...
egreg's user avatar
  • 1.1m
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 \...
wipet's user avatar
  • 65.9k
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 \...
projetmbc's user avatar
  • 12.9k
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} { \...
David Carlisle's user avatar
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 ...
David Carlisle's user avatar

Top 50 recent answers are included