|
|
|
Without syntax highlighting |
|
With syntax highlighting |
Another one
This simple Matlab code:
for i=1:10,
[a, b] = my_function('test string', c(i:end), '%d'); % a comment
end
becomes:
0001 for i=1:10,
0002 [a, b] = my_function('test string', c(i:end), '%d'); % a comment
0003 end
The HTML code is:
<pre>
0001 <span class="keyword">for</span> i=1:10,
0002 [a, b] = my_function(<span class="string">'test string'</span>, c(i:end), <span class="string">'%d'</span>); <span class="comment">% a comment</span>
0003 <span class="keyword">end</span>
</pre>
The LaTeX code is:
\begin{alltt}
0001 \textcolor{keyword}{for} i=1:10,
0002 [a, b] = my\_function(\textcolor{string}{'test string'}, c(i:end), \textcolor{string}{'\%d'}); \textcolor{comment}{% a comment}
0003 \textcolor{keyword}{end}
\end{alltt}
The RTF code is:
{\f0\fs16{{0001 }{\cf2 for}{ i=1:10,}
\par {0002 }{ [a, b] = my_function(}{\cf4 'test string'}{, c(i:end), }{\cf4 '%d'}{); }{\cf3 % a comment}
\par {0003 }{\cf2 end}
\par }}
And the XML code is:
<mfile>
<line nb="0001 "><keyword>for</keyword> i=1:10,</line>
<line nb="0002 "> [a, b] = my_function(<string>'test string'</string>, c(i:end), <string>'%d'</string>); <comment>% a comment</comment></line>
<line nb="0003 "><keyword>end</keyword></line>
</mfile>