Search code examples
matlabdialogfont-sizetex

Change font of MATLAB dialogue


I am trying to change the font size of the message text in a questdlg. I have been able to get some TeX to work (subscript, greek letters), but I can't figure out how to change the font. Here's what I've tried:

test_str = '\fontsize{10}{12}\selectfont Words go here';
options.Default = 'yes';
options.Interpreter = 'tex';

questdlg(test_str,'title','yes','no',options)

And I get the warning message:

Warning: Error updating Text.

 String must have valid interpreter syntax:
\fontsize{10}{12}\selectfont Words go here

> In defaulterrorcallback (line 12)
  In questdlg (line 314)

I am pretty certain that the text I am using is valid TeX syntax, but I don't know why it's not working. Is there something I'm missing, or is there a list of supported features for this particular interpreter?


Solution

  • Actually, the \fontsize command is not TeX - it is LaTeX! So, change the interpreter from tex to latex, and it works:

    test_str = 'Normal size, \fontsize{18}{24}\selectfont other size';
    options.Default = 'yes';
    options.Interpreter = 'latex';
    
    questdlg(test_str,'title','yes','no',options)
    

    resulting dialog box