Thursday, December 25, 2008

BibTeX Bibliography Style File (BST) for Engineering Applications of Artificial Intelligence (EAAI)

The Elsevier journal Engineering Applications of Artificial Intelligence suggests that authors use the elsart-harv.bst BibTeX bibliography style (BST) file to match its Harvard-style author-year reference format. However, elsart-harv.bst does not match the conventions used in EAAI proofs. In particular,
  • EAAI proofs use "Thesis" (instead of "thesis")
  • EAAI proofs surround the volume of an "in proceedings" entry with commas (instead of periods)
  • EAAI proofs use "vol." (instead of "Vol.")
  • EAAI proofs don't put any space between abbreviated parts of author names (but they do keep the hyphens in hyphenated abbreviations)
So I modified elsart-harv.bst to match EAAI conventions. My modified form is: To use it, just download it, place it in the same directory as your compuscript, and change your
\bibliographystyle{elsart-harv}
line to
\bibliographystyle{elsart-harv-EAAI}
Of course, elsart-harv-EAAI.bst is still natbib compatible.

[ NOTE: More-advanced users may prefer my elsart-harv-EAAI.patch. ]

Tuesday, December 23, 2008

Our 2008 solstice photoset on Flickr

Check out our Solstice 2008 photoset on Flickr. There are a lot of nice shots of Fritz:
Isn't Fritz cute?
Including a video or two, like this one:
That's one cute dog.

Thursday, December 11, 2008

Making MacVim work with Vimperator's external editor feature

Because I'm a vim user, it's naturally for me to use vimperator on top of Firefox.

Today I posted a tip on vimperator.org that helps me use Vimperator on my MacOS system. I'm reposting that tip here.

To make a long story short, try an editor setting like
:set editor='bash -lc "mvim -f \$*" mvim '
or (if you prefer gvim)
:set editor='bash -lc "gvim -f \$*" gvim '
Then you should be able to hit CNTRL+I to launch an external editor for textareas. There are simpler solutions and explanations below.



Shelling out to external commands is hairier in OS X than it is on other platforms.

In my case, I use MacVim, which includes a script mvim that can be called as
mvim -f ...
so that the script will wait for the GUI to exit before it exits. This functionality is identical to the gvim found with other Vim distributions (including older Vim distros for OS X).

My mvim script is in /usr/local/bin. Unfortunately, the PATH environment variable that sits behind user processes has to be set in an special ~/.MacOSX/environment.plist file, and the default PATH does not include /usr/local/bin. If you don't believe me, try
:!env
As you can see, those environment variables are very different from the ones you'd expect in a "login shell." You could go add an appropriate environment.plist file to match your login shell, but then you'll have to keep it up-to-date after every change to your shell profile. As a consequence, it's probably a good idea to
:set shcf='-lc'
Then you'll notice that :!env gives you more expected results. However, Vimperator won't run the editor unless it can find it in what Firefox thinks is the PATH, and so shcf won't help you.

A simple solution is to
:set editor='/usr/local/bin/mvim -f'
For most people, this solution will be perfect. However, some will notice that their favorite utilities (e.g., /opt/local/bin/par or /sw/bin/aspell) will not be accessible in the editor (unless the environment.plist file is modified).

So the final solution is to use bash as your external editor, and have it operate as a login shell that calls your editor of choice.
:set editor='bash -lc "mvim -f \$*" mvim '
Here, bash calls mvim and passes "mvim" as $0 and everything following bash as $1, $2, and so on...

Make Vimperator's "Y"ank behave like Edit-Copy

Because I'm a vim user, it's natural for me to use vimperator on top of Firefox.

Today I posted a tip on vimperator.org that is derived from a suggestion someone else made on the vimperator mailing list. I'm reposting that tip here.

Vimperator has no choice but to copy selected text using the functions provided to JavaScript by Firefox. Unfortunately, these functions sometimes do not provide the expected behavior for certain types of lists, PRE environments, etc.

To make sure that "Y"anking results in the same thing as using Edit->Copy, add the following to your .vimperatorrc:
js <<EOF
mappings.addUserMap([modes.NORMAL], ["Y"],
"Yank the currently selected text",
function () {
buffer.getCurrentWord();
events.feedkeys("<C-v>" +
(/^Mac/.test(navigator.platform) ?
"<M-c>"
: "<C-c>"), true);
setTimeout( function () {
liberator.echo("Yanked "
+ util.readFromClipboard(),
commandline.FORCE_SINGLELINE);
}, 20 );
});
EOF
The code should work well on all platforms (even the Mac, with its "M" key). If it isn't working perfect for you, increase that final "20" until the behavior works how you'd like it.

Monday, December 08, 2008

My college roomate interviewed on Science Friday

My college roomate (George McWilliams) of SWRI was interviewed on NPR's Science Friday:
I'm a little jealous.

Thursday, October 16, 2008

Fixing bug in hyperref's autoref: amsmath-type equations under items get "item" label

Earlier this year, in a comp.text.tex posting, I discussed a bug I found in hyperref. That bug was then fixed in hyperref 6.77a, but there are still plenty of old packages hanging around that have this bug (for example, the hyperref from TeXLive 2007 on my system that I still haven't upgraded to TeXLive 2008).

The problem happens when
  • amsmath (or mathtools) is loaded.
  • An equation (or any other type of displayed-math environment) environment with labels occurs INSIDE an enumerated item.
  • You try to use \autoref to generate a reference to one of those equation labels later.
The \autoref macro will not properly return an "Equation" label (e.g., "Equation 1"). Instead, it will return an "item" label (e.g., "item 1").

To fix this problem, I use these lines of code just after I load hyperref in my preamble:
\makeatletter
\newcommand{\AMShreffix}[1]{%
    \expandafter\let\csname old#1\expandafter\endcsname%
        \csname #1\endcsname%
    \expandafter\renewcommand\csname #1\endcsname{%
        \@hyper@itemfalse\csname old#1\endcsname}}
\makeatother
\AMShreffix{equation}
\AMShreffix{align}
\AMShreffix{gather}
The \AMShreffix (i.e., AMS-href-fix) macro "fixes" the displayed-math environment that you pass it. This example fixes equation, align, and gather. If you want to fix alignat too, add a \AMShreffix{alignat} at the end of those lines. Make similar changes for your other displayed-math environments (e.g., flalign and multline too).

That fix changes all of the improper "item" labels back into proper "Equation" labels.

Monday, October 06, 2008

Big bug in the bathroom

A very large bug was spotted in the men's restroom...
Check out how huge those mandibles are! That thing could take out an eyeball!
For scale, I got this shot of it next to my shoe. The bug is about an inch long.
I didn't step on the bug, but after I noticed it, someone else did. That didn't kill the bug, but it made it less mobile. I couldn't get a shot of it near my shoe when it was more mobile because it kept walking toward my shoe, and I was afraid it would eat through my shoe and eventually eat through me...

Officemate's bee research on NPR

The graduate school research of my officemate (Kevin Schultz) was featured on NPR All Things Considered on Saturday during the "Science out of the Box" segment:

"Bees Follow Their Leaders"
When a swarm of bees takes flight, it can form a cloud as big as a school bus. But who's driving? And how do they know which way to go? Professor Thomas Seeley of Cornell University talks about how swarms of honeybees decide who's at the wheel and who's a backseat flier.
The audio story is streamable from the NPR link.

Professor Passino is our shared adviser, but my research has nothing to do with bee swarms. :) Professor Seeley is a collaborator of Passino/Schultz; he's from Cornell.

Saturday, October 04, 2008

Terra-Fi/Tera-Fi was my idea!

Someday they'll come out with terabit/s wireless networking (similar to 802.11... maybe 802.11t or something), and they'll need a name for it. It came to me this week that a great name would be "TeraFi" (or "TerraFi" or "Tera-Fi" or a similar spelling). That is, combine "terabit" and "wi-fi" to make a word that sounds like "terrify."

So that's my idea.

I wanted to put it out there before someone else did.

Tera-Fi. It's so fast it's scary.