www.flickr.com

Tuesday, August 29, 2006

Dr. Smith's Résumé

I'm finally getting my résumé back together. And to feed my Web 2.0 addiction, I'm trying out Emurse to put my résumé together. Genrerally, it's working very nicely. My only complaint is that the resulting document is a little too "Word-like" - though I'm not entirely sure what I'd do to improve on that. Given that I'm never quite sure how to format or my résumé, I'm quite happy to have found this tool.

Visit my résumé at Emurse

Emacs Tip: No More Than a Single Instance of Emacs

In my previous post on Emacs, I pointed out that after modifying the .emacs file to include the initialisation of gnuserv, there was an error message emitted when more than one instance of Emacs is launched.

This error comes from the fact that gnuserv only works if there is a single instance running.

As it turns out, this problem has a very simple solution. Instead of launching Emacs using the program runemacs.exe that comes with the aforementioned Emacs distribution, launch Emacs using the program gnuclientw.exe that comes with the gnuserv distribution from the previous post. This program will run Emacs as a client if gnuserv is already running, and if not, then it will run Emacs regularly.

This usage has a few nice effects. Firstly, no more than one Emacs window will exist; your desktop will stay tidy. Secondly, opening a file that is already open will take you to the same editing position; you don't risk editing the same file in two separate processes.

The only catch is that this requires re-associating all the file extensions to gnuclientw.exe instead of runemacs.exe and changing your shortcuts. Unfortunately, this is a bit of a pain under Windows, but worth-while when it's done.

I think that this post wraps up the "the essentials of how to get a great LaTeX environment for Windows" saga. There will be future posts, but they'll be about extra features (look for something on either folding or outlining soon). The basics are all nicely described now.

Monday, August 28, 2006

Inkscape Tip: Use Inkscape on the Command-line

It turns out that Inkscape (an SVG editor) has a few useful command-line options for non-interactive use. However, these are only documented on the Inkscape website (Manpage of INKSCAPE), but not in the documentation accessible from the program.

The real gem in the command line options is are the export options. These are a command-line interface to load up an SVG file and export as another format in a non-interactive format. This allows for the inclusion of vector format conversions in scripts.

Since the well-known image conversion utility ImageMagick does not have vector-to-vector format conversions, this is a very useful tool.

Particularly, this is an issue when using Inkscape (or other tools that use SVG) to create images for LaTeX documents, where one of EPS, PDF or PNG is typically used.

To convert an SVG file to an EPS file use
inkscape -f file.svg -E file.eps
to a PDF,
inkscape -f file.svg -A file.pdf
and to a PNG,
inkscape -f file.svg -e file.png

Friday, August 25, 2006

Adobe Reader Tip: Make Reading Easier With the Accessibility Features

As a followup to the previous entry on eye strain, I've been looking for a way to make reading documents easier.

In Adobe Reader (aka. Acrobat Reader), it is relatively simple to set up a low eye-strain environment for reading. The magic happens with the accessibility options.

To set up the accessibiliy options
  1. Go to the Preferences dialog box, either with Ctrl-K or from the menu by Edit->Preferences.
  2. Select Accessibility from the list on the left.
  3. Enable Replace Document Colors (check-box)
  4. Select Use High-Contrast colors from the radio-selection
  5. From the High-contrast color combination select Yellow text on black.
Then, when reading a PDF document, go into full screen mode and maximise the size of the text.
  1. Goto Full-screen mode, either with Ctrl-L or View->Full Screen
  2. Use Fit-Visible mode, either with Ctrl-3 or View->Fit Visible
This will drastically reduce the amount of light emitted from the screen, keep the contrast high, provide large text and remove any distracting visual elements when reading. Personally, I find that this helps immensely to make reading electronic documents more comfortable.

Thursday, August 24, 2006

An Experiment in Eye Strain

Oy! My eyes have been a bit sore lately. So has my back, head and moustache. I've been sleeping badly too.

I think it comes down to a bad work setup. I spend pretty much all my time at a keyboard, so when things are wrong with my setup, I suffer. I've known about a few obvious problems, the chief one is that I'm on a laptop without an external monitor and I do not have a good desk or a good chair, so I'm slouching and hunched over all the time.

But, I think I've realised that I have another issue that is not well explored in the good work environment lore. I have a screen that's bright, but the matte finish causes all the brightness to go diffuse and glaring. There's quite a large amount of light hitting my eyes all day and the scattering effects from the matte finish could be messing with my visual cortex. I figure that if the visual signals are a bit messed up, the brain has to work that much harder to understand the signals its receiving.

Thus, my experiment is to run mt screen at minimum brightness. Less light assaulting my eyes and relatively more light is going cleanly from the screen to my eyes. After an hour of cranking down the brightness, I'm already feeling better. Now, I just need to see if this is a short term effect or really a benefit. Afterall, it could just be that I need to relax and get out a bit this weekend.

I'll follow this up in a week or so to report the results.

Monday, August 21, 2006

Emacs Tip: Making Emacs Work With Yap

As a followup to my previous post about the joys of the newest version of Emacs, AUCTeX and Preview-TeX on Windows, I now present how to make Emacs invokable by another application on Windows. It all has to do with the magic that happens when source-specials are enabled in AUCTeX

Here's the current scenario:
  1. Edit a LaTeX file with Emacs
  2. Run C-c C-c to compile
  3. Run C-c C-c to view
  4. Yap will load up with the DVI file in the spot that is currently being edited in Emacs
  5. Double-click in a spot in the DVI file in Yap and ... !?!
What follows are the instructions for turning that !?! into "jump back into Emacs at that spot in the LaTeX File", just as we want.

It all comes down to the problem that the implementation for Emacs' client-server architecture isn't complete on Windows. However, there is an external implementation, the one used in XEmacs, that works rather well.

This is hardly an automated task, so don't run through these instructions too quickly.
  1. Download gnuserve for Windows. It's near the bottom of the page. I used "newer and hopefully more compatible version".
  2. Unzip the file that was just downloaded.
  3. From the zip file, copy the executable files (*.exe) to the bin subdirectory folder and the Emacs Lisp files (*.el) to the site-lisp subdirectory of your Emacs folder.
  4. In your .emacs file, add the lines
(load "gnuserv")
(gnuserv-start)

If everything worked, you can fire up Emacs and enjoy some fantastic Emacs-Yap editing interaction

Caveats:
  • It seems that there may be an issue with running more than one instance of gnuserv. I'm looking into that.
  • It seems that the version of gnuserv that I'm recommending may be a bit outdated or has had it's development abandoned. However, I can't find a newer version. Hopefully there will be a development soon on this front.

Friday, August 18, 2006

LaTeX Tip: Emacs, AUCTeX and Preview TeX - A Fantastic Editing Environment

I think I've discovered the best new environment for LaTeX under Windows, it's Emacs 22 with AUCTeX 11.38. It's the sort of setup that mostly just works. With a bit of tweaking, it really does just works. How rare it is to find this situation in the world of software!

This post covers how to get and install this combo under Windows, how to do a few useful customisations and a few useful commands.

Installation
The best place to start is to download the pre-built Windows version of Emacs with the latest AUCTeX built in (download here). The installation of this version is dead simple: download it, un-zip it and run the program runemacs.exe in the bin directory.

First off, the latest Emacs 22 has fantastic Windows integration, way ahead of Emacs 21 or XEmacs. Things like cut-and-paste now actually work. It's worth upgrading to Emacs 22 if you're running any other version of Emacs or Emacs variant.

AUCTeX
AUCTeX is a package that includes a whole bunch of useful commands, syntax highlighting and formatting for LaTeX and related programs. The most useful AUCTeX command is C-c C-c, which will compile and view your LaTeX document.

Preview-TeX
Preview-TeX is now built into AUCTeX and works with both regular LaTeX and PDF LaTeX documents (i.e. it works with EPS, PDF and PNG images and outputs). Preview-TeX will go through your LaTeX document and interpret and display in place various LaTeX elements, including section headings, equations and figures.

A few useful Preview-TeX commands are
  • run the preview on the whole document: C-c C-p C-d
  • run the preview at a point: C-c C-p C-p
  • run the preview on an environment: C-c C-p C-e


Customising the Emacs Startup
The only annoyances with the Emacs startup is that it always displays the splash screen and it does not necessarily start at a nice size. This can be easily fixed by adding a few lines to the .emacs file (usually at C:\.emacs).

To disable the splash screen, add the line
(setq inhibit-startup-message t)
and to set the window size, in the number of displayed characters, add the lines
(set-frame-height (selected-frame) 40)
(set-frame-width (selected-frame) 80)

Make AUCTeX Play Nice with MikTeX
By default, AUCTeX expects that the LaTeX installation is a typical UNIX one, which is rarely the case with a Windows environment. As it happens, AUCTeX can reconfigure itself nicely to use the MikTeX (one of the most popular implementation of LaTeX for Windows) setup quite easily. It is simply a matter of adding
(require 'tex-mik)
to the .emacs file.

Make AUCTeX Jump to the Current Position in the DVI File
By Default, when AUCTeX invokes the DVI viewer, it does so without any fancy options. This means no jumping to position or inverse editing. This is easily enabled by default by adding
(setq TeX-source-specials-mode t)
to the .emacs file.

Monday, August 14, 2006

Finally, A Real Vacation!

For the first time in ages, I'm going to be taking a real vacation. I really don't remember the last time I went somewhere strictly for a vacation. It must have been a family vacation when I was still young.

So for me, it's one week in Scotland in September.

Wednesday, August 09, 2006

Math Tip: Find the Angle Between Two Vectors

I almost always forget how to do this and need to rederive it every time I need it, I'm posting the algorithm here.

Assume two unit-length vectors A and B. The dot product of the two gives us the cosine of the angle between them.

cos θ = A·B.

Of course, that's the easy part to remember and, of course, everyone forgets that

cos-1(cos θ) ≠ θ,

but rather

cos-1(cos θ) = ±θ.

So, how to properly determine if it is +θ or -θ? The answer is to also check the sign of the cosine of the angle between A and C, the vector that is B rotated by π/2. Then, if the signs do not agree (i.e. A·B < 0 and A·C > 0 or, A·B > 0 and A·C < 0), θ needs to be negated.

Sunday, August 06, 2006

A Short Trip To Bézier


IMG_4893, originally uploaded by smithco.

Took a trip to Bézier today. Turned out that the place is dreadfully boring. At least, I managed to get a few decent photos. View the whole photo set.

Friday, August 04, 2006

Del.icio.us Badge

I've added a del.icio.us badge on the right of this page. Nothing too special, but it does allow one more networking opportunity.