After a 10+ year LaTeX hiatus I am returning and slowly getting hold again of macro writing.
I now want to parse a string like "fisis" into the first letter "f" and the second half "isis". Case sensitivity is not really an issue.
Valid tokens obey the following rules:
- The first letter must be one of {a, b, c..., g}
- The second part of the token consists of exactly 0, 1 or 2 times the token "es" or "is"
For example, "cesis" is invalid as "es" cannot be followed by "is" according to rule 2.
The use case is creating a multi-lingual rendering of the tonality of a musical piece via a macro, e.g.: \tonality{fis}{minor} which would be rendered in German, French and English as follows: {Fis-moll. {\emph Fa dièse mineur.} F sharp minor.}
E.g., the first example "fisis" would be parsed as ( "f"; "is" x 2 ) which would be rendered as "F double sharp" in English (with the \tonalityEN macro) and "Ré double dièse" in French (with the \tonalityFR macro).
How can this be achieved?