Is there any reason you can't write
# pfr is partially_formatted_resultpfr = r"\mathjax{{color}}{{text}}".format(color = "blue") # ERROR! missing parameter `text`
result = r"\mathjax{{color}}{{text}}".format(text = "Spanish") # ERROR! missing parameter `color`
pfr = r"\mathjax{{color}}{{text}}".replace("{color}", "blue")result = r"\mathjax{{color}}{{text}}".replace("{text}", "Spanish") Best wishes Rob Cliffe