如何在.pdf中设置字体设置,通过MATLAB和LATEX发布 [英] How to set the font settings in .pdf, publish via MATLAB and LATEX

查看:212
本文介绍了如何在.pdf中设置字体设置,通过MATLAB和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)从上图可以看出,美元\ rho $没有收敛的迹象

%% (a) From above plot there are no signs of convergence of $\rho$

%%

%$ 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆