LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
aparsloe <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Wed, 26 Aug 2015 10:53:14 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (36 lines)
On 25/08/2015 1:35 a.m., Joseph Wright wrote:
> On 25/08/2015 07:05, Joseph Wright wrote:
>> On 26/08/2015 00:44, aparsloe wrote:
>>> (1) I wanted to use \tl_replace_all:Nnn on a token list that might
>>> contain braced groups. Using \tl_set_rescan:Nnn to change the category
>>> codes of { and } seemed the most direct way of proceeding. (Then
>>> resetting the category codes after replacement with an empty setup.)
>> I see what you mean (I have a similar case in siunitx, for historical
>> reasons). We'll explore what we can do with this: there are
>> mapping-based approaches one can imagine that will enter brace groups.
>> (We do that for \tl_lower_case:n, for example). However, for a general
>> 'search and replace' I'd be slightly wary as the TeX convention that
>> stuff in brace groups is 'special' is quite prevalent. (Depending on
>> performance requirements, you might also look at l3regex if you are
>> doing the replacement only very rarely.)
> It would be useful here to see what your real use case is, as that's
> often illustrative.
> --
> Joseph Wright
Thank you for the responses. I was remiss. I didn't make it clear that 
looking inside braced groups was not the concern, rather to replace (or 
remove) a list of tokens that might include braced groups. I've been 
reworking the code of a package that turns latex expressions into 
expressions that can be digested by l3fp. In fact, this particular issue 
has now been reworked away, but the problem had been to remove a varying 
expression, e.g. \sqrt{123}  or \frac{1-x}{1+x}, from the initial 
segment of a formula. Rescanning { and } to "other" allowed me to use 
\tl_remove:Nn successfully. Although I can think of other means of doing 
this, they seem cumbersome by comparison.

Andrew

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

ATOM RSS1 RSS2