0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 function generateModelTechNote(modelname)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 % Header
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 txt = docHeader(modelname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % Description and Documentation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 txt = [txt writeIntroduction(modelname)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 % Versions
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 txt = [txt writeVersionTable(modelname)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 % Write each version section
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 txt = [txt writeVersionSections(modelname)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 % Footer
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 txt = [txt docFooter(modelname)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 % write file
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 fd = fopen([modelname '.tex'], 'w+');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 fprintf(fd, strrep(strrep(txt, '\', '\\'), '%', '%%'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 fclose(fd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 % compile
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 % cmd = sprintf('/usr/texbin/pdflatex %s', modelname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 % [status, result] = system(cmd)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 edit([modelname '.tex'])
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 % Models are documented in html so we need to swap out html tags and
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 % replace them by appropriate LaTeX tags. One replacement per line, please,
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 % and remember to include replacements for closing tags. This is assuming
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 % that all html tags have associated closing tags.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 function map = tagmap()
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 map = {...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 '<p>', '', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 '</p>', '', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 '<br>', '\newline', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 '<tt>', '$', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 '</tt>', '$', ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 };
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 function txt = docHeader(modelname)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 ename = strrep(modelname, '_', '\_');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 txt = sprintf('\\documentclass[11pt]{article}\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 txt = [txt sprintf('\\usepackage{ifpdf}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 txt = [txt sprintf('\\ifpdf\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 txt = [txt sprintf(' \\usepackage[pdftex]{graphicx} %% to include graphics\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 txt = [txt sprintf(' \\pdfcompresslevel=9 \n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 txt = [txt sprintf(' \\usepackage[pdftex, %% sets up hyperref to use pdftex driver\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 txt = [txt sprintf(' plainpages=false, %% allows page i and 1 to exist in the same document\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 txt = [txt sprintf(' breaklinks=true, %% link texts can be broken at the end of line\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 txt = [txt sprintf(' colorlinks=true,\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 txt = [txt sprintf(' pdftitle=%s,\n', ename)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 txt = [txt sprintf(' pdfauthor=LTPDA\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 txt = [txt sprintf(' ]{hyperref} \n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 txt = [txt sprintf(' \\usepackage{thumbpdf}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 txt = [txt sprintf('\\else \n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 txt = [txt sprintf(' \\usepackage{graphicx} %% to include graphics\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 txt = [txt sprintf(' \\usepackage{hyperref} %% to simplify the use of \\href\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 txt = [txt sprintf('\\fi \n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 txt = [txt sprintf('\\title{Technical Report of LTPDA built-in model \\texttt{%s}}\n', ename)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 txt = [txt sprintf('\\author{LTPDA (%s)}\n', getappdata(0, 'ltpda_version'))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 txt = [txt sprintf('\\begin{document}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 txt = [txt sprintf('\\maketitle\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80 function txt = docFooter(modelname)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 txt = sprintf('\\end{document} %% End of %s\n', modelname);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 function txt = writeVersionSections(modelname)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 versionTable = feval(modelname, 'versionTable');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 vers = versionTable(1:2:end);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 fcns = versionTable(2:2:end);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 Nvers = numel(vers);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 txt = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 for kk=1:Nvers
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 v = vers{kk};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 vtag = strrep(v, ' ', '');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 fcn = fcns{kk};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 txt = [txt sprintf('\\clearpage\n\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 txt = [txt sprintf('\\section{Version `%s''}\n', v)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 txt = [txt sprintf('\\label{ref:%s}\n', vtag)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 txt = [txt sprintf('\n\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 txt = [txt writeSectionForVersion(modelname, v, fcn)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 txt = [txt writeSubmodelSectionForVersion(modelname, v)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 txt = [txt sprintf('\n\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 txt = [txt sprintf('\n\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 function txt = writeSubmodelSectionForVersion(modelname, v)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 ii = feval(modelname, 'info', v);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 ciis = ii.children;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 txt = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 if numel(ciis) > 0
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 label = strrep(sprintf('tab:submodels_%s_%s', modelname, strrep(v, ' ', '')), '_', '');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 txt = [txt sprintf('\\subsection{Sub-models}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 txt = [txt sprintf('Sub-models used in this version are shown in Table \\ref{%s}.\n', label)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 txt = [txt sprintf('\\begin{table}[htdp]\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 txt = [txt sprintf('\\begin{center}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 txt = [txt sprintf('\\begin{tabular}{|c|c|p{4cm}|l|} \\hline\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 txt = [txt sprintf('Sub-model & Description \\\\ \\hline\\hline \n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 for kk=1:numel(ciis)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 cii = ciis(kk);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 name = strrep(cii.mname, '_', '\_');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 txt = [txt sprintf('%s & %s \\\\ \\hline\n', name, cii.description)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 % table footer
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138 txt = [txt sprintf('\\end{tabular}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 txt = [txt sprintf('\\end{center}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140 txt = [txt sprintf('\\caption{Sub-models}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 txt = [txt sprintf('\\label{%s}\n', label)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142 txt = [txt sprintf('\\end{table}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 function txt = writeSectionForVersion(modelname, v, fcn)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 txt = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 % Description
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 desc = fcn('description');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 desc = replaceTags(desc);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155 txt = [txt sprintf('\\subsection{Description}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 txt = [txt sprintf('%s\n', desc)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157 txt = [txt sprintf('\n\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 % Plist for version
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160 txt = [txt sprintf('\\subsection{Parameter List}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 label = strrep(sprintf('tab:plist_%s_%s', modelname, strrep(v, ' ', '')), '_', '');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162 txt = [txt sprintf('Parameters used in this version are shown in Table \\ref{%s}.\n', label)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 pl = feval(modelname, 'plist');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 txt = [txt plistTable(pl, label)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 txt = [txt sprintf('\n\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 function txt = plistTable(pl, label)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 txt = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 txt = [txt sprintf('\\begin{table}[htdp]\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 txt = [txt sprintf('\\begin{center}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176 txt = [txt sprintf('\\begin{tabular}{|c|p{4cm}|p{4cm}|p{4cm}|} \\hline\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 txt = [txt sprintf('Key & Default Value & Options & Description \\\\ \\hline\\hline \n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 for kk=1:pl.nparams
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 txt = [txt sprintf('%s & ', pl.params(kk).key)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 ptxt = display(pl.params(kk));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183 txt = [txt sprintf('%s & ', strtrim(strrep(ptxt{3}, 'val:', '')))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 if numel(pl.params(kk).getOptions) > 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 opts = pl.params(kk).getOptions;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 optlist = sprintf('\\begin{itemize} ');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 for oo=1:numel(opts)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 optlist = [optlist sprintf('\\item %s ', utils.helper.val2str(opts{oo}))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 optlist = [optlist sprintf('\\end{itemize}')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 txt = [txt sprintf('%s & ', optlist)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 txt = [txt sprintf('\\textit{none} & ')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 desc = char(strrep(pl.params(kk).desc, '\n', '\\newline\\newline'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 if isempty(desc)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 desc = '\textit{no description}';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 txt = [txt sprintf('%s ', desc)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 txt = [txt sprintf(' \\\\ \\hline \n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 % table footer
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 txt = [txt sprintf('\\end{tabular}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207 txt = [txt sprintf('\\end{center}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 txt = [txt sprintf('\\caption{Parameter list}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209 txt = [txt sprintf('\\label{%s}\n', label)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 txt = [txt sprintf('\\end{table}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215 function txt = writeVersionTable(modelname)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 ename = strrep(modelname, '_', '\_');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219 % table header
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 txt = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 txt = [txt sprintf('\\subsection{Versions}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 txt = [txt sprintf('\\begin{table}[htdp]\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 txt = [txt sprintf('\\begin{center}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 txt = [txt sprintf('\\begin{tabular}{|c|c|} \\hline\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 versionTable = feval(modelname, 'versionTable');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 vers = versionTable(1:2:end);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 fcns = versionTable(2:2:end);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 Nvers = numel(vers);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 txt = [txt sprintf('Version & Description \\\\ \\hline\\hline \n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 for kk=1:Nvers
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233 v = vers{kk};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 vtag = strrep(v, ' ', '');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235 fcn = fcns{kk};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 txt = [txt sprintf('\\hyperref[ref:%s]{%s} & %s \\\\ \\hline \n', vtag, v, fcn('description'))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241 % table footer
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 txt = [txt sprintf('\\end{tabular}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 txt = [txt sprintf('\\end{center}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 txt = [txt sprintf('\\caption{Versions for model %s}\n', ename)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245 txt = [txt sprintf('\\label{versions:\texttt{%s}}\n', modelname)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 txt = [txt sprintf('\\end{table}\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 function txt = writeIntroduction(modelname)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 % section
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 txt = sprintf('\\section{Overview}\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255 % description
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 desc = feval(modelname, 'description');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257 desc = replaceTags(desc);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 txt = [txt sprintf('\\subsection{Description}\n\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 txt = [txt sprintf('%s\n\n\n', desc)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261 % Documentation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 doc = feval(modelname, 'doc');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 doc = replaceTags(doc);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 txt = [txt sprintf('\\subsection{Details}\n\n')];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265 txt = [txt sprintf('%s\n\n\n', doc)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270 function txt = replaceTags(txt)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 tm = tagmap();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273 tags = tm(1:2:end);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274 reps = tm(2:2:end);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276 for kk=1:numel(tags)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 txt = strrep(txt, tags{kk}, reps{kk});
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286
|