Post by Evan Where in the file do we add RequirePackage? Could you post an example mwarticle.cls that you have modified? Also, the path you use?
\RequirePackage{amsfonts,amssymb}
My amsfonts.sty and amssymb.sty files are in /usr/local/texlive/2009/texmf-dist/tex/latex/amsfonts/
setappdata(0, 'TeXPath', [getappdata(0,'TeXPath') '/usr/local/texlive/2009/texmf-dist/tex/latex/amsfonts']);
Now, when I change the MATLAB interpreter to Latex, no labels appear. I can remove the RequirePackage line and the labels appear again, but I'd like to add new packages like you appear to be able to do.
Thanks,
-Evan
Post by Anh Huy PhanPost by Pieter BaPost by Mark http://www.ams.org/publications/authors/tex/amsfonts
such as "\blacksquare" and "\lessdot".
I'm able to use function TEXT to get the usual LaTeX and math functions to display properly, but I don't know how to be able to specify tags in a package that isn't already standard.
Hi Mark,
text('Position', [1 30], 'FontSize', 20, 'Interpreter', 'LaTeX', 'String', ['$$\int_0^\infty$$']);
However, I would like to use symbols for the moon and earth to plot them next to a curve in the Figure. A package which contains these symbols is called "wasysym" after which one can use the commands "\leftmoon" and "earth".
I really hope it is possible...
Yes, you can do this.
The trick is as follows
- Declare package which consists latex font to be used in the class file "mwarticle.cls" inside the folder
$matlabroot/sys/tex/
%% matlabroot is the Root directory of your MATLAB.
For example,
\RequirePackage{amsfonts,amssymb}
- Add paths for your latex fonts to matlab path for Tex and Latex which can be retrieved: texpath = getappdata(0,'TeXPath');
- For Windows, load pfb and pfm font files using the mex function loadfonts.
HTH
Huy Phan
A simple way is to modify the function "tex.m" inside the folder
$matlabroot\toolbox\matlab\graphics\tex.m
Please backup the file before modifying it.
1 - Download AMSFONT and other fonts you want to use with Matlab. If MikTex or TexLive has been installed on your computer, all files are available. Just to find their paths.
2- Declare latex packages
Open the .m file "tex.m" , and jump to its subfunction "localDecorateInputString".
Modify parameter "standardhead" to include additional packages
function [tstr] = localDecorateInputString(str,format,width,fragment)
...
if strcmp(format(3:end),'latex')
standardhead = [' \nofiles \documentclass{mwarticle} \usepackage{amsfonts,amsbsy,amssymb}'... % include here latex packages, and your settings
'\begin{document}'];
standardtail = ' \end{document}';
else
standardhead = ' \relax \nopagenumbers \noindent';
standardtail = ' \bye';
end
....
3- Add paths for AMSFONTs
Find subfunction "localGetTeXPath" inside "tex.m"
function [texpath,err] = localGetTeXPath
...
And add paths for latex packages to "texpath"
For example,
texpath{1} = fullfile(mlroot,'sys','tex',filesep);
texpath{end+1} = fullfile(mlroot,'sys','tex','latex','base',filesep);
texpath{end+1} = fullfile(mlroot,'sys','tex','tfm',filesep);
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\tex\plain\amsfonts\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\map\dvips\amsfonts';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\afm\public\amsfonts\cm\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\afm\public\amsfonts\cmextra\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\afm\public\amsfonts\cyrillic\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\afm\public\amsfonts\euler\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\afm\public\amsfonts\latxfont\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\afm\public\amsfonts\symbols\';
%
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\type1\public\amsfonts\cm\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\type1\public\amsfonts\cmextra\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\type1\public\amsfonts\cyrillic\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\type1\public\amsfonts\euler\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\type1\public\amsfonts\latxfont\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\type1\public\amsfonts\symbols\';
%
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\tfm\public\amsfonts\cmextra\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\tfm\public\amsfonts\cyrillic\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\tfm\public\amsfonts\euler\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\tfm\public\amsfonts\dummy\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\tfm\public\amsfonts\symbols\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\source\public\amsfonts\cmextra\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\source\public\amsfonts\cyrillic\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\source\public\amsfonts\dummy\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\source\public\amsfonts\symbols\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\tfm\public\cm\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\fonts\tfm\public\latex-fonts\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\tex\latex\graphics\';
texpath{end+1} = 'C:\Program Files\MiKTeX 2.9\tex\latex\ams\math\';
4 - Copy .STY files
amsfonts.sty
amssymb.sty
cmmib57.sty
eucal.sty
eufrak.sty
euscript.sty
and put other setting files to Folder
$matlabroot/sys/tex/
5 - Run Matlab and execute the symbol codes
figure(1); clf
mytxt = '${\boldsymbol \Lambda}, {\mathcal F}, {\otimes}, {\oslash}, {\blacksquare}, {\lessdot}$';
h = text('string',mytxt,'interpreter','latex','pos',[0.2 0.5])
HTH
Huy Phan