[texhax] detect characters in strings

Uwe Lueck uwe.lueck at web.de
Wed Jul 7 14:34:19 CEST 2010

Brandon Kuczenski <brandon at 301south.net>, 07.07.2010 13:58:08:
>Say I have a macro \mymacro which expands to a number, like 
>'0.00346'.  Due to circumstances beyond my control, this macro sometimes 
>contains something unsightly, like '3.46e-03', which causes later commands 
>(in fp.sty) to barf.
>Is there a way I can detect an 'e' in a macro expansion?

1. see substr.sty, 


some enhanced documentation is


2. with LaTeX internals \in@, \ifin@: 

    \expandafter\in@\expandafter e\expandafter{\mymacro}
    \ifin at ...\else...\fi

... these tests are not expandable 
(so, e.g., they will break inside section titles going to TOC), 
essentially (?--I would like to find the time to decide reliably) 
due to the fact that these macros serve to test for *arbitrary* substrings. 
Testing for a *fixed* substring like `e' can be done expandably. 
Do you need this?

3. The coolstr package


serves more general purposes regarding numbers. 

HTH -- Uwe.

More information about the texhax mailing list