Ads by Google

Friday, May 30, 2008

Extracting specific pages from PDF files using LaTeX

I frequently receive large PDF files from my colleagues which needs to get reviewed by a number of people. Instead of mailing the whole document, especially if it is large, I mail them the relevant pages.

You don't need any extra software or some external binary. There is the package pdfpages on CTAN which does exactly what is required and more.(If you read the documentation, that is)

A simple example demonstrates the ease by which PDF pages can be extracted.

\documentclass[a4paper]{scrartcl}
\usepackage{pdfpages}
\begin{document}
\includepdf[pages=72-74]{statistics.pdf}
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:


Of course, it can also be merged with the current document that one is writing in LaTeX too. So if someone sends in PDF images that needs to be incorporated in your workflow, just plug in some \includepdfs with the name of the file and compile the document. And it is simply plugged in without any fuss. So, if you're the delegating type, this is a godsend. :-)

Wednesday, May 28, 2008

OOXML, objections raised!

By golly, South Africa seems to have some objections over the document format and the approval process that it has officially lodged a complaint. This is going to delay things even more on a normally staid and slow standards body.

Engaging in a bit of schadenfreude, it will be that once the complaint is registered, more complaints will be lodged by other parties once the approval process document trail is shown.

And it's not going be pretty.

Tuesday, May 27, 2008

Email attachments and Gnus

When you receive files in your email and they're embedded in the mail message, a quick way to save them is to hit K o. With a numerical prefix, it will save the nth inline or MIME attachment.

If the file is large and you want to strip it from the mail message, K O will do the trick. Again, deleting the same can be done via K d, because some mail clients will stupidly resend the attachments when replying without stripping it first as a default behaviour.

More useful commands can be found here.

Friday, May 23, 2008

Make LaTeX emulate Microsoft Word paragraph spacing

This might be useful for someone who needs to make LaTeX behave like Microsoft Word in its paragraph spacing. You know, the one where the words are stretched to fill in the entire text line area. Well, to achieve that, you need to do the following

\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000


Hat tip to Donald Arseneau on this thread. Note that, it makes hyphenation of words very,very unlikely.

Wednesday, May 21, 2008

An useful emacs shell setting

This is another useful addition to your .emacs; To prevent that command line from staying at the bottom in your emacs shell. Though this doesn't seem to work on my win32 emacs and cygwin bash shell.

hmmm....

Edit: in the same thread the following suggestion works for win32 Emacs at least.

(setq comint-output-filter-functions '(comint-watch-for-password-prompt))

Now, the prompt is pretty much centred in the middle of the screen

Edit 2: More additions, this seems to be the correct way

(add-hook 'shell-mode-hook
(lambda ()
(remove-hook 'comint-output-filter-functions
'comint-postoutput-scroll-to-bottom
t))) ; LOCAL




Monday, May 19, 2008

If ediff highlighting is confusing you....

then there is a simple configuration tweak to fix that. ediff highlights all the differences in a riot of colours and it takes some time to focus on the chunk that is highlighted or active.
A simple tweak that I found when browsing the emacs newsgroup. The settings makes only the current chunk highlighted thus making it simple to see the differences. Another minor change that can be set is the whitespace difference checking. I don't use it as I sometimes deal with data files and I need to see the spaces but otherwise it too is a simple fix when you're just interested in what's changed.



;; only hilight current diff:
(setq-default ediff-highlight-all-diffs 'nil)

;; turn off whitespace checking:
(setq ediff-diff-options "-w")



To know more about ediff, read the documentation here.

Friday, May 16, 2008

USB based Fedora 9?

Saw this here and here and should say that it is really a good idea. Each release of some distribution adds new software and features but it's nice that some thought has gone into...well, getting it distributed.

With USB sticks given out as swag in conferences, this could be an attractive way to get people to try Linux. Of course, only if the boot sequence supports starting from a USB port from your PC. If it is common, I'd say, it's a better method than burning CDs. Only problem I see is that on older PCs, the USB ports are all at the back plane and it's a pain to reach around especially if you keep the PC in a corner like I do.

Even worse, mine is boxed in on 3 sides, so I have to pull out the PC cabinet and then plug it in.

Tuesday, May 13, 2008

Truncating long subject lines of mailing lists

If you subscribe to mailing lists, especially in digest mode, you'd find the subject line having a line like

name-of-list-Digest -date

And if the name is long, you'd see it scrolling to the right. If this is something which has to be remedied,like right now, :-)

you could add the following lines to the Group Parameters of the group.

((total-expire . t)
(gnus-list-identifiers "SAS-L Digest -")
(expiry-wait . 10))


Change the string highlighted to the subject line of the list of yours. In my case, all i now see is the date of the digest mails, which is all that I want.


Saturday, May 10, 2008

Commenting or adding annotations to PDF files

This thread on comp.text.tex has some suggested software that might be of interest.

What I'm interested in is 2 things, a way to enable commenting through pdftex and a PDF viewer/reader that allows commenting or annotations. That way, I'd be able to have a decent document edit-review-fix cycle with non LaTeX users. Without that, there is the tedious job of making a non-LateX file reviewed and then transcribing the same into a tex file. Which I don't like doing.

And if the reviews are exhaustive, I'm forced to use the Office Suites and that drives me batty. I can't use LaTeX, as there are others who don't use it and I'm generally confused by Office suites as it always manages to NOT do what I think it should.

No Joy.

Friday, May 9, 2008

Aligning Text in Emacs Buffers

Surprisingly, I found this a bit hard to do. As an example, I wanted to align

4000 1 2
11 1 44
1 0000 999
as
4000 1 2
11 1 44
1 0000 999

After checking the documentation, I found that align.el is the built-in library that could be used. Trying it as M-x align on the marked text didn't work nor did the regexp option with [[:space:]]. Then I checked the emacswiki for alignment but didn't find an example there that worked with numbers.

Edited the wiki and posted the question and it was quickly answered. From the look of it, it appears that other methods are slightly easier than the solution provided. Especially table-insert function which can be quite easy to create and edit.

Thursday, May 8, 2008

Open Office 3.0 beta is out

Just saw this on the LWN site and this is pretty timely. If the thunder can be stolen from the OOXML ratification by the ISO and the ODF standard made more popular,it should make a dent somewhere.

The complete feature list is available on the Openoffice website and the only irritating thing is the line New, Fresh-looking Icons. I'd rather a stable, feature rich editor than "fresh" fancy icons on the screens. We've got that from one vendor whose product upgrades are more like new coats of paint hiding the rot within.

Why take that route at all?

To be honest, though I have Openoffice installed, I've fired it up around 10 times to read versions of Microsoft Office files that I receive rarely. Which is about all since I use LaTeX for typing out documents. Other family members don't notice the difference between the office suites that much, so it helps there.

I suppose these days, it's hard to get excited about Office suites when the majority have Microsoft Office suite as the default desktop tool. Pity, it could save them a whole bunch when they use just a fraction of the feature list.

Wednesday, May 7, 2008

A few thoughts on the Sun MySQL backtracking

OK, now that all parts of MySQL is going to be free, there are a couple of things which still stand out.

If you want to do a tiered service of free, Incident support contract, service contract, and variations there of, just don't do it immediately after an Open Source buy. This seems pretty obvious....in hindsight.

And when you backtrack, you need to generate the same level of notoriety/publicity that caused you to backtrack, so that people know you came to your senses. This is even more difficult in this Internet drive-by visit,10 sec attention span.

This was an Open Source buy, which means proprietary products selling tactics need to be done differently. If the selling had been along the lines of ; upto 4 CPUs no charge, anything higher, support will cost you, it would be a big deal with respect to OTHER Database vendors.

One, the vast majority of LAMP servers are on low end stuff and individuals tinkering with it, so no one will probably complain on the pricing front.

Second, you raise the bar for the other database vendors by cutting out their low end revenue segment (Oracle editions are free on single CPU machines and for personal use). Forced to compete with MySQL on multiprocessor boxes, you drive the database costs lower, cannibalizing prices in the process.

Three, if you benchmark it on your hardware and make it come out on top,(it's your product after all), you make a good TCO case with zero software acquisition cost for the customer but backed by your company support on YOUR hardware. You use the software to drive the hardware sales.

Heck, if Sun's multicore is as good as they claim, benchmarking on lower Mhz chips with more cores should show some results to crow about?

Let's see how this pans out.

Tuesday, May 6, 2008

Blue Screen of.....never mind

A little macabre thought over this article. Would you want that in your car?

:)

Sunday, May 4, 2008

Printing address labels using LaTeX

One of the best things about CTAN is that it has all the software for your everyday needs. For the last couple of weeks, I'd been sending out some large number of snail mails to a lot of organisations. And my handwriting is pretty much crap; even I can't decipher it after a few days. The return address looked like I had an epileptic seizure when writing it. And the solution was to print out my return address on labels. I could spent half an hour, doing it on my own (which would have been crappy too) but why reinvent the wheel? I was pretty confident that it had been done before.

Since I had MikTeX installed, I fired up the package manager and soon enough, located the labels package. Installing through the package manager was a breeze. And the documentation is excellent. Here's what you need to type to print a A4 sheet of your own address labels.

\documentclass[a4paper,12pt]{article}
\usepackage[newdimens]{labels}
\LabelCols=3 %3 columns of labels
\LabelRows=7 % 7 rows of labels
\numberoflabels=21 % number of repeated labels

\begin{document}
\boxedaddresslabel[\fboxsep=3pt]
{\textbf{From:\\ Sivaram} \\Line1\\Line2 \\Bangalore \\Karnataka}

\boxedaddresslabel[\fboxsep=3pt]
{\textbf{From:\\ John Doe} \\Line1\\Line2,\\ Bangalore \\Karnataka}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

Save and run PDFLaTeX on the file and you should get a 2 page PDF that has 21 address labels on each.

Locate a paper cutter and chop the paper and you have your address labels ready. That's it. It took me half an hour to do this. Which is the same time to do it on my own, :-) but at least this is definitely much better than the trial and error method of trying out fonts with different sizes and boldness.

Friday, May 2, 2008

Shell backticks deprecated!

I didn't know that till I saw this post on comp.unix.shell. For someone who still works on old Solaris boxes that is a shocker. In the nicest possible way.

But if you look at the thread, it appears that it is applicable only to the bash shell and more modern variants. For a minute, I thought it was something which was always there for older shells and only I didn't know about it.

At least, now that I know about it, I can safely use the new idiom with the Linux boxes that I get my hands on. But almost all my work environment is with customer's UNIX boxes which come with the default bourne shell which I cannot change.

So, while good to know, I think I shall have little use for it in my work environment

Thursday, May 1, 2008

Trying out various blogger bits

The more I use blogger, the more i want to make my blog similar to the gazillion blogs out there on the Internet. :-)

So, the first thing I did was a bit of vanity stroking by hooking up with sitemeter.

Then I saw Clustrmaps and I wanted that. So installed that too.

Soon, my blog is going to be exactly identical to everyone else's.

That's a comforting thought, isn't it?