The tag has no usage guidance.

learn more… | top users | synonyms

40
votes
4answers
2k views

Has the time come for a LaTeX3 successor to 'listings'?

I'm currently looking for a nice and challenging open-source project to work/collaborate on after my thesis. I don't have a Comp. Sci. background, but I'd like to learn more about compiler ...
20
votes
1answer
615 views

Defining a find and replace algorithm using LaTeX3's l3regex

I've been trying to work out the mechanics of LaTeX3's regular expression system as implemented in l3regex, but am having some difficulty understanding how/why it is acting as it is. If I use as an ...
8
votes
1answer
152 views

Missing space when replacing with \regex_replace_all:nnN

How can I make \regex_replace_all:nnN not remove the space between x y? \documentclass{article} \usepackage{l3regex} \ExplSyntaxOn \cs_new:Npn \replace #1#2#3 { \tl_set:Nn \l_tmpa_tl {#3} \...
6
votes
1answer
449 views

Color each letter in document

I am trying to define a command that changes the color of every letter in the whole document to a specified color. I already tried different approaches from this thread, but I was not able to color ...
6
votes
1answer
393 views

Dynamic calculation within regular expression quantifier in LaTeX3's l3regex package

I am trying to do some simple calculations to be applied to a regular expression quantifier used in l3regex's \regex_replace_all:nnN function. I've built my code around what I found here: Defining a ...
6
votes
1answer
44 views

Regex for a string with a command inside it

I have managed to create a command that takes an argument and does substitutions on it with l3regex. However, if the argument contains itself a command, the command name is printed in the output as if ...
6
votes
1answer
40 views

LaTeX3 Regex using control sequence

I'd like replace some words/characters using l3regex on a arbitrary variable. Instead of doing this \tl_set:Nn \l_myname_tl {Hello} \regex_replace_all:nnN {(\w+)} {\1 World!} \l_myname_tl which ...
6
votes
1answer
94 views

Expandable math

I am trying to create a script which expands some easy to read and write commands into more full-blown math formulas which uses variables so that it first prints its names and then on a new line, it ...
5
votes
2answers
95 views

Strange behave of index and l3regex

I am experimenting with LaTeX3 features and get a strange behaviour in a combination from index and l3regex. I try to replace all occurrences of :<space> with the exclamation mark sign, so that ...
5
votes
0answers
235 views

Dynamically applying formatting to regular expressions [closed]

One useful tool I find in InDesign are the Grep styles. With them, one can define character styles (e.g., boldface in small caps) for whatever expression matches the grep pattern. I know this is ...
4
votes
1answer
44 views

Modify contents of environment using l3regex and then write to file

I want to define an environment (in a class file, as it happens) the contents of which are both displayed on-screen as they are written, but they are also modified (e.g. using the l3regex package) and ...
4
votes
1answer
107 views

Does LaTeX support including a specific part of an \input, like a specific environment and ignoring everything else? [duplicate]

Can LaTeX natively include only specific expressions from an input file (ignoring the rest)? I am not sure how to best word my question. Below is an example of what I'd like to do. Situation For ...
3
votes
2answers
42 views

Changing remote path of figures to local path with a regular expression

I am using markdown to write the bulk of my thesis, and then converting it to LaTeX (with Pandoc) for the final presentation. To include graphics I use dropbox share links as: ![MyCaption](http://...
3
votes
1answer
185 views

How can I match a control sequence using \regex_match?

How can I match a control sequence using \regex_match? This code \newcommand{\iw}[1]{\immediate\write16{#1}} \iw{1 should be true} \regex_match:nnTF {May} {May} {\iw{TRUE}} {\iw{FALSE}} \newcommand{...
3
votes
2answers
57 views

Remove all body text from book class with nested files

I have a long set of notes as a book class where each chapter is added to the master document with \input{}. Each chapter file has sections, subsections, itemizes, enumerates, and body text. I would ...
3
votes
1answer
55 views

Extracting the pagenumber of the first page of a section from the toc file

In a project I am working on, I use subfiles to compile a document, each containing one section. If I compile only the document containing some given section, I want the page number to be correct. One ...
2
votes
1answer
357 views

l3regex usage throws __scan_new:N error

Using TeXLive, with this MWE \documentclass{article} \usepackage{expl3} \usepackage{l3regex} \begin{document} a \end{document} I get an error for an undefined control sequence (/usr/share/...
2
votes
1answer
38 views

Deleting defined variables or assign within group

This is a followup to Egregs answer in the question Expandable math, The code is included here as an MWE. It would be a great help if I could somehow delete all previeously defined variables, or ...
2
votes
1answer
60 views

How to automatically put the footnotes before punctuation?

I have little problem :). I have a big file with 1422 footnotes. The problem is that I need to put every footnotes before punctuation (.,;). How to automatically put the footnotes before punctuation? ...
2
votes
0answers
53 views

Listings - Keyword with Regex [duplicate]

I would like to colorize in a special color all my constant which are all in capital letters in my code and all my method variables which begin with an @. Is it possible to use Regex to define ...
1
vote
1answer
108 views

How can I apply a regex (l3regex) on items in a sequence? [LaTeX3]?

I am trying to apply a regular expression to a string item from a sequence in LaTeX3. Example Compiles with error, but only by pressing return many times. ! Missing control sequence inserted. <...
1
vote
1answer
372 views

Regular Expression for logical implication?

I am massively unfamiliar with the usage and syntax of regular expressions so the following problem is making my brain bleed. Background: I am taking logical expressions, parsing them, making some ...
1
vote
0answers
30 views

Expansion to fpeval

This is a followup to Egregs answer in the question Deleting defined variables or assign within group, I am trying to expand the code, but got into trouble while attempting some calculations with ...
0
votes
0answers
21 views

Converting Character Combinations into Different Combinations

I need to convert certain character combinations in words into different singular characters for a dictionary style document. Example: Convert the word: faun      &...