Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Solution to include scaled Stata output in LaTeX presentation (beamer)


From   "Ben Jann" <[email protected]>
To   statalist <[email protected]>
Subject   st: Solution to include scaled Stata output in LaTeX presentation (beamer)
Date   Sat, 23 Feb 2008 16:31:53 +0100

Hi, maybe the follwing is known to many of you, but I did not know and
I didn't find anything in the FAQ or the Statalist Archive. So I
thought it would be worthwhile to share this

When including Stata output in a LaTeX presentation (using -sjlog- and
-sjlatex-, type -findit sjlog-, -findit sjlatex-, and e.g. the
"beamer" class) it is often desirable to scale the output a bit so
that it fits the slide.* Setting the font does not help.

After fiddling around a little I found a solution that works quite
well: Use the "\scalebox" command from the "graphicx" package (which
is automatically loaded in beamer).

Example:

\scalebox{0.7}{\begin{minipage}{\hsize}
\begin{stlog}
\input{whatever.log.tex}
\end{stlog}
\end{minipage}}

The minipage seems to be necessary (although there may also be other
ways to make \scalebox work with stlog).

To simplify, you can definde a command in the preample of the LaTeX
document as follows:

---begin of example file---
\documentclass{beamer}

[...]

\usepackage{stata}

\def\stlogscaled#1#2{\scalebox{#1}{\begin{minipage}{\hsize}
    \begin{stlog}
    \input{#2.log.tex}
    \end{stlog}
    \end{minipage}}}

[...]

\begin{document}

[...]

\stlogscaled{0.7}{whatever}

[...]
\end{document}
---end of example file---

Works perfect for me.

ben

* The procedure to include Stata output in a LaTeX document is to save
the output using the -sjlog- command and then, in LaTeX, include the
output using the "stlog" environment. That is, in Stata type

  . sjlog using whatever, replace
  . ...
  . sjlog close, replace

and then in the preamble of the LaTeX file load the stata package

 \usepackage{stata}

and in the body of the text type

 \begin{stlog}
 \input{whatever.log.tex}
 \end{stlog}
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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