A Tiny Little Rant

lokakuu 31, 2008

Oh why, oh why do the LINQ sorting extension methods have to be OrderBy(Func) and OrderByDescending(Func)?

I’d find it so much less confusing if they were even OrderByAscending(Func) and OrderByDescending(Func), or OrderBy(Func, SortOrder), or the like.

Now I have to actually think every time I sort, “Okay, OrderBy was the one that sorts, um, descending? Was that, with small values first?” All in all, calling sort orders ‘ascending’ or ‘descending’ is the daftest thing in the world to do; the numbers don’t suddenly rise anywhere or go downwards, they get bigger and smaller. Or maybe it’s just me and my limited cognitive capabilities :P

Illustrator, EPS and LaTeX

lokakuu 30, 2008

Ironically, Adobe Illustrator creates malformed files when you save your illustrations as EPS, and of course LaTeX, ghostscript and thus pdflatex choke on them. There’s however a simple remedy: the eps2eps “distiller” strips all non-essential parts away from EPS files thus fixing also malformed AI EPS files.

For reference, here’s the gist of my (unoptimized) eps2pdf script I use before I run pdflatex:

#!/bin/bash
mkdir temp-eps-eps
for file in *.eps; do
    echo -e "$file";
    eps2eps $file temp-eps-eps/$file;
    cd temp-eps-eps;
    epstopdf $file --outfile=`echo -e $file | sed -e "s/\.eps/\.pdf/g"`;
    mv `echo -e $file | sed -e "s/\.eps/\.pdf/g"` ..;
    rm $file;
    cd ..;
done
rmdir temp-eps-eps

This should be called in the directory whose EPS files you wish to convert to PDF.

And why do I use EPS? Pretty much any vector graphics application supports it. Pretty often, saving your illustrations directly as well-behaving PDFs can be much more difficult than using EPS.

To modify citation styles for basic bibitem citations, use the following lines in the preamble:

\makeatletter
\renewcommand*{\@biblabel}[1]{/#1/}
\renewcommand*{\@cite}[1]{/#1/}
\makeatother

The code above changes the citation marker from [n] to /n/.

To change the bibliography title, use (right before \begin{thebibliography}, especially if you’re using babel):

\renewcommand\refname{New Title}   % for article, or
\renewcommand\bibname{New Title}   % for other types