Lablogger

Lablogger is a Stata plug-in that makes it possible to create LaTeX files straight from Stata and allows you to quickly include Stata output, figures generated in Stata and regression tables created by packages like outreg2 or estout. It removes the need for copying and pasting LaTeX code from Stata and is ideal if you quickly want to generate a LaTeX document with preliminary results, to share with a co-author or supervisor for example. It is also handy to create a lab journal where you keep track of all the regressions you have done.

Lablogger is designed in such a way that it can be easily integrated in your Stata code, for example in a DO-file. At the end a .tex file is created, and the command can cooperate with for example texify to automatically generate a PDF document.

Example

Here’s an example of a Do file containing Lablogger code. You can see that the Lablogger commands work as stand-alone command or as prefix for other Stata commands. To see the result, the compiled PDF file can be found here.

clear

* Load a sample dataset from Stata's memory
sysuse auto

lablogger new using "demo.tex", title("Lablogger demo") author("Elwyn Davies")
lablogger section "Description of dataset"
lablogger text "Lablogger allows for the direct inclusion of Stata output:"

* Include direct Stata output:
lablogger: describe

* Include graphics:
lablogger section "Graphics"
lablogger graph export, caption("Scatter plot"): graph twoway scatter price length

* Include regression tables, generated by estout
lablogger section "Regression tables"
eststo drop *
eststo: reg price mpg
eststo: reg price mpg length weight
eststo: reg price mpg length weight foreign
lablogger table: esttab * using "tab.tex", label booktabs replace

lablogger text "You can add explaining text as well."
* Finally create the .tex file, then convert to PDF using Texify:
lablogger close, texify view

Tutorial

Please find a quick tutorial on how to use Lablogger here.

Installation (alpha version)

Lablogger is still under development at the moment. You can install the alpha version through the Stata net command:

net from http://www.elwyndavies.nl/

And then follow the instructions.

Or in one line:

net install lablogger, from(http://www.elwyndavies.nl/)

No help files are available at this point, but you can have a look at this tutorial for help.

To do list

I have got several ideas of new features to be implemented in the feature. Please share your ideas with me if you think anything would be particularly handy.

  • Directly create beamer slides from Stata – quickly present your results;
  • Automatic file names for tables;
  • Easily put multiple graphs next to each other (graphics grid);

License

The Stata package is available under the open source LGPL license.

Leave a Reply

Your email address will not be published. Required fields are marked *