Friday, December 30, 2011

Graphical interfaces (apps) for launching ipe7 and batch converting drawings from ipe6 to ipe7

As promised below, I propose here some small graphical interfaces created with Platypus for:
  • Launching ipe. ipe7.app can be launched to open pdf/eps/ipe files created with ipe7. It contains the necessary environment variables (pointing to the standard TeX pdflatex path under TexLive - /usr/texbin/pdflatex) to allow the compilation of Latex text snippets. You can also associate .ipe files with this app and directly open them from finder. You can also right-click on an ipe7 pdf/eps file and « open with » this app.
  • Batch converting ipe6 files. ipe6to7-BatchConvert.app will open a small dropping windows on which you can … drop pdf/eps files created by ipe6. For each dropped file, it will save in the same folder as the dropped files two files with the same name as the dropped file (lets assume, filename.pdf), but different extensions: filename.xml is the extracted file;,you do not really need it and delete it if you desire; filename.ipe is the one you want. You can open it in ipe (using ipe7.app, for example ;-) ).
  • Converting and opening a single ipe6 file. ipe6to7-ConvertOpen.app will also open a dropping window where you will be able to drop a single ipe6 file (pdf or eps). The app will create the corresponding .xml and .ipe files in the same folder as the original file, and directly open the .ipe file in ipe7 for editing.
You can download these small apps from my web site. You will get a small zip archive that you can uncompress in any folder and copy in your Applications folder (but you do not need to, you can launch them from anywhere). I have tried to design them relatively generic, but ave not tried on another Mac. I have at least one small operation that is specific to my configuration, but it should not be blocking for you. Let me know if you meet any problems with these tools.

Note: These tools assume that you have installed on your Mac OSX:
  • ipe7 and ipe-tools using MacPorts (please see below my post on this installation process);
  • TexLive (a recent version, I use 2011).

Using Penn World Tables with R-Project, the easy way

Penn World Tables (PWT) is a very nice data collection on economic growth. It covers a large set of countries (from their web site):

« The Penn World Table provides purchasing power parity and national income accounts converted to international prices for 189 countries/territories for some or all of the years 1950-2009. The European Union or the OECD provide more detailed purchasing power and real product estimates for their countries and the World Bank makes current price estimates for most PWT countries at the GDP level. »

I use these data for creating graphics for my economic growth course. My workflow was based on importing them in csv format into R-Project. But I have very recently discovered that there is much better way of using them ;-) Just loading the pwt library in your R-project code, thanks to Achim Zeileis, Guan Yang who provide this library. You must first install it from CRAN, using the usual R command for this. Once it is installed, it is enough to run the following commands to gain access to the data contained in PWT 7:
library(pwt)
data(pwt7.0)
You can check the names of the included variables:
names(pwt7.0)
And the help of the package gives you the exact definition of these variables:
help("pwt7.0")
If you prefer, you can use a more user-friendly name for this table:
myData <- pwt7.0
And clean the row names:
row.names(total) <- NULL
And voilà!
Simple and easy, thanks to Achim and Guan :-)

Installing ipe 7 under OSX Lion

After having tried other solutions for my pdflatex graphics, I am reconsidering again ipe (see below my post about this very nice and useful program that allows you to put latex instructions in your drawings). My initial wanderings were motivated by the unavailability of a reliable ipe version under Snow Leopard. I have been able to compile a 6pre28 version (see below), but it was nor as reliable as I desired and it became completely unusable as soon as I have switched to Lion (mainly because of the Qt framework version I have used to compile it). I have also played with versions available in MacPorts and this is the solution I will propose to you for installing ipe7 under Lion.

Before starting: You will need to install XCode from the Mac AppStore and Commandline Tools for Xcode from the Apple developers website (you must register, but the registration is free and you can use your normal Apple/iTunes identity).

A/ Installing MacPorts. First of all, you must download and install MacPorts. It could look daunting at a first look, but the process is quite painless (if you already have MacPorts on your Mac, go to the step B below):
  1. You first download the dmg archive corresponding to your system (Lion for me) from the install page of Macports;
  2. Double-click on the downloaded MacPorts-2.0.3-10.7-Lion.dmg file to mount it in Finder and open it in the finder (I assume that you know how to use a dmg file);
  3. Switch in Finder to the folder corresponding to the dmg volume and double-click on c to launch the installer. You follow the instructions (they are very straightforward). MacPorts installs itself, by default, in /opt/local folder on your system hard disk.
  4. Once the installation finishes, restart your Mac to be sure that everything (PATH and all will be correctly fixed).
  5. When your system is back, open a Terminal session and type: « sudo port selfupdate » to update the repository of your macport installation with the list of the most recent packages (you will have to type your administrative password for this).
B/ Installing ipe and and ipe-tools. You are now ready to install ipe :
  1. You can check the availability of ipe, by typing « port search ipe »;

  2. You will get the list of all packages that have « ipe » as a part of their name. The two packages that interest us are: ipe @7.0.14 (graphics) (The Ipe extensible drawing editor, the main program) and ipe-tools @20110916 (graphics) (Tools for the Ipe extensible drawing editor, utility tools for converting old ipe drawings to ipe7 - see below about this point).

  3. You install them by typing in the Terminal:

    • sudo port install ipe

    • sudo port install ipe-tools

  4. The installation process will download other all necessary MacPorts packages, and it will take some time depending on the sped of your internet connection and of your Mac. If ever the process stop, you just relaunch the installation instruction. MacPorts will in general give you tips for solving the problem, if you meet any (generally it just works, you must be patient, that’s all).

  5. You will have a bunch of command in the /opt/local/bin folder now, and the ones which interest us are:

    • ipe (the main program, ipe7);

    • ipeextract (the utility for extracting ipe instruction from ipe created PDF or EPS files -> ipeextract myfile.pdf gives myfile.xml as output);

    • ipe6upgrade (the utility for upgrading ipe6 drawings to ipe7 format -> ipe6upgrade myfile.xml gives myfile.ipe as output);

    • These programs are supposed to be launched in the Terminal, but I have created solution for launching them from the Applications menu (using Platypus - see below; I will do another post on this point).

    • MacPorts will also install a MacPorts menu in your Applications menu. There will even be an « ipe » item in this menu and it will launch the program. You will be able to draw with it, but, since it does not correctly import the environment variables, you will not be able to run Latex from it. Everything works better if you launch ipe from the command line (or if you use the utilities I have developed using Platypus).

  6. Now you have a working version of ipe7 on your Mac. Have fun!