Need help debugging an error with Latex Interpreter and sprintf

For some reason I keep getting errors with the interpreter when I try to put in this code:
title(sprintf('Pressure $(1-M_\infty^2)u_{xx}+u_{yy}=0$, $M_\infty=%s$', Minf),'Interpreter','latex')
Anyone have suggestions for the formatting?

 Respuesta aceptada

You need to use two consecutive \\ in fprintf and sprintf.
This works:
title(sprintf('Pressure $(1-M_\\infty^2)u_{xx}+u_{yy}=0$, $M_\\infty=%s$', Minf),'Interpreter','latex')

Más respuestas (0)

Etiquetas

Preguntada:

el 3 de Dic. de 2017

Comentada:

el 23 de Jun. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by