source: MML/trunk/machine/SOLEIL/common/toolbox/ezyfit/ezyfit/private/greekize.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 10 years ago

Initial import--MML version from SOLEIL@2013

File size: 1.2 KB
Line 
1function str=greekize(inputstr)
2%GREEKIZE   Greekize a string
3%
4%   F. Moisy
5%   Revision: 1.01,  Date: 2006/02/17
6%
7%   See also SHOWEQBOX.
8
9
10% History:
11% 2006/02/08: v1.00, first version (was a subfunction of showeqbox)
12% 2006/02/17: v1.01, independent m-file.
13
14
15greek={'alpha','beta','gamma','delta','epsilon','zeta','eta',...
16    'theta','vartheta','iota','kappa','lambda','mu','nu','xi','pi','varpi',...
17    'rho','sigma','varsigma','tau','upsilon','phi','chi','psi','omega',...
18    'Gamma','Delta','Theta','Lambda','Xi','Pi','Sigma','Upsilon','Phi',...
19    'Psi','Omega'};
20
21str=strrep(inputstr,' ','');
22[posword,word] = findword(str,'+-*/^()=_'); % ('_' added, to interpret subscripted greek letters)
23for n=1:length(greek),
24    if ~isempty(strmatch(greek{n},word)),
25        % greekize only if the greek letter is a parameter
26        % (ie, do NOT greekize 'peta' in 'p\eta')
27        str=strrep(str,greek{n},['\' greek{n}]);
28    end;
29end;
30
31% various latex replacements:
32str=strrep(str,'*',' '); % use '\cdot' or '\times' or ' ' here
33str=strrep(str,'/',' / ');
34str=strrep(str,'+-','-');
35str=strrep(str,'+',' + ');
36str=strrep(str,'-',' - ');
37str=strrep(str,'^','\^');
38str=strrep(str,'=',' = ');
39str=strrep(str,'  ',' ');
Note: See TracBrowser for help on using the repository browser.