smclpres

Author: Maarten L. Buis

smclpres Lets you create a .smcl presentation from a .do file. A .smcl presentation is a series of linked .smcl files that open in the viewer inside Stata (like help-files). They are interactive. Click on links to execute .do files or move from one slide to the next. They are particularly useful for talks that focus on how to do things in Stata, like a lecture on graphs in Stata or a talk at a Stata Users' Group meeting. Preparing for such a talk typically starts with preparing the examples using a .do file. The purpose of smclpres is to streamline the process of turning that .do file into a .smcl presentation.

This package can be installed by typing in Stata: ssc install smclpres

Example

When starting to create a .smcl presentation, I would typically start with writing a .do file containing the examples with which I want to illustrate my points, and add comments. smclpres builds on that by adding "special" comments that will tell it where new slides begin, add titles, text and examples to these slides, etc. Below is a minimalist example:

// This .do-file is intended to be compiled into a smcl presentation using:
// smclpres using minimalist.do
// ============================================================================

//toctitle A minimalist example presentation

/*toctxt

{center:Maarten Buis}
{center:maarten.buis@uni.kn}
toctxt*/

//section First section
//subsection First subsection

//slide -----------------------------------------------------------------------
//title First slide

/*txt
{pstd}Some interesting text about {help regress}{p_end}
txt*/

//ex
sysuse auto, clear
sum price
//endex
//endslide --------------------------------------------------------------------

//subsection Second subsection
//slide -----------------------------------------------------------------------
//title Second slide

/*txt
{phang}Kwaak, kwaak, kikker kwaak. Als ik grote sprongen maak. Doe ik
net zo gek als jij, en ik kwaak er ook nog bij.{p_end}
{phang}Kwaak, kwaak, kwaak maar door. Kom maar in het kikker koor.
Kwaak van dit en kwaak van dat. Kikkers kwaken altijd wat.{p_end}
txt*/
//endslide --------------------------------------------------------------------

//section Second section
//slide -----------------------------------------------------------------------
//title Third slide

/*txt
{phang}
Ia zegt het ezeltje, klim maar op mijn rug. Ik draag jou de hele weg, heen
end weer terug.

{phang}
Ia zegt het ezeltje. Ik loop van hier naar daar, en als je met me mee
wil hoor ik graag, ia ia.
txt*/

//ex
reg price i.rep78
//endex
//endslide --------------------------------------------------------------------

[do-file]

By default the table of content will be the first slide (unless you specified a titlepage with the //titlepage and //endtitlepage comments). You can add a title to the table of content with the //toctitle comment, and add text (in this case the author and contact details) to the table of content with the /*toctxt and toctext*/ comments. You can divide your presentation in sections and subsections using the //section and //subsection comments.

You add a new slide using the //slide and //endslide comments. You add a title to the slide using //title comment, and text using the /*txt and txt*/ comments. You can add smcl tags to the text to improve the way the text looks. Examples can be added using the //ex and //endex comments. These will be copied in bold font on the slide and a link will be added below it that will run that example. That way you can first discuss the code and than show the output.

Once you have written the .do file you can turn it into a .smcl presentation by typing in Stata: smclpres using minimalist.do, replace. This will create multiple .smcl files (one per slide) and .do files (one per example). Here is a .zip file containing all files for the .smcl presentation created from the .do file above. The first slide will have the same name as the .do file except with the .smcl extension. So to start the presentation you type view minimalist.smcl.

This smcl presentation can be turned into a handout in .html format, so the audience can see the materials even they don't have access to Stata. This is done with the pres2html program that is part of the smclpres package. The above presentation can be turned into a handout by typing in Stata: pres2html using minimalist.smcl, replace. The resulting handout is here.

Other examples: