Is there a way to easily code from within (La)TeX some text manipulation stuff, like "find" and "replace", so that I may automatize tedious manual labor ?
(EDIT It was mentioned in the comments by Christian Hupfer that l3regex
might be a solution, covering the constraints mentioned below - although David Carlisle said "no". Which one is it ?)
There are some important constraints though:
The approach has to be general, i.e. only using macros won't work, because I may want to do things like replace all occurences of "=" with ">".
I don't want to use LuaTeX (where I have heard that this can be done easily)
Coding should ideally by done in the preamble. As indicate here this can be done easily via the
xstring
package, but that has the disadvantage that if I want to search around the whole text (which can be quite large) I have to enclose everything in a\StrSubstitute[0]
which seems an ugly approach and requires me to mess with the content of my document which I'd rather leave untouched.At the very least I should be able to do text replacement, but I'd hope for some more advanced capabilities, meaning to have available at least a subset of the capabilities, regarding text manipulation, of a linux scripting language like sed
regular expressions
, from within the editor?l3regex
?:
in math mode you could just redefine its \mathcode to make it work like \colon without changing the token at all.