Monday, October 12, 2009

Multiple graphics windows in R

I have been thinking for the longest time that R could only handle one graphics windows, I should have looked a little deeper. It turns out that it is very easy to do.

To create a new window, simply type: windows() or X11(). This will open a new graphics device and give it the next available number.
To make window k the active window, the command is windows(k).
To close window k, is the way to go.

For more commands and information, see help(dev.cur) in Rgui.


If you would find useful to have the ability to create web pages on the fly, using your web browser as editor, but with WYSIWYG capabilities, you've got to try TiddlyWiki ( From the creators:

"TiddlyWiki is a single html file which has all the characteristics of a wiki - including all of the content, the functionality (including editing, saving, tagging and searching) and the style sheet. Because it's a single file, it's very portable - you can email it, put it on a web server or share it via a USB stick."

This is open source, free, fast, portable across platforms, and easy to use. I found a very nice place for hosting my personal wiki, If you are fond of html, this does not get better.

Friday, October 9, 2009

Puthesis for AGEC thesis

The puthesis template does 99% of your thesis formatting. The 1% left, however, is a pain in the neck. For example, using puthesis out of the shelve gave me the following problems (Ask Lou Ann for the format requirements, do it early):

1. The margins were not as required
2. The spaces between headings and subheadings were not as specified.
3. The little dots of the table of contents did not touch the number pages.
4. The table captions did not met the requirements.
5. The headings and subheadings had a format different than what is needed.
6. The original template I got did not indent the first line after Chapter headings.

To fix 1-3 and 5 I modified the puthesis.cls file and renamed it as
puthesis_mod.cls. (Download puthesis_mod.cls ) You can search over comments starting with NV to see what I did. I counted 16 modifications; sadly, I do not remember why I did half of them. Moreover, the brackets specifying the options for agecon include several tweaks. My fix to the table of contents leaders only works for two subdivisions, if you have more, have fun trying to add extra divisions in a similar way to the ones that I added. To fix 4, and other little things I do not remember, puthesis.cls has built-in options. So, in addition to using puthesis_mod.cls, I used this as the first line of the preamble:


Notice that puthesis_mod.cls is genetically engineered to include the bibliographical AAEA style, which was mentioned in an earlier post.

I also noticed that other people working with puthesis had not the same problems I had, and I ignore why that is the case.

Two more things:

1. Margins work --- but you have to be sure that Page Scaling is set to none when you use Adobe Acrobat Reader to print.
2. Figures and tables that are aligned at the top of the page tend to break the 1 inch top margin. My solution was to use \begin{}[hb]. Itworked (h for here, b for bottom). As a very last resource, for tables that occupy an entire (or more) page, a \vspace{-.1in} statement did the trick. Put it after the \begin{} and before the \caption.

Tuesday, October 6, 2009

Merging PDFs (and other useful tasks)

If you need to merge two pdfs, as for example, when attaching forms 9 and 20 to the thesis manuscript, pdftk can be useful. Free, portable across platforms, and without the need of administrative privileges, it does a lot of useful things. From the creators: "If PDF is electronic paper, then pdftk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses." Can be downloaded from