Loren on the Art of MATLAB

Turn ideas into MATLAB

Note

Loren on the Art of MATLAB has been archived and will not be updated.

Publishing

I thought I'd showcase the publish tool in MATLAB this time around. It's how both Steve Eddins and I produce our blog articles most of the time. I find it particularly handy when I use equations.

Contents

Titles

For the first title to appear as the document title, be sure to have no code in the first section, a practice I generally follow. Doing this means that all other titled cells will be named sections in the article's Contents.

Marking Up Cells

Marking up cells was a bit tricky for me at first as I got used to the formatting options. White space is very important for getting published document to look just right. I have repeatedly made the mistake of not surrounding lines containing bulleted lists with blank comment lines. These blank lines are important for preformatted text, bulleted lists, and equations.

Each new titled cell creates a section. For a new paragraph without a new section, omit the cell title as I have done here.

Markup Tips

  • Bulleted item - on separate lines, each entry starts with % *
  • Bold text - begins and ends with *
  • Italic text - begins and ends with _
  • Monospace text - begins and ends with |

The MATLAB documentation contains a great table for marking up text.

Equations

Math is so important to the content of work done in MATLAB that it's worth learning how to format equations using TeX. To embed an equation into a published document, sandwich the TeX express between $$. Here's one of my favorite identities:

because it contains the most interesting numbers I know, apart from 17.

Getting the Code

By default when publishing to html, the M-file code that generates the document is included and available, via grabcode. You won't be able to get it from this post, alas, because one of the steps in getting this to the web inserts char([13 10]) for newlines instead of just char(10).

Links

You can put in links directly.

Do You publish Results or Documents?

Do you publish reports, results, documents? Who is your intended audience? What has been working well for you? And what else would you like to see? Let us know!


Published with MATLAB® 7.2


  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.