Mike on the MATLAB Desktop
April 13th, 2009
Bring along your syntax highlighted code
People often ask how they can incorporate their syntax highlighted code into other mediums, like Microsoft Word, Microsoft PowerPoint, web pages etc. There are actually a number of ways to bring along your colorful code, one of which will likely meet your needs.
Microsoft Word
You can paste text right into Word that you’ve copied in the MATLAB Editor, and it will be auto-magically highlighted. It doesn’t get much easier than that.
Microsoft PowerPoint
It’s not quite as simple to paste syntax-highlighted code into PowerPoint as it is in Word, but it’s still not too difficult.
Select Edit -> Paste Special….
In the Paste Special dialog, select Formatted Text (RTF), and press OK.
That’s it.
HTML
You can also publish your MATLAB code to HTML, which allows you view it in a web browser or insert it into anything that can render HTML. To publish to HTML, open your file in the MATLAB Editor and press the publish ( ) button (note that the default output format is HTML).
In general, I find that if I can show code in a syntax-highlighted form, it’s easier for the viewer to understand — hopefully you find these tips useful for doing just that.
14:03 UTC |
Posted in Editor, Publish |
Permalink |
4 Comments »
You can follow any responses to this entry through the RSS 2.0 feed.
You can skip to the end and leave a response. Pinging is currently not allowed.
Leave a Reply
|
Ken,
Can you do a post on the Figure Group Container? Specifically, what is it good for and any ways to change its default behavior.
Thanks
Hi Naor,
I’ll add your blog-entry request to the list of future entries.
Thanks for the request.
-Ken
Is it possible to automatically publish highlighted code to LaTeX instead of {verbatim}? Right now I’m using dbtype to publish functions defined elsewhere in different files, but it’s not that elegant.
Erik, there isn’t a way to get syntax highlighted code in LaTeX yet. It’s on our wishlist. Thanks for helping us prioritize this.