如何在 .pdf 中设置字体设置,通过 MATLAB 和 LATEX 发布 [英] How to set the font settings in .pdf, publish via MATLAB and LATEX
问题描述
在尝试为 .m MATLAB 代码发布 .pdf 文件时,方程式(用乳胶编写)没有以适当(平滑)的字体正确呈现,而是字体看起来分散.
While trying to publish a .pdf file for .m MATLAB code, equations (written in latex) are not properly rendered in appropriate (smooth) font, instead fonts looks scattered.
我确实尝试通过减小编辑器的字体大小来解决问题,但没有奏效.
I did try to fix the problem by decreasing the font-size of the editor but that didn't work.
例如:MATLAB代码为:
For example: the MATLAB code is:
%% (a) 从上图中没有发现$ ho$收敛的迹象
%% (a) From above plot there are no signs of convergence of $ ho$
%%
% $x^2+e^{pi i}$
% $x^2+e^{pi i}$
那么.pdf文件写得不好,其中方程式的字体不够平滑.
then the .pdf file is not well written, in which equation's fonts are not smooth enough.
感谢您的任何建议.
推荐答案
我遇到了同样的问题,方程式渲染质量不足.
I was having the same problem, with equation rendering quality being inadequate.
这是我在 MATLAB R2013b 中修复此问题的过程.
This is my procedure for fixing this in MATLAB R2013b.
1) 在 MATLAB 命令提示符下,输入:
1) In the MATLAB command prompt, enter:
edit publish
这应该会弹出编辑器供您编辑publish.m".请注意,该文件可能是只读的.在 Linux 下,我使用外部编辑器作为超级用户来编辑它.
This should pop up the editor for you to edit 'publish.m'. Beware, the file may be read only. Under Linux, I use an external editor as superuser to edit it.
2) 转到第 811 行.您应该会看到:
2) Go to line 811. You should see this:
temptext = text('Parent',tempaxes,'Position',[.5 .5], ...
'HorizontalAlignment','center','FontSize',22, ...
'Interpreter','latex');
将字体大小"的值更改为更大的值;我用了 30 个.
Change the value of 'Fontsize' to something larger; I used 30.
3) 转到第 747 行.您应该会看到:
3) Go to line 747. You should see this:
swapTexForImg(dom,equationNode,outputDir,fullFilename,equationText,newSize(2),newSize(1))
改成
swapTexForImg(dom,equationNode,outputDir,fullFilename,equationText,newSize(2)/scale,newSize(1)/scale)
其中 scale 是您喜欢的比例因子.可能需要玩一会儿,直到你做对了;我用了 2.
where scale is the scale factor of your liking. Might have to play with it a bit until you get it right; I used 2.
4) 保存文件.同时保留原件的备份.
4) Save the file. Also keep a backup of the original.
5) 在 MATLAB 命令提示符下,输入:
5) In the MATLAB command prompt, enter:
rehash toolboxcache
接着是:
clear functions
6) 再次运行发布.
这应该可以为 PDF 完成工作.我还没有尝试过用于 HTML,但它也应该可以工作.如果是 HTMl,不要忘记删除之前创建的图像.
This should do the job for the PDF. I haven't tried it for HTML, but it should also work. In case of HTMl, don't forget to delete the images created previously.
这篇关于如何在 .pdf 中设置字体设置,通过 MATLAB 和 LATEX 发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!