Ads by Google

Friday, October 31, 2008

Determine the greatest depth of subdirectories in a hierarchy

I found this thread on comp.unix.shell interesting.  And I particularly liked this solution.

$ x=./a/b/c/d/e/f
$ y=${x//[^\/]}
$ echo $y ${#y}
////// 6


Nicely done within the shell itself without calling anything anew.  And the thread itself has other solutions that may be of use to people who need to traverse and check files in directories.

Monday, October 27, 2008

List of packages included in the TeXLive 2008 Distribution

This might be useful information for those using TeXLive 2008.  Apparently, if you need to know the list of the packages, issuing

tlmgr list

will provide such a list.  There is also this link.

From a post on the comp.text.tex newsgroup.

Strange, there is no archive of the posts since the 25th on google groups.  So, when the archives come back, look for a post with the following information

From: Rolf Niepraschk <Rolf.Niepraschk@gmx.de>
Newsgroups: comp.text.tex
Subject: Re: List of packages in TeXLive 2008
Date: Mon, 27 Oct 2008 12:07:17 +0100
Lines: 16
Message-ID: <6mlln5FhashuU1@mid.individual.net>

Let's hope this gets sorted out fast.

Sunday, October 26, 2008

Placing images next to each other by stitching them together

Most people learn that when using LaTeX, that images and figures can move all over the place when used in a document. The standard advice is to make your document final and then try to tweak the placement of the figure.

Good advice.

And it never works for me. I always want to correct a sentence here, clarify a point there and soon the figure drifts to the next page.

Maddening.

So, the other day I was plotting some graphs of financial data using gnuplot and wanted to put all 6 PNGs in 1 A4 page. My first instinct was to generate a LaTeX template and use subfigure (superseded by Subfig) to place the images.

hmmm....this is going to take a long time I thought.

Each PNG image is 480 x 360 pixels in size.
An A4 paper is 210 by 297 mm in size

Got to do some math to figure out placement....

Screw that, I'll just use ImageMagick to do that.

montage `ls $OUTDIR/${base}*.png` -geometry 100x100% -frame 5 -tile 2x3 $OUTDIR/${base}_merged.png
...
convert -page A4 $OUTDIR/${base}_merged.png $OUTDIR/${base}_merged.pdf

montage and convert are part of the ImageMagick tool suite

So, the above montage command draws a frame around each image and produces a 2 column by 3 row single image of the 6 PNGs. And convert resizes the image to fit into an A4 pdf file.

Obviously there are plenty of drawbacks with my approach, chief among them is lack of flexibility in adding text and such. You can do it over the image though and a bit of captioning with montage but that's about it.

In this case, my needs were simple; all I wanted was all the 6 images in 1 A4 sheet with very little text. montage fits my needs perfectly well.

An example image stitched by montage is


This is then converted to PDF using convert.

Monday, October 20, 2008

Finding the right LaTeX font

If you're new to LaTeX, it is highly possible that you end up having to learn far more than you ever wanted to know about fonts.  Personally, apart from a cursory understanding of fonts, I never bothered learning more about fonts in LaTeX.

Too much to learn and very little benefits.  I mean try talking to your colleagues about Arial and Helvetica differences and watch them edge away with "hey, almost missed my meeting, see you".

I jest.

It's not that you need to know that much into fonts in LaTeX but it helps.  But with all packaging done now by TeXLive and MikTeX, there is very little you need to know.

  1. Ask for a font that fits your specific needs in the comp.text.tex newsgroup.  Read the replies, links and FAQs
  2. Download and install from your distribution through the package manager.
That's it;in most cases.   I haven't installed a single font manually in over 6 or 7 years.  That's how well you can manage with the default installation

OR a sign of my laziness as I have NEVER installed a single font manually

In order to save you sometime over agonizing over font choices, you could always check out the LaTeX font catalogue to see whether you like any of the fonts under different categories.  It also provides the methods of using it in your document when you click on a link.

It would also dispel the notion that there aren't enough font choices in LaTeX.  And if you're a neophyte in font taste like me, pretty soon, your eyes glaze over and everything looks the same to you.  Trust me on that.  10 minutes into all that choices, I'm like "What am I looking for?"

But I digress.  Do take a look there to pick a good font for your posters, reports and special needs.

Saturday, October 18, 2008

New org-mode videos available

From the org-mode mailing list, here's a post about new org-mode videos presented to the Houston Linux User group.

If you're new to org-mode this might be a good thing to view and try out.

Enjoy.

Tuesday, October 14, 2008

Lisp50 Schedule Available

Take a look at the schedule for the Lisp50 conference to be held at Nashville.  All the biggies are there.

Saturday, October 11, 2008

Preventing Emacs from wrapping searches

The key C-s allows you to enter some string to search in the current buffer.  By default, it wraps the search and starts again from the top, if you invoke it one too many times.

On comp.emacs newsgroup, this thread outlines how one can turn it off.  Useful, if it is the kind of behaviour you want.  Speaking for myself, I wouldn't change the behaviour as it makes more sense to have wrapped search as the default.  Saves a few keystrokes and rare is the time one would need this feature of NOT wrapping the search.

Wednesday, October 8, 2008

PGF and TikZ examples page moved

Kjell posted on the pgf mailing list that he has relocated the gallery of pgf and TikZ figures to the new location. As mentioned in one of my earlier posts, it is an incredibly useful resource for typesetting graphics and there are numerous examples of different objects that may be of use to you.

Update your bookmarks.

Monday, October 6, 2008

Interesting papers and author bios for OOPSLA 2008

Over at lisp50, Pascal Costanza has several posts about the upcoming lisp conference.  Even if you're not going to learn lisp in depth, it pays to know who the important people are.  Some of them still post on the comp.lang.lisp newsgroup.

And there are photos to put the name to a face.

Go read.