Single quotes are not performing as they should in Scriptcase with braces and brackets. I understand that they have special meaning in Scriptcase; but that breaks PHP code.
I had to break the single string into two concatenated to perform a str_replace().
e.g.
str_replace('\LR{payer'.'}', 'payer', $latex_template);