Stack Exchange Network

Stack Exchange network consists of 174 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 [latex3]

Please do not use this tag for general LaTeX questions. {latex3} is about the new material being developed by the LaTeX3 project. This includes the expl3 programming language along with higher-level concepts such as xparse and xtemplate.

10
votes
1answer
1k views

Is LaTeX3 ever going standalone or has this goal been abandoned?

I recall that earlier (over 10 years ago), producing a standalone compiler of LaTeX3 code was a project's goal. Today, this goal is no more articulated. Instead, the developers stress today that LaTeX ...
2
votes
1answer
101 views

How can I put four (or more) commands in one command, without repeating so much code using expl3?

I'm trying to put together four commands that encapsulate tikzpicture environments and the use of tikzmark, in one, all have their own keys, but, they have a lot of code in common. The commands are ...
2
votes
1answer
53 views

Software Architecture and xtemplate

When writing a package, there may be the situation that several things need to interact to make a complete product. When using xtemplate, I can define each part as an object. This means that the ...
1
vote
0answers
30 views

Making Environments Using xtemplate

The examples for xtemplate show how to make document commands, but I haven’t seen anything involving environments. If I were to define an environment using xtemplate, what would the best approach be? ...
4
votes
1answer
38 views

expl3: How to add a clist-grouping brace to a tokenlist?

I have LaTeX3 code for a macro that processes its parameters in a complicated way and builds a tree-like structure. To represent this structure it constructs a comma-separated list of strings and ...
0
votes
0answers
21 views

What is the difference between control sequences begining with `\` and the ones begining with `\@`? [duplicate]

In all LaTeX packages documentations that show their internal codes, we see \@ and often we see \@@ or even \@@@. What is the difference between \ and \@? What does it mean to write more @ to start a ...
2
votes
2answers
110 views

Token list vs string in LaTeX3

In my opinion, l3 strings are special token lists whose where all characters has category code 12 (except space), and most interfaces in l3tl and l3str are similar. So, if I just want to process "...
2
votes
1answer
80 views

Latex3 programming and tex primitives: how to “execute after” instead of expandafter

Here is a bit lengthy question. I hope it is not too specific. I'm trying to scan some tex documents and I want to produce text files directly. I'll achieve this by scanning the tex input token by ...
2
votes
1answer
61 views

expl3 read a comma list from file

I am using expl3 now, I want to read data from file, and store them in a comma list, then use the comma list one by one. I don't have any code, I just know exp13 have these function, so need someone ...
2
votes
1answer
60 views

Latex3: Unicode (utf8) string, weird output with pdflatex

I want to store text that contains non-ascii characters in latex3 string variables. With xelatex and lualatex it works well but With pdflatex next mwe produces incorrect output. For legacy reasons ...
3
votes
1answer
55 views

Latex3: Declare variable in aux file

My question is a follow-up to this question. I want to write variables to aux file and also declare them there because the number of variables varies and their csnames are defined in the document ...
6
votes
2answers
57 views

listings: highlight a prefixed keyword starting with a single quote

This is about Rust and their lifetime notation: \documentclass[crop,varwidth]{standalone} \usepackage{listings} \usepackage{xparse} \usepackage{expl3} \usepackage[svgnames]{xcolor} \def\noprint#1{} ...
3
votes
1answer
50 views

Latex3: multicolumn at the beginning of a token list produces an error

I'm not sure if using token list is a good approach to generating table data. Anyway, here is a weird result. It works well in all other cases except when the first item in token list is multicolumn. ...
1
vote
1answer
45 views

Replacing strings including colon by latex3

I would like to replace such as :a into à. The following is the code \ExplSyntaxOn \str_new:N \replace_str \cs_new:Npn \my_replace:n #1 { \str_set:Nn \replace_str {#1} \str_replace_all:Nnn \...
16
votes
1answer
124 views

L(a/ua)TeX kernel/package solution incorporating the globally optimised float placement/pagination

It was interesting to read Frank Mittelbach's articles on globally optimized pagination and float placement. https://www.latex-project.org/publications/ But, there is no mention of these proposed ...
1
vote
1answer
87 views

How to use \exp_not:N and \exp_after:wN to prevent the expansion of \input in a expl3 list?

I have been working on the implementation of an environment (which never nests) and a command to save different parts of a document and use them within it later using a expl3 list andxparse. So far ...
5
votes
1answer
129 views

Is there a LaTeX3 equivalent for \@ifpackageloaded?

Is there a LaTeX3 equivalent for \@ifpackageloaded?
3
votes
1answer
57 views

Latex 3 split macro parameter into strings

I'm trying to split macro arguments into two separate strings on 'underscore' character using expl3 package but none of the following attempts (commented line) work. I also tried 'verbatim' argument ...
8
votes
1answer
229 views

TL2018 (MacTeX) and TikZ calligraphy library

Under MacTeX 2018 the following TeX file: \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations.pathreplacing,calligraphy} \begin{document} \tikz\draw[decorate,decoration={...
0
votes
0answers
48 views

How to dynamically generate function argument signatures using custom API in LaTeX3

In trying to learn more about the details of what is possible with LaTeX, I wanted to see if I could create an API around creating functions. This is what the output function would be, for example: \...
0
votes
1answer
39 views

Alternative to defining nested commands in LaTeX3

Since it seems that the LaTeX convention is to use globally scoped instead of locally scoped commands/environments (which makes sense now for a complex reason), I am wondering how to handle the case ...
2
votes
2answers
102 views

How to compare different data types in LaTeX3

I am trying to do basic comparison of values but am uncertain how to do it correctly (using LaTeX3 functionality only, so without xifthen). From the documentation, these are the only generic if ...
1
vote
2answers
54 views

How to return a value from a function in LaTeX3

I have this MWE that tries to return a value from \l_example_foo_int from a function: \documentclass[a4paper]{article} \usepackage{expl3} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\...
1
vote
1answer
130 views

Best-practice project architecture for creating a LaTeX3 package / class

I would like to take my .cls file and refactor it into a locally used package. Specifically I would like to: Divide it into multiple files for easier readability (separation of concerns). Have it ...
3
votes
1answer
90 views

How to pass comma-separated list as value to l3keys in LaTeX3

I would like to do the following: \mycmd{foo={a,b,c},baz={1,2,3}} where {a,b,c} and {1,2,3} are arrays/sequences of data. The MWE is this: \documentclass[a4paper]{article} \usepackage[english]{...
1
vote
0answers
24 views

How to package bibliographies into their own package in LaTeX3

I would like to put my references into a single package to use across documents. Right now I have a .bib file with the listings, and import it into a .cls file as \bibliography{./my/local/bibliography}...
1
vote
2answers
95 views

How to define nested environments and commands in LaTeX3

I would like to define nested environments that have the same nested definitions of sub-commands and sub-environments. This is how it would be used: \begin{myenva} \begin{myenvx} \begin{myenvz} ...
2
votes
1answer
43 views

How to dynamically define l3keys

In learning how to properly distinguish between the different function signatures in LaTeX3 (and other features), I want to try a more complex example of dynamically generating l3keys, since it ...
1
vote
1answer
36 views

How to define/iterate over nested property lists in LaTeX3

I have the following MWE: \documentclass[a4paper]{article} \usepackage[english]{babel} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{expl3} \usepackage{xparse} \ExplSyntaxOn \...
3
votes
1answer
98 views

Best practices on when to create a new function vs. a command in LaTeX3

After reading this article, it states: Experienced TeX programmers will probably be worried that I’m talking about ‘functions’ and not about ‘macros’. ... The LaTeX3 programming approach ...
2
votes
1answer
51 views

Token lists vs. sequences in LaTeX3

Wondering if token lists can be used to manage property list collections, and create sequences out of them, or if seq are required in order to work with collections of property lists. That is, it ...
2
votes
1answer
26 views

How to construct a variable name inside a command in LaTeX3

I have this example document structure: \documentclass[a4paper]{article} \usepackage[english]{babel} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{expl3} \usepackage{xparse} \...
4
votes
1answer
64 views

How to expand local variable from l3keys in LaTeX3

I have the following MWE: \documentclass[a4paper]{article} \usepackage[english]{babel} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{expl3} \usepackage{xparse} \ExplSyntaxOn \...
7
votes
2answers
143 views

Choosing property lists vs. key-value lists in expl3

What determines whether I should use a property list or a key-value list when implementing some interface in expl3 syntax? The LaTeX3 documentation says Property lists are intended for storing key-...
3
votes
1answer
52 views

Count number of elements in list with condition

Consider the following example: \documentclass{article} \begin{document} \noindent How do I use \LaTeX 3 to construct a command that prints the number of elements from a given list that are less ...
4
votes
1answer
83 views

Expl3 syntax: graceful handing of conditional/undefined arguments

In this thread, writing newcommands, user interface advice request, some of you taught me how to write a function that can generate an elaborate header. In that case, my problem was complicated ...
7
votes
0answers
171 views

How to create a boilerplate dtx file for a package using LaTeX3 (similar to dtxgen for LaTeX2e)

I'm interested in making a package using LaTeX3, but I can't (a) find documentation on how to generate a new dtx file for it or (b) find a template for creating a dtx file for a package using LaTeX3 (...
5
votes
0answers
82 views

Input sanitization for \fp_eval

Is there a command that asks whether an argument to \fp_eval is a parse error or not? E.g.: \fp_if_valid:nTF { 1+2.3*2 } { yes } { no } % yes \fp_if_valid:nTF { 1+2.3* } { yes } { no } % no I would ...
0
votes
1answer
65 views

latex3: error when including amsmath

The following code still renders correctly but throws an error ('Missing } inserted') when including amsmath: \cs_new:Npn \putInEnvironment:nnn #1 #2 #3 { \if_bool:N #2 \tl_put_left:Nn #...
2
votes
1answer
84 views

Math functions and expansion issues

The following MWE is a very much simplified version of a more complicated system I am trying to develop. As a result, the interface seems a bit weird, and I don’t expect anyone to like it in the ...
1
vote
2answers
62 views

LaTeX3: \clist_gpop has extra pop in tabularx

I asked about \clist_gpop and tabular yesterday: LaTeX3: token list from clist_pop can't display in tabular 2nd column It's fixed. But when I change to use tabularx, it look like has extra pop, ...
2
votes
1answer
54 views

LaTeX3: token list from clist_pop can't display in tabular 2nd column

I try to make a clist to table function. It's work fine in first column, but second column disappear. Below is MWE (I removed loop part.): \documentclass[12pt]{article} \usepackage{expl3} \...
3
votes
1answer
44 views

Upper- or lower-casing input based on the case of the first character

For some sequence of characters, I want to change the case of all characters to match that of the first. So for example, aBCD → abcd and Abcd → ABCD. My naïve attempt to do this in LaTeX3 did not ...
4
votes
2answers
144 views

Latex3 Token-List commands do not work as expected

Let's take a trivial case: getting the head and tail of a token list and reversing the order: \documentclass{article} \usepackage{xparse} \usepackage{expl3} \ExplSyntaxOn \cs_set:Npn \cs_split:n #...
1
vote
2answers
102 views

Multi-stage regular expression replacement

I'm trying to write a macro which will recognize certain sequences of characters in a string, and then map those onto a different set. In the particular case I have in mind, since there are multiple ...
2
votes
2answers
61 views

How to modify a single item in l3seq/l3clist

How can I modify a single item in l3seq or l3clist, just as a normal "array" in other programming languages? Like this: a[n] = x. \seq_item:Nn may leave a "right value", but how to get a "left value" ...
5
votes
1answer
47 views

Why does this ~ space not print within ExplSyntax command?

I am aware that \ExplSyntaxOn changes how spaces are interpreted. I use ~ to represent a space, but in this instance one of those tildes is not printed. \documentclass[a4paper,10pt,openany]{scrbook} ...
12
votes
1answer
355 views

Warning with tikzlibrary calligraphy

The following MWE: \documentclass{article} \usepackage{tikz} \usetikzlibrary{% decorations.pathreplacing, calligraphy } \begin{document} \thispagestyle{empty} \tikz \draw[ ...
6
votes
3answers
218 views

Translate xfp notation via l3regex to LaTeX notation

using the xfp package to calculate mathematical terms works fantastic and I am trying to automate some things to also make the \fp_eval:n input also presented properly with LaTeX notation. My attempt ...
3
votes
2answers
178 views

Problems with numerical stability [closed]

In a macro that is supposed to calculate the value of the third derivative, I used the following formula: (f (x + 3 * delta) -3 * f (x + 2 * delta) + 3 * f (x + delta) -f (x)) / (delta) ^ 3 Because ...