compiling egameps.sty in TeXnic Center

8 April 2010

Running Adobe Reader X? Use these instructions.

If you've spent any time typing extensive-form games in LaTeX, you've run into egameps.sty, by the formidable Martin Osborne (of A Course in Game Theory fame). It's an excellent package which will do just about anything you need — although I do wish I could make indifference sets with an arc, rather than horizontal or vertical lines (actually, it turns out this is possible, if convoluted) — and will allow you to extend it to produce everything else.

All is good and well, then, except for the fact that it (natively) compiles only to PostScript; for those of us stuck on Windows boxes, this is a painful reality. Not to knock Ghostview, but PostScript rendering on Windows is tedious at best, and frustrating and time-prohibitive at worst. Compared to the sleek, fast interface of Acrobat Reader (who can compete with a company with the funding of Adobe?), there's really no argument in my book; perhaps if I were working on a bigger project, PostScript would have its advantages, but as someone typing up a couple dozen pages of problem set per week, there's no cause.

How can we make the whole process easier, if perhaps violating the principle which drives PostScript compilation in the first place? For the purposes of this how-to, I'll be using TeXnicCenter, my favorite go-to editor in Windows. The way I use it, it's not much more than a GUI wrapper for VI, but it's comfortable and has some useful macros. If you're interested in doing this more generally (say, a system binding to run as :!latexpdf in VI or whatnot), the general principles should extend to any batch/Perl/Python script you can cook up.

The general principle at work here is that TeXnicCenter allows you to define Output Profiles, which correspond to different compilation mechanisms for your . Included with the program are default output profiles for compilation to DVI, PS, or PDF. We're going to chain these mechanisms together to get what we're looking for.

For the purposes of this set of instructions, we'll assume my MiKTeX install directory is C:\Program Files\MiKTeX 2.7.

At this point, the document should successfully compile: just select LaTeX => DVI => PS => PDF (or whatever you chose) from the dropdown in the top bar, and compile (Ctrl + F7). Compilation will take a hair longer than normal, as the background postprocessors run. You can watch the compilation icons in the top bar to see the status, as there's some nonverbose lag in the conversion from DVI to PS and then to PDF.

However, there is still a little more we can do. One of the nicest features of TeXnicCenter is the ability to view your document at any time, simply by pressing F5. I am going to assume you are using Adobe Reader, and that it is installed as C:\PROGRAM FILES\ADOBE\READER 8.0\READER\ACRORD32.EXE. To enable this, reopen the Output Profiles dialog (if you closed it), and select your new output profile.

Putting these together is not particularly difficult: with a little time to browse the existing output profiles which ship with TeXnicCenter, and some knowledge of the conversion and compilation utilities that come with MiKTeX, you can piece it together for yourself. Still, these are the kinds of things I'm always looking for when it's late at night an my game tree just won't compile the way I need it to.

\documentclass[12pt]{article}
\usepackage{pstricks}
\usepackage{egameps}

\begin{document}
  \begin{center}
    \begin{figure}[htb]
      \hspace*{\fill}

      %
      % Notice the careful use of {}, (), and [] below
      %
      \begin{egame}(1000,1000)
        \putbranch(500,900)(2,1){300}
        \iib{N}{Hungry}{Thirsty}

        \putbranch(200,750)(1,2){150}
        \iib{K}{Eat}{Drink}[$10$][$9$]

        \putbranch(800,750)(1,2){150}
        \iib{K}{Eat}{Drink}[$9$][$10$]

        \infoset(200,750){600}{}
      \end{egame}
    \end{figure}
  \end{center}
\end{document}

This model is not realistic, as Nature cannot choose both

Happy LaTeXing!

PS You can do something similar with dvipng.exe in the MiKTeX distribution, but why bother when you've got LaTeX to png at 618034.com?

Update (2011-01-31): thanks to Rob in the comments for pointing out that the DDE instructions above no longer work in Adobe Reader X. There is a helpful set of instructions over at Agmon's blog, although the server seems to have issues from time to time (Google's cache of the page is ugly but contains all of the important stuff). Once I've upgraded to X, I'll update the instructions here, but as I see it it's useful to have instructions for multiple versions of Reader.

Included \(\LaTeX\) graphics are generated at LaTeX to png or by MathJax.

contemporary entries

comments

That works very well, thank you so much for posting!
R. (3 June 2010, 8:14am)
I am fairly new to TeX and have been using MikTeX. As far as I can tell I am following the above directions correctly. The document does correctly (I think) compile between Step 6 and Step 1 (generating files: .aux, .txt, .dvi, .pdf, .ps) and the PDF looks as it should.

However, when I go to view the document (F5) TeXnicCenter gives me the error "Cannot execute command". After following the second steps 1-5 the document compiles as before. Now when I try to view the document (F5), Adobe Reader opens (but does not open the PDF) and TeXnicCenter gives me the error "[DocOpen("%bm.pdf")][FileOpen("%bm.pdf")]" and then "Cannot execute command" on a separate line.

Note: I installed TeXnicCenter for the purpose of this article and I suspect this may be part of the problem. Any assistance greatly appreciated.
Rob White (20 January 2011, 7:43pm)
I found the solution to the problem. Adobe broke your instructions with the newest version of acrobat. A simple fix is found here.

http://www.agmonim.com/2010/12/texniccenter-and-adobe-reader-10-x

Cheers

I love that you need to know a tiny bit of calculus to post.
Rob White (20 January 2011, 8:19pm)
Hi Rob,

I'm not on Acrobat 10 yet (and the way software goes, I think I'll try to stay behind the times for a bit), but I appreciate the link to the new fix. It's down right now, but once it's back up I'll check it out and see how best to patch the instructions here.

Kyle
Kyle (30 January 2011, 7:32pm)