Info
This question is closed. Reopen it to edit or answer.
Can you change font size in LaTeX formatted comments?
1 view (last 30 days)
Show older comments
I've put a LaTeX-formatted comment in my code to produce a nice-looking formula when publishing, but it comes out in a small font size that is pretty blurry when saving to PDF. When I try to add a \fontsize command, I get "Warning: Unable to interpret LaTeX string", and the whole formula publishes as-written, not LaTeX-formatted.
Is there any way to change the size of a LaTeX-formatted comment?
This code works, but the formula displayed is too small:
$$x(t) = \sum_{k=0}^N \frac{8}{\pi^2}(-1)^k \frac{sin((2k+1)2\pi f_0 ...
t))}{(2k+1)^2}$$
%
This code doesn't work:
$$\fontsize{14}x(t) = \sum_{k=0}^N \frac{8}{\pi^2}(-1)^k \frac{sin((2k+1)...
2\pi f_0 t))}{(2k+1)^2}$$
%
1 Comment
Daniel Shub
on 18 Jan 2013
It is clear from the answers (and your comment answer) that there is missing information. Please edit the question to contain exactly what you are doing, what you see, and what you expect/want to see.
Answers (3)
José-Luis
on 17 Jan 2013
text(0.1,0.5,...
'$x(t) = \sum_{k=0}^N \frac{8}{\pi^2}(-1)^k \frac{sin((2k+1) 2\pi f_0 t))}{(2k+1)^2}$',...
'Interpreter','latex',...
'FontSize',14);
text(0.1,0.3,...
'$x(t) = \sum_{k=0}^N \frac{8}{\pi^2}(-1)^k \frac{sin((2k+1) 2\pi f_0 t))}{(2k+1)^2}$',...
'Interpreter','latex',...
'FontSize',20);
0 Comments
Daniel Shub
on 17 Jan 2013
There does not appear to be an easier way of doing it. Your approach of changing the font size within the math environment will not work. It simply is not valid LaTeX. I don't mean that \fontsize{14} is not valid, although it is not, I mean even simple things like \Large don't work inside a math environment. I know of no way of changing the font size from within the math environment. This means we need to change the font size outside the math environment. MATLAB allows this to a certain extent. As Jose-Luis says in his answer, if you change the font size in a figure, this changes the font size of the LaTeX output. The problem is that TMW have decided to hard code the font size into publish.m.
In my version (R2011a) line 747 of publish.m sets the font size
temptext = text('Parent',tempaxes,'Position',[.5 .5], ...
'HorizontalAlignment','center','FontSize',22, ...
'Interpreter','latex');
If you overload publish.m you can substitute any font size you want. You could probably get fancy and have it read it from a configuration file someplace. Note that publish tries to be smart and doesn't always regenerate the graphics, so make sure you delete all the temporary files before running.
0 Comments
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!