
\documentclass{article}
\usepackage{graphicx}
\usepackage{stata}
\begin{document}

\section{Example of a \texttt{texdoc} document}

\subsection{Standard Features}

\subsubsection{Some simple Stata input and output}

Here is a regression example using the obligatory \texttt{auto} dataset,
using good physics
\begin{stlog}\input{example_texdoc_1.log.tex}\end{stlog}
\subsubsection{Including a result in the body of a sentence.}

This is useful for including results in sentences in a paper.

Sadly, \texttt{texdoc} cannot include inline results. 

\subsubsection{Including a graph}

Here is an example scatterplot command:
\begin{stlog}\input{example_texdoc_2.log.tex}\end{stlog}
Here is the graph, complate with \LaTeX\ caption and label for cross-referencing.
\begin{center}
    \includegraphics{example_texdoc_2}
\end{center}
This works fine. Scaling also works pretty well.

\subsubsection{Hiding commands and showing only results}

It can be useful to hide commands and show just their output. Here, for example, 
is the output from a summarize command:
\begin{stlog}\input{example_texdoc_3.log.tex}\end{stlog}
Note that stripping commands is for an entire block of commands, so that
if only some commands should be stripped, there must be multiple blocks
of commands.

\subsubsection{Splitting input and output.}

\texttt{texdoc} cannot directly split input and output from Stata commands.
This is typical for programs producing documents from standard Stata
log files, because Stata itself mixes input and output in its log
files.

It is possible to split output by running commands multiple
time and sometimes showing the command, sometimes showing the output.  

\subsection{Some other features to check}

\subsubsection{Showing Mata code and output}

Here is some Mata code from the Mata manual, split into pieces.
\begin{stlog}\input{example_texdoc_4.log.tex}\end{stlog}
It is useful to see the output from checking that Xi is really the inverse of X.
\begin{stlog}\input{example_texdoc_5.log.tex}\end{stlog}
Because of the all-or-nothing inclusion of commands in each of the code blocks, it is necessary to end each mata block before continuing.
\end{document}
