Cite: Haghish, E. F. (2016). Rethinking literate programming in statistics. The Stata Journal, 16(4), 938-963.
A general purpose package for creating dynamic report in HTML, LaTeX, and PDF. Weaver includes a built-in JavaScript syntax highlighter for Stata code, an engine for rendering ASCII and LaTeX mathematical notations, a number of specialized commands for creating publication-ready dynamic table, inserting and resizing a figure, and writing dynamic text. Moreover, Weaver also includes a built-in JavaScript-based language called Weaver markup Language which allows the users to create a sophisticated HTML document using a simplified and minimalistic markup language, similar but not identical to Markdown.
Weaver is essentially an independent HTML or LaTeX log system that runs in paralel to Stata log and can be used simultaniously with regular smcl or text logfile. In contrast to smcl log file, the main idea of the Weaver package is to provide the possibility of deciding which commands, results, and figures should appear in the Weaver log (dynamic report). Therefore, Weaver log is not autonomous. The big advantage of this approach to dynamic reporting is that as the user carries out the data analysis interactively, the dynamic document can be viewed in real-time by refreshing the HTML web-browser, or opening the LaTeX document in TeXstudio or any advanced text editor such as Sublime Text, or alternatively, reandering a PDF document at any point. These features work smoothly for both LaTeX and HTML. Another example would be a LaTeX table exported from tabout command which can be merged in Weaver's LaTeX log.
Weaver is a general purpose package that is designed to effectively handle HTML and LaTeX documents. It includes many additional features that makes it a prime package for collaborating with all other packages for developing automated outputs such as MarkDoc, tabout, etc. Any package that produces LaTeX or HTML output, cal collaborate with Weaver because Weaver allows importing HTML and LaTeX documents. For example, a document written in Markdown language and exported to LaTeX or HTML using the MarkDoc package, can be simple merged into Weaver's LaTeX or HTML log respectively.
Visit for a complete tutorial on Weaver as well as downloading template do-files.
The github package
can be used to install weaver
and all of its dependencies as shown below. Using github
package is highly recommended.
github install haghish/weaver
Finally, in order to export dynamic PDF documents, Weaver requires two additional third-party software which are wkhtmltopdf for exporting HTML log to PDF, and a complete distribution of LaTeX for Typesetting LaTeX documents. The complete guide for installing them is provided in the MarkDoc help file and also, Weaver Homepage
If you are interested to understand the structure of the package, download the HTML file entitled Files_Nest.html
.
This file is generated by CodeMap
application, which analyzes the structure of Stata packages
and provides a hint about the files dependencies in the project. In other words, you can follow the suggested structure to read and comprehend the package.
E. F. Haghish
Center for Medical Biometry and Medical Informatics
University of Freiburg, Germany
[email protected]
http://www.haghish.com/weaver
@Haghish