Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: New -texdoc- package available from SSC


From   David Airey <david.airey@vanderbilt.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: New -texdoc- package available from SSC
Date   Mon, 23 Mar 2009 19:27:32 -0500

.

Thank you Ben!!!

-Dave

On Mar 23, 2009, at 5:49 PM, Ben Jann wrote:

Thanks to Kit Baum, a new package called -texdoc- is available from
SSC. To install the package, type

. ssc install texdoc

Stata version 9.2 and -sjlatex- from
http://www.stata-journal.com/production is required.

-texdoc- provides tools to create a LaTeX document from within Stata
in a weaving fashion. I wrote -texdoc- for teaching, but it might also
be useful for other purposes, e.g., when writing a Stata Journal
article.

The procedure is to first initialize a document using -texdoc init-,
then write the contents of the file, line by line, by repeated calls
to -tex- or include Stata output using -texdoc stlog-, and finally
finish up typing -texdoc close-. Example:

<--->
texdoc init example, replace
tex \documentclass{article}
tex \usepackage{stata}
tex \begin{document}
tex
tex The auto data:

texdoc stlog
sysuse auto
describe
texdoc stlog close

tex
tex A regression model:

texdoc stlog
regress price weight mpg foreign
texdoc stlog close

tex
tex \end{document}
texdoc close
<--->

The code above will produce a main file called example.tex and several
log files that are called by example.tex. example.tex looks as
follows:

<--->
\documentclass{article}
\usepackage{stata}
\begin{document}

The auto data:
\begin{stlog}
\input{example_1.log.tex}
\end{stlog}

A regression model:
\begin{stlog}
\input{example_2.log.tex}
\end{stlog}

\end{document}
<--->

You can now compile example.tex using your favorite LaTeX compiler to
produce the desired document.

If you use an editor that features syntax highlighting it might be a
good idea to set up a shortcut to quickly toggle between LaTeX and
Stata highlighting. Furthermore, some editors can be configured in a
way such that "tex " is automatically inserted at the beginning of a
new line when LaTeX highlighting is on.

ben
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index