Friday, August 31, 2007

American Naturalist BibTeX BST style file

The American Naturalist, a University of Chicago Press - Journals Division journal, specifies that AASTeX should be used to typeset submissions; however, it does not provide any BibTeX BST bibliography style file. That means that authors still have to manually manage their reference list rather than using BibTeX and a central BIB bibliography database.

The BST: I've tried to remedy this by creating amnatnat.bst, a natbib-compatible BibTeX Bibliography STyle (BST) file for the American Naturalist.

As far as I can tell, this BST will generate a properly formatted BBL file that should not require modifications. Note that American Naturalist requires authors to upload their BBL files and NOT their BIB files (i.e., they don't have the ability to run BibTeX on the server).

ONE CAVEAT: If you have titles that contain colons in them, you will have to manually (either in the BIB or the BBL) change the case of the letter following the colon. For example, if "Some Title: Subtitle" is the title, change the "S" in "Subtitle" to "s". A feature/bug of BibTeX is that its sentence case keeps letters following colons capitalized. This does not match the sentence case definition used by many journals, which considers the words after a colon being at the middle of a sentence rather than the start of a new sentence. As far as I know right now, there is no easy way to change the BST file to do this automatically for you.

FYI: This BST file was generated using amnatnat.dbj (for more details, see amnatnat_full.dbj) and amnatnat.patch.

Wednesday, August 29, 2007

Viewing man pages and text files in Skim

As discussed on the Skim wiki, it is possible to view man pages (and more) nicely formatted as a PDF in Skim.

If you use bash, try adding these lines to your .bashrc:
function skimcat () { cat $* | enscript -p - | open -f -a Skim; }
function manp () { man -t $* | open -f -a Skim; }
Alternatively, if you use tcsh, try adding these lines to your .cshrc:
alias skimcat="cat \!* | enscript -p - | open -f -a Skim"
alias manp="man -t \!* | open -f -a Skim"
Then you'll be able to do skimcat to cat files to Skim, and you'll be able to use manp to view man pages formatted in Skim.

NOTE: You can actually pipe anything that is PostScript (or PDF) formatted to Skim (via the open command shown above).

Monday, August 27, 2007

What's wrong with engineers?

"Love Affair" (Regina Spektor) lyrics
There was a love affair in this building
The kind of love affair
Which every respectable building must keep as a legend
Slowly festering through an innocent "by the way"
Or "have you heard"
He was perfect except for the fact that he was an engineer
And mothers prefer doctors
And lawyers

Yet despite this imperfection
He was clean-looking and respectable-looking
And you'll never find a mother
Who doesn't appreciate a natural man
So he grew healthy aloe vera plants by the window
Healthy teeth in his mouth
Healthy hair on his head
He grew healthy wavy brown hair on his head
The kind, the kind that babies always go for
With sticky little fingers

I have healthy hair and teeth and wavy brown hair. I don't know about the baby thing...

I'm pretty sure my aloe vera plant is dying too...

I suppose it is true that mothers rarely like me...

Thursday, August 23, 2007

LaTeX for generating Behavioral Ecology manuscript

UPDATE: Check out a more complete math-oriented template/example, that I posted as behavecol_math_template.tex. This is ready to use out of the box. It has comments. It is setup for AMS math. It has table, figure, and autoreferencing examples too.

IMPORTANT NOTE: If using amsmath environments, be sure to check out my information on making lineno compatible with amsmath environments.

UPDATE: I have put behavecol_template.tex and behavecol.bst on-line so that you don't have to do any of the following to get them.

The Oxford Journal Behavioral Ecology is not setup for LaTeX manuscript submissions. This baffles me.

So, I spent some time putting together some macros and a BibTeX style file to get up and running with this journal.

First, a template (that uses the article document class), which fixes incompatibilities between figcaps, caption, and anything that uses \ref (see behavecol_template.tex for what is below, or see behavecol_math_template.tex for a more complete example):




\def\figurecapname{Figure legends}

% This lets figcaps work with \ref
% However, forces \label outside of \caption


% Lines are numbered, starting at 1
% (add pagewise to reset at each page)

notesep={, }%




% \Autoref is for the beginning of the sentence

% \Autorefs is plural for the beginning of the sentence

% \autoref is used inside a sentence
% (renew of the standard autoref)

% \autorefs is plural for inside a sentence


{The title},
\title{The title}



% ...The abstract...
\textit{Key words:} Keywords separated with comma+space,
List ends with period.
{Keywords separated with comma+space,
List ends with period},

% ...The document...

% The following line loads the references

Of course, remember to put table captions before the actual table insertion. In fact, it is important that the inside of a table environment has caption first, then label OUTSIDE of the caption, then the actual table content. Additionally, subfigures should be inserted (within a figure environment) with something like:
% ... something like an \includegraphics ...
Also, when you're ready to submit, get rid of the % on the %draft, line of the hyperref options. This will turn off all hyper linking, which will prevent strange little unlinked boxes from being drawn in your autogenerated proof.

Next, the bibliography style file, which I may end up posting later separately. As of right now, it has to be constructed from pieces. First, save the following as behavecol.dbj (see behavecol_full.dbj for more details):
%% Driver file to produce behavecol.bst from merlin.mbs
%% Generated with makebst, version 4.1 (2003/09/08)
%% Produced on 2007/08/23 at 12:02
\input docstrip

*** Bibliography style for _Behavioral Ecology_. ***


End of customized bst file


and then run latex behavecol.dbj. Next, save the following to behavecol.patch:
--- behavecol.bst 2007-08-29 12:07:40.000000000 -0400
+++ behavecol_new.bst 2007-08-29 12:08:01.000000000 -0400
@@ -89,7 +89,7 @@
FUNCTION {output.nonnull}
{ 's :=
output.state mid.sentence =
- { ", " * write$ }
+ { ". " * write$ }
{ output.state after.block =
{ add.period$ write$
@@ -144,6 +144,9 @@
FUNCTION {add.blank}
{ " " * before.all 'output.state :=
+FUNCTION {add.semicolon}
+{ ";" * before.all 'output.state :=

FUNCTION {date.block}
@@ -248,7 +251,7 @@
{ "in" }

FUNCTION {bbl.pages}
-{ "pp." }
+{ "p." }

{ "p." }
@@ -260,10 +263,10 @@
{ "Tech. Rep." }

FUNCTION {bbl.mthesis}
-{ "Master's thesis" }
+{ "[Master's thesis]" }

FUNCTION {bbl.phdthesis}
-{ "Ph.D. thesis" }
+{ "[PhD thesis]" }

FUNCTION {bbl.first}
{ "1st" }
@@ -488,6 +491,16 @@
+{ pages "pages" bibinfo.check
+ %duplicate$ empty$ 'skip$
+ empty$ 'skip$
+ { add.semicolon
+ add.blank
+ pages "pages" bibinfo.check
+ " " * bbl.pages * }
+ if$
FUNCTION {format.note}
note empty$
@@ -950,6 +963,10 @@
+{ school "school" bibinfo.warn
FUNCTION {format.publisher.address}
{ publisher "publisher" bibinfo.warn
@@ -1148,12 +1165,11 @@
author format.key output "year" output.check
- format.title
- "title" output.check
- new.block
+ format.title "title" output.check
+ add.blank
bbl.mthesis format.thesis.type output.nonnull
- school "school" bibinfo.warn output
- address "address" bibinfo.check output
+ output
+ output
format.note output
@@ -1178,12 +1194,11 @@
author format.key output "year" output.check
- format.title
- "title" output.check
- new.block
+ format.title "title" output.check
+ add.blank
bbl.phdthesis format.thesis.type output.nonnull
- school "school" bibinfo.warn output
- address "address" bibinfo.check output
+ output
+ output
format.note output
Then run
patch < behavecol.patch
from the same directory that you ran the DBJ command in. That should generate the behavecol.bst file that is needed for the above template to work.

Wednesday, August 22, 2007

d'Feet ALS Walk Time Again!

This year, the Columbus d'Feet ALS Walk is on Sunday, September 16, 2007.

My brother has ALS (Lou Gehrig's disease), and we participated in this walk for the first time last year (he was diagnosed last year). There was a great turnout. It was neat to see the support from the community.

So, while it's getting late, I hope people will visit my d'Feet ALS walk page and make a donation or become a walker themselves.

Wednesday, August 08, 2007

Broken sections in Elsevier elsart1p, elsart3p, and elsart5p

UPDATE: You should probably add
\def\@seccntformat#1{{\@secnumfont{}\csname the#1\endcsname.}\quad}
around line 128 (i.e., after the \@secnumfont definition) as well. Alternatively, you could add something similar (surrounded by \makeatletter and \makeatother) to your preamble.

Ever notice how section* is broken in elsart1p.cls, elsart3p.cls, and elsart5p.cls from Elsevier? Because of this, the section titles for the acknowledgments (i.e., from \ack) and the references look like normal text. Plus, the references do not show up in the PDF bookmarks. This "feature" is annoying; working with journals generally is.

How to fix this? You have to hack the document class files. In particular, you need to remove (or comment by placing a % on the beginning of the line) a chunk of lines from the document class of interest to you. In particular, remove
  • elsart1p.cls - lines 144--196
  • elsart3p.cls - lines 147--199
  • elsart5p.cls - lines 144--196
These lines redefine the LaTeX internals \@startsection, \@sect, and \@ssect. However, it does not appear there is any good reason why Elsevier has done this, so just stick with the standard ones. This will make your document look much better too.

Until Elsevier does this for you, you should upload your modified document class with your article OR use the elsart document class in the version you send to Elsevier.

Tuesday, August 07, 2007

lineno and amsmath compatibility

UPDATE 2 (READ THIS!): As Ulrich Diez points out, this can be made more compact. Here's the result (place this in the preamble, probably anywhere):
\expandafter\let\csname old#1\expandafter\endcsname\csname #1\endcsname
\expandafter\let\csname oldend#1\expandafter\endcsname\csname end#1\endcsname
{\linenomath\csname old#1\endcsname}%
{\csname oldend#1\endcsname\endlinenomath}}%
This is all that is needed for the standard AMS math environments. However, if you want to add environment BLAH, you can add
before the closing curly brace. If you want to add environments BLAH and BLAH*, you can add
before the closing curly brace.

UPDATE 1: If you use the mathlines lineno option, you may notice that amsmath environments like align may create strange double numbers at the end of the environment. I haven't looked into why this is the case. If you really need mathlines loaded, you may want to consider ways of using equation or equation* exclusively. Keep in mind that you will still need to load at least the equation and equation* lines:
\expandafter\let\expandafter\oldequationstar\csname equation*\endcsname%
\expandafter\let\expandafter\endoldequationstar\csname endequation*\endcsname%
You may think that the displaymath option of lineno will do this for you, but loading amsmath seems to prevent that. I haven't looked into why.

A comp.text.tex post gives some history behind this fix.

It's well-known that lineno and amsmath don't play well together. After loading amsmath, the paragraph that precedes an equation, equation*, align, align*, or any of the other amsmath environments will cease to get line numbers. The ugly fix to this is to wrap every math environment with a linenomath environment. That's pretty annoying. Here's a fix that redefines the equation environment and the amsmath environments so that they'll work with noalign. Yes, it even handles the starred versions of these.
% To deal with amsmath, must redefine math environments later
\expandafter\let\expandafter\oldequationstar\csname equation*\endcsname%
\expandafter\let\expandafter\endoldequationstar\csname endequation*\endcsname%
\expandafter\let\expandafter\oldalignstar\csname align*\endcsname%
\expandafter\let\expandafter\endoldalignstar\csname endalign*\endcsname%
\expandafter\let\expandafter\oldflalignstar\csname flalign*\endcsname%
\expandafter\let\expandafter\endoldflalignstar\csname endflalign*\endcsname%
\expandafter\let\expandafter\oldalignatstar\csname alignat*\endcsname%
\expandafter\let\expandafter\endoldalignatstar\csname endalignat*\endcsname%
\expandafter\let\expandafter\oldgatherstar\csname gather*\endcsname%
\expandafter\let\expandafter\endoldgatherstar\csname endgather*\endcsname%
\expandafter\let\expandafter\oldmultlinestar\csname multline*\endcsname%
\expandafter\let\expandafter\endoldmultlinestar\csname endmultline*\endcsname%
The pattern is pretty clear. You can use it along with any of your own environments. For example, add this at the end (before the closing curly brace) to fix your BLAH environment:
and drop this at the end (before the closing curly brace) to fix your BLAH* environment:
\expandafter\let\expandafter\oldBLAHstar\csname BLAH*\endcsname%
\expandafter\let\expandafter\endoldBLAHstar\csname endBLAH*\endcsname%
I hope that's useful for someone.

cleveref incompatibilities with Elsevier and Springer

elsart problems: If you try using cleveref with any of the elsart packages, you may get this error:
! TeX capacity exceeded, sorry [input stack size=5000].
\cl@part ->\cl@part
\@elt {section}
This is due to a flaw in the elsart packages. They setup some part counters even though part isn't defined. This confuses cleveref. To fix this, add the following anywhere in your preamble:
\makeatletter \let\cl@part\relax \makeatother
Later, you can use cleveref's poorman option to strip all of the cleveref stuff from your document. After that, you can remove this line.

svjour problems: Similarly, if you try combining cleveref with Springer journal support files, you may get this error:
! TeX capacity exceeded, sorry [input stack size=5000].
\cl@chapter ->\cl@chapter
\@elt {theorem}
Again, this is due to a flaw in the Springer packages. They setup some chapter counters even though chapter isn't defined. To fix this, add the following anywhere in your preamble:
\makeatletter \let\cl@chapter\relax \makeatother
Again, this can be removed after cleveref's poorman procedure is applied.

Source and acknowledgments: The Springer solution was given by "Dan" in a comp.text.tex post. I used it to generate the elsart solution.

Friday, August 03, 2007

Eww York

I attended a wedding on, appropriately enough, Wednesday. The wedding was in New York. Before the wedding, I received this from the bride:
I'm having wedding moments that I actually want to share with you like a giddy little girl! First, all of my "bridesmaids" (they're actually just roasting me at the dinner) are getting vibrators as gifts, and all of our groomsmen (read: same as the other) are getting flasks engraved "Cunt" in roman lettering. Ha! I thought you'd find that amusing, if nothing else.
It was a small wedding. This was the for-friend version. There will be a larger for-family reception in Jersey o'er the weekend. While I think the bride and groom are atheists, notheists, or both, the wedding was a little Goddy. However, that was to be expected since the bride used to work for the church. It was a beautiful church and a lovely wedding. Instead of a reception, there was a dinner with a small after-party. Since the wedding didn't start until 5:30PM, we had a chance to see New York (NY) during the day. Some reflections/reports about the New York City (NYC) visit (my first NY visit ever, BTW):

  • My first memorable experience in New York was merging into the single lane that goes through the Holland Tunnel. There was a surprising amount of traffic considering that we were entering NY at 1AM. In Ohio, when we go from four lanes into one, we merge lanes 1 and 2 into one land and 3 and 4 into another lane, and THEN merge those two lanes. That's not how they do it in NY. In NY, they just get rid of the concept of "lane" at all and have everybody merge at once. Turn signals and stoplights are optional, and so they are generally ignored. Nudge your way in wherever you can. People will probably stop, but you won't have more than an inch on any side of your car at any time.

  • My second memorable NY experience was a few minutes later when we got into the Hotel Room. Jessie looks out the hotel room window at the apartment building an alley away and says to me, "There's a naked guy in that apartment!" I look a little closer and respond, "Huh. He's masturbating." In fact, he continued masturbating for the next few hours. This was done in front of wide open windows. We would periodically check back on him by peeking through our closed blinds. At one point, he came up to his window bent over (while still whacking off) and waved at us. At another point, he picked up a large towel and dabbed his forehead with it (I'm guessing he used it for cleanup as well). Yes, he was completely shaven. Yes, we did get pictures and video. No, I'm not going to post it. I was going to post pictures or the video, but then I remembered that there are people out there who think free speech does not extend farther than burning a cross in a blackie's yard. Thus, I'll let you imagine it. We figured he just didn't have any blinds to close. However, his blinds were closed when we woke up the next morning.

  • I hope Times Square is better looking at night. In the day, it's just a little ugly, creepy, and underwhelming.

  • Madison Square Garden is old and ugly (at least from the outside).

  • Paninis in NYC are of equal or lesser value to paninis anywhere else.

  • The American Museum of Natural History is wonderful and huge and a terrific value (considering that you set your own price to get in).

  • Central Park is pretty in some parts.

  • Dogs defecate on the sidewalks in a city like NYC.

  • New Jersey is full service by law, and I hate it, and I think I made that pretty clear to the attendant.
So, there you have it. :)