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

Re: st: Any way to annotate a Stata graph with LaTeX?

From   David Airey <[email protected]>
To   [email protected]
Subject   Re: st: Any way to annotate a Stata graph with LaTeX?
Date   Mon, 25 Aug 2008 16:25:21 -0500


I would be very interested in a detailed FAQ on your system for doing this on a Mac. Maybe it could grow into a graphics hacks file for others OSs like the text editor files has grown. I use a Mac.


On Aug 25, 2008, at 1:58 PM, Daniel Becker wrote:

Am 25.08.2008 um 10:52 schrieb Richard Sperling:
Has anyone developed a way or method to incorporate LaTeX formatted
text into a Stata graph? It would be great if the Stata graph editor
had the capability to generate LaTeX formatted annotations. For Mac
users, I have in mind something along the lines of the program LaTeXiT
that allows one to add snippets of LaTeX text to Powerpoint or Keynote

My way is: Exporting the Stata graph as an eps, then using a .tex file like the one posted below. This file is then typeset by the following sequence of commands aslo posted below (in TeXShop, a Mac- Frontend for LaTeX, I do this via an "engine file" epsoverlay)

If anyone is interested, I could provide more details how to prepare your system to do all this. It assumes that the command epspdf exists, for instance. Of course this is not very convenient, at first sight, but works for me. It is even possible to use pstricks ...


++++++++++++++++++++++ start sequence of commands


set path= ($path /usr/texbin /usr/local/bin)
set filename = "$1"
set dviname = "${filename:r}.dvi"
set psname = "${filename:r}.ps"
set pdfname = "${filename:r}.pdf"
set pdfnamebb = "${filename:r}-bb.pdf"
set epsnamebb = "${filename:r}.eps"
set auxname = "${filename:r}.aux"
set logname = "${filename:r}.log"

# run latex via ghostscript on the tex-file
latex --shell-escape "$1"
dvips -Ppdf -o "$psname" "$dviname"
ps2pdf13 -dAutoRotatePages=/None "$psname" "$pdfname"

# calculate bounding box
epspdf -bb "$pdfname" "$epsnamebb"
epspdf -bb "$pdfname" "$pdfnamebb"

# clean up

/bin/rm "$pdfname"
/bin/rm "$dviname"
/bin/rm "$auxname"
/bin/rm "$psname"
/bin/rm "$logname"

#rename pictures
mv "$pdfnamebb" "$pdfname"

+++++++++++++ start LaTeX file

%!TEX TS-program = epsoverlay


%%%% HERE: Load the eps-file
%%%% HERE: add LaTeX/pstricks
% grid to see coordinates, comment out when done
% Add labels etc here:
\rput{0}(5.9,3.9){$b = 1$}
\rput{0}(3.4,2.2){$b = 5 $ nicht verwendet}
\rput{0}(2.9,1.2){$b = 10 $}


* For searches and help try:
*   For searches and help try:

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