OsakaWebbie
Programmer
Trying to use PHP to construct TeX code, and TeX loves curly braces. But in PHP, curly braces are interpreted as part of parsing variables. I have strings like "Dm7 G" (yes, they are guitar chords), and want them to become like "Dm\Sup{7} G".
If I do this:
I get a syntax error.
But if I do this:
the backslashes actually end up in the resulting string, which is not desired.
Suggestions?
If I do this:
PHP:
preg_replace("/([0-9]+)/","\\Sup{$1}",$chord)
But if I do this:
PHP:
preg_replace("/([0-9]+)/","\\Sup\{$1\}",$chord)
Suggestions?