how do I insert a string var in title command using LaTeX/TeX

21 views (last 30 days)
Jan on 18 Jun 2014
Edited: Walter Roberson on 14 Apr 2016
I've been looking for a solution for the following challenge:
title ('\color{cyan}\WBC \color{red}RBC \color{blue}PLT)
displays "WBC RBC PLT" above the plot in fig(1) in the selected colors.
Now I'd like to add the number of events for the 3 subsets in the figure(2) title, but have not been able to figure out how to replace the 'literal' strings WBC, RBC, and PLT with string variables as in
wbcstr = num2str(100);
rgbstr = num2str(1000);
pltstr = num2str(60);
title ('\color{cyan}\wbcstr \color{red}rbcstr \color{blue}rbcstr)
Thanks in advance,

Accepted Answer

Kevin Claytor
Kevin Claytor on 18 Jun 2014
mytitle = sprintf('\\color{red}%d \\color{blue}%f',5,pi);

More Answers (0)

Community Treasure Hunt

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

Start Hunting!