Procrastiblog

January 17, 2007

Hillary/Obama/Edwards Three-Way

Filed under: Not Tech, Politics — Chris @ 5:10 pm

Michelle Cottle at The Plank speculates on the Democratic primary race:

The safe-money bet is that we’ll hear this minority v. chick storyline approximately 7,500 times if both senators [Clinton and Obama] indeed make a play for the White House, which has me wondering: What will this mean for the oh-so-white guy currently rounding out the Democratic triumvirate of top-tier candidates, Johnny Reid Edwards?

Will Edwards suffer from not being included in the media frenzy certain to rise up around Hillary v. Obama–all those inspirational stories about American social progress and the chance to remove the asterisk from the assertion that “anyone can grow up to be president”? Will some people come to resent Edwards as another entitled white guy trying to spoil the party?

Alternatively, will all the talk about race and gender and trailblazers and cultural barriers ultimately turn people off or make them question the qualifications (or, god forbid, the electability) of the two aspiring “firsts”? In the end, will Edwards benefit from being the candidate utterly without novelty appeal in this race?

John Edwards, here’s your winning campaign slogan… You can have it for free. “John Edwards: He’s a man. And white.”

P.S. This is the exception that proves the rule: I have no opinion about the 2008 presidential race. I don’t plan to have one until Q1 2008 (at least).

Printing LNCS format PDFs

Filed under: Tech — Chris @ 4:53 am

[Editor’s Note] This is old material imported from my now-defunct Wiki

(Non-academics: just scratch your head and walk away…)

LNCS format papers from SpringerLink have always been a frustration to me. They are an odd digest size (not letter, A4, or A3, AFAIK) with wide margins. Printing them 1-to-1 on letter paper is a waste—the font blows up to almost 14 points with 2 inch margines. Printing them naively 2-to-1 landscape letter makes the font too small and the margins too big (especially down the middle).

I just spent a few minutes hacking up a solution with pstops (part of psutils). Here it is:

acroread -toPostScript -size letter lncsdoc.pdf
pstops '2:0L@.7(8in,0)+1L@.7(8in,5in)' lncsdoc.ps lncsdoc.2up.ps
ps2pdf lncsdoc.2up.ps lncsdoc.2up.pdf

I’ve tested this on a few papers and it seems to work.

Caveats: It might generate sub-optimal or even broken Postscript (Acrobat Reader seems less happy with the final PDF than it is with the original, maybe just because there’s twice as much PS data on each page). The file lncsDoc.2up.ps doesn’t have the right size and orientation parameters in GhostView. The parameters to pstops may be installation-specific.

For the pstops-curious, the second command does the following:

2: – groups the input pages by twos
0L – takes the first page of each pair and rotates it left
@.7 – then scales it down by 0.7
(8in,0) – then moves it 8 inches down (the point of rotation seems to be the lower left corner, meaning without translation, the rotated (logical) page is no longer on the (physical) page)
+1L – takes the second page of each pair and rotates it left
@.7 – then scales it down by 0.7
(8in,5in) – then moves it 8 inches down and 5 inches across (I guess the left/right pages start from the same point!)

Modifications to the scaling factor and translation are all that should be necessary for personal taste/local compatibility.

NOTE: This may be applicable to other Springer formats, but I’m not familiar with them.

[UPDATE 3/12/2007] The right parameters for this turn out to be a constantly moving target. Here’s the command that currently works best for me on Ubuntu Gutsy:

pstops '2:0L@.8(8.5in,-.25in)+1L@.8(8.5in,4.5in)' lncsdoc.ps lncsdoc.2up.ps

[/UPDATE]
Alternative One-liner

cat lncsdoc.pdf | acroread -toPostScript -size letter | pstops '2:0L@.7(8in,0)+1@.7L(8in,5in)' > lncsdoc.2up.ps

Caveats: The generated PS file doesn’t work with ps2pdf, for some reason. It also didn’t print the last page, when I used lpr on it. It looks like somehow the PS file doesn’t get properly closed off. Suggestions are welcome.

Alternative Non-Adobe Solution

The following works, but produces awful screen output. I guess pdf2ps doesn’t get the right fonts or something. It also has the wrong orientation in both GhostView and Acrobat Reader.

pdf2ps lncsdoc.pdf lncsdoc.ps
pstops '2:0L@.85(7.75in,0.5in)+1L@.85(7.75in,5.5in)' lncsdoc.ps lncsdoc.2up.ps
ps2pdf lncsdoc.2up.ps lncsdoc.2up.pdf

I’m not sure if pdf2ps is a standard utility or just some random thing I downloaded (from here for example). It boils down to the following:

gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pswrite -sOutputFile=lncsdoc.ps -c save pop -f lncsdoc.pdf

Where gs is your friendly local GhostScript install.

Windows XP to A4 paper

pstops '2:0L@.85(9.5in,-.5in)+1L@.85(9.5in,5in)' lncsdoc.ps lncsdoc.2up.ps

Or is it better to just scale up with pstops and let psnup do the rest?

pstops '2:0@1.3(-22mm,-58mm),1@1.3(-48mm,-58mm)' lncsdoc.ps | psnup -2 > lncsdoc.2up.ps

The former file is a little smaller. And they both look bad in GSview.

[UPDATE] So you can make up your own mind whether I’m crazy for giving this any thought at all, here’s a comparison on a paper I just happen to be reading today.

Standard LNCS format (2 pages):

Those are (approximately) 2 inch margins and a 12+ point font. (The copyright notice eats into the bottom margin a bit at left, but it’s not present past page one.)

Using GNOME/Evince standard “Pages per side: 2” print option:

Look at that gutter! The bottom margin is more than 3 inches.

Using acroread -toPostScript and the above pstops command:

Better…

It’s totally not worth it, is it?

[UPDATE 2] I’ve created a shell script that simplifies the process described above: it takes an LNCS-formatted PDF or Postscript file and generates a 2-up Postscript using acroread (for PDF inputs) and pstops. Download here. Note: The script will probably have to be tweaked for system-specific pstops settings, as above.

Development Tools on Mac OS X

Filed under: Tech — Chris @ 4:48 am

[Editor’s Note] This is old material imported from my now-defunct Wiki

I’ve been using Mac OS X 10.3 (Panther) since it was released. I regularly use Unix tools like make, gcc, latex, etc. I recently had a catastrophic hard disk failure and just got around to re-installing my development environment. The hard disk came from the shop loaded with the OS, but no Developer Tools. I put in my XCode Tools install disc and installed all of the Apple Developer Tools. Afterwards, I got the following error trying to run gcc on anything:

  % gcc t.cld: can't locate file for: -lcrt1.o

Thanks to Dan Smith on MacInTouch I discovered my re-install routine wasn’t sufficient. The repair shop probably installed the OS off a backup disk that didn’t include development libraries; the XCode disc isn’t careful about checking library dependencies.

If you’re installing development tools on a fresh hard disk (or even a brand new Mac, probably), you need to make sure you have the following files in /usr/lib: bundle1.o, crt1.o, dylib1.o and gcrt1.o. If they’re not there, either: (1) do a fresh install off the OS discs, or (2) download and run the full XCode 1.1 or 1.2 installer from the Apple Developer Site (Log In (free registration) -> Downloads -> Mac OS X -> XCode Tools).

Problems with Ghostview

After installing Fink 0.7.2 and using it to install Ghostview 3.6.1-4, I got the following error trying to run gv:

  % gvWarning: Representation size 4 must match superclass's to override highlightedBackgroundWarning: Unsupported shape style for Command widget "toggleCurrent"Warning: Unsupported shape style for Command widget "toggleEven"Warning: Unsupported shape style for Command widget "toggleOdd"Warning: Unsupported shape style for Command widget "unmarkAll"Warning: Unsupported shape style for Command widget "autoResize"Warning: Representation size 2 must match superclass's to override internalWidthBus error

This is apparently a problem with the Fink binary distro of gv. If you rebuild from source (i.e., fink rebuild gv) it should work fine (assuming that all of your X11 dev libraries are set up right—don’t let Fink install XFree86 over your Apple X11 install! (Unless, of course, you know what you are doing)), .

Links

MacInTouch has an incredibly large collection of tips for Panther users, as well as for all kinds of other Mac-related subjects.

Blog at WordPress.com.