Avoid subscript in Matlab titles

I am working on some plots in Matlab, where I am using the filename as the title of the plot. In many of the files I am using underscores (_) as separator, and the result is that Matlab creates a subscript.

So for a file called b_staccato_004, I get a title bstaccato004.

After some googling I found that this is because Matlab per default treats such text strings as LaTeX code. The solution is to use the interpreter message locally:

title(filename, 'interpreter', 'none')

or it can be set globally using:

set(0, 'DefaulttextInterpreter', 'none')



Published by


Alexander Refsum Jensenius is a music researcher and research musician living in Oslo, Norway.

2 thoughts on “Avoid subscript in Matlab titles”

  1. The way it treats text as latex in title context and not say, figure names, is a little strange.

    You can also apparently escape the underscore with backslash to treat it literally: title(‘hello\_word’)
    which gives the expected result.

  2. Thanks, this helped me out. If you have a large set of names you’re getting from a file then it’s not practical to add backslashes or otherwise edit every title.

Comments are closed.