-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheqfig.m
More file actions
50 lines (36 loc) · 1.25 KB
/
eqfig.m
File metadata and controls
50 lines (36 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function eqfig(equations, fontsize)
hFig = fig('latex');cla;
set(hFig, 'Color', 'white', 'Toolbar', 'none', 'Menubar', 'none');
set(gca, 'Position', [0 0 1 1]);
axis off;
if nargin < 2
fontsize = 20;
end
if ~iscell(equations)
equations = fliplr({equations});
end
n = length(equations);
for k = 1:n
equation = equations{k};
t = latex(equation);
t = strrep(t, '\,', '');
t = strrep(t, '\mathrm', '');
t = regexprep(t, '{([RLCGVI])', '$1_{');
t = strrep(t, '{}', '');
t = regexprep(t, '{(.)}','$1');
t = regexprep(t, '_([RLCGVI])_{?(\w+)}?', '_{$1$2}');
t = ['$' t '$'];
htxt = text(0.5, k/(n+2)+0.1, t, 'interpreter', 'latex', 'fontsize', fontsize);
set(htxt, 'HorizontalAlignment', 'Center', 'VerticalAlignment', 'Middle');
end
% pos = getpixelposition(htxt);
% pos = get(htxt, 'Extent');
% height = pos(4);
% width = pos(3);
%
% pos = get(hFig, 'Position');
% pos(3) = width*1.2;
% pos(4) = height*1.2;
% set(hFig, 'Position', pos);
%text(0.1, k/(n+2)+0.1, t, 'interpreter', 'latex', 'fontsize', 18, 'VerticalAlignment', 'top');
end