Creating LaTeX and HTML documents from within Stata using textdoc and webdoc
Ben Jann
University of Bern, ben.jann@soz.unibe.ch
Swiss Stata Users Group meeting Bern, November 17, 2016
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 1
Creating LaTeX and HTML documents from within Stata using textdoc - - PowerPoint PPT Presentation
Creating LaTeX and HTML documents from within Stata using textdoc and webdoc Ben Jann University of Bern, ben.jann@soz.unibe.ch Swiss Stata Users Group meeting Bern, November 17, 2016 Ben Jann (University of Bern) texdoc/webdoc Bern,
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 1
◮ Usage of texdoc ◮ Examples ◮ Additional info on webdoc
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 2
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 3
◮ Yearly reports with a given structure but changing results ◮ Research articles containing tables and graphs ◮ Documentations of datasets or data analyses ◮ Stata Journal articles illustrating the use of Stata commands ◮ Stata Press books or other textbooks ◮ Solutions to Stata exercises ◮ Presentations and class notes ◮ Websites . . . ⋆ . . . reporting results computed by Stata ⋆ . . . documenting datasets or data analyses ⋆ . . . documenting the use of Stata commands Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 4
◮ Do manual work only once.
◮ As scientists, we want complete documentation of data production
◮ Automation makes errors less likely (and makes the detection of
◮ As a side effect, automation leads to standardization, which is
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 5
◮ texdoc is for L
A
◮ webdoc is for HTML (or Markdown)
◮ the Stata code of your data analysis and ◮ the text for your report/article/book/website etc.
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 6
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 7
A
A
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 8
◮
A
◮
◮ texdoc init can be applied repeatedly within a do-file (omitting
◮ If texdoc init is omitted, texdoc do will automatically initialize the
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 9
A
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 10
◮ All output form the commands between texdoc stlog and
A
◮ You may provide a stable name for the output section or have
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 11
◮
◮
◮
◮ etc.
◮ For example, specify option nodo with texdoc init to turn all
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 12
A
A
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 13
A
◮ texdoc graph takes account of the settings of texdoc stlog. For
A
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 14
◮
◮
◮
A
◮
◮
◮
◮ etc. Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 15
◮
◮
A
◮
A
◮
◮
◮
◮
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 16
◮
⋆ will be restored from disk if necessary (i.e. if the nodo has been
⋆ will be expanded within subsequent /*** ***/ blocks
◮
◮
A
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 17
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 18
◮ webdoc init provides a header option. ⋆ Basic CSS settings. ⋆ Support for Bootstrap (including Bootswatch themes). ⋆ Color schemes for Stata output. ◮
◮ webdoc stlog has an sthlp option to translate help files including
◮ webdoc stlog has a dosave option to create a do-file from an
◮ webdoc graph can embed graphs in the output documents (using
◮
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 19
◮ Basic CSS header ◮ Stata color schemes ◮ Bootstrap/Bootswatch ◮ Math
◮ The hardcode option ◮ SVG format ◮ Cross-referencing
◮ Contents of output sections ◮ Highlighting selected output ◮ Setting the screen width ◮ Displaying Stata code ◮ Saving Stata code ◮ Displaying help files
◮ Using esttab (or similar) ◮ Improved esttab tables ◮ Creating custom tables
◮ Basic usage ◮ Adding section numbers ◮ Formatting the TOC
◮ Basic procedure ◮ Table of contents Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 20
◮ texdoc and webdoc commands should always start on a new line, with
◮ texdoc and webdoc only provide limited support for the semicolon
◮ texdoc and webdoc do not parse the contents of a do-file that is
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 21
◮ http://ideas.repec.org/p/bss/wpaper/14.html (texdoc) ◮ http://ideas.repec.org/p/bss/wpaper/22.html (webdoc)
◮ Jann, Ben (2016). Creating LaTeX documents from within Stata
◮ Paper on webdoc under review.
◮ http://repec.sowi.unibe.ch/stata/texdoc ◮ http://repec.sowi.unibe.ch/stata/webdoc Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 22
◮ texdoc:
⋆ To compile a L A
A
A
A
A
◮ webdoc:
Ben Jann (University of Bern) texdoc/webdoc Bern, 17.11.2016 23