Show hidden files in Finder

To display hidden files in Finder type the following commands in the Terminal:

$ defaults write com.apple.finder AppleShowAllFiles TRUE
$ killall Finder

Add new packages to your MacTex installation

To add new packages to your Mactex installation follow these steps:

$ mkdir ~/Library/texmf/tex/latex/newpackage/
$ cp newpackage.sty ~/Library/texmf/tex/latex/newpackage/

That’s it. No need to re-index package list or something.

Snow Leopard (Mac OSX 10.6) is here

mac106buena Snow Leopard (Mac OSX 10.6) is here

Fix overfull problems when too many consecutive empty sections in Latex

I’m using Doxygen to document some C source code. This tool generates multiple sections in the Latex document (one for each variable). These sections are empty (i.e. they only have a title, no text). The problem is that Latex doesn’t automatically break the page when it should, and the section titles go beyond the margins (in fact many titles are not displayed at all).

To solve the issue add the following code to the document’s preamble:

1
2
3
\makeatletter
\renewcommand\@afterheading{}
\makeatother

Convert EPS files to PNG images

Doxygen generates collaboration diagrams in EPS format. If you want to include these graphics in a Latex document that produces PDF output, you have to convert them, for example, to PNG format. To make the conversion we’re going to use Convert. Convert provides image conversion between different formats and belongs to the ImageMagick suite of tools. Just navigate to the directory containing the EPS files and type this command:

for var in `ls|grep eps`;do convert $var ${var}.png;done

This produces PNG images with an .eps.png extension. If you want to leave just the png extension run this python script:

1
2
3
4
#!/usr/bin/python
import os
for fname in os.listdir(os.getcwd()):
        os.rename(fname, fname.replace('.eps.png','.png'))

Mac OSX Preview, merge, crop, delete, add blank PDF pages

To merge and/or remove PDF pages we need the sidebar so press the sidebar button (see first figure). You can switch from thumbnails to table of contents from the button located at the bottom right corner (see second figure).

preview1 Mac OSX Preview, merge, crop, delete, add blank PDF pages

preview2 Mac OSX Preview, merge, crop, delete, add blank PDF pages

Merge PDFs.

Open the first PDF and then just drag & drop the second PDF to the sidebar, between the pages where you want it to appear (see figure).

preview3 Mac OSX Preview, merge, crop, delete, add blank PDF pages

Delete a page.

Select the page you want to delete (in the sidebar) and type Command (The key with an apple) + Backspace.

Add a blank page.

Select Edit -> Insert Blank Page.

Crop an image or file.

First click the select tool. Then select an area of your document or image and hit Command + k.
preview4 Mac OSX Preview, merge, crop, delete, add blank PDF pages

Now you can save the cropped page or image with Command + s.

preview5 Mac OSX Preview, merge, crop, delete, add blank PDF pages


Most expensive Java Script ever

Opera SW needed new servers. Principal HW vendors sent their servers for testing. When Opera’s sysadmin booted up one of the server to test its web-based administration interface, they came across the following JavaScript code:

if (is.opera)
{
window.location.href="config/error.htm";
}

Period.

Dictionary Tooltip, on-the-fly word translations while reading web pages

Dictionary Tooltip is a Firefox Addon that displays on-the-fly word translations in a small tooltip on the same page you’re reading.

Working with Dictionary Tooltip is very easy. You just have to double-click on a word and you instantly get the definition for that word (or its translation to another language).

Dictionary Tooltip comes with many dictionaries and has the ability to add new ones. You can download it here. It works with Firefox 3.5.1.

dicttooltip Dictionary Tooltip, on the fly word translations while reading web pages

Define macros in Latex

The \def command provides macro definition in Latex. These definitions are quite useful if you need to repeat some text across the document. For instance you can define a macro containing your document’s title and then use it in the document this way:

% macro definition in the preamble
\def \doctitle {This is my document's title}
% Using the previously defined macro in the document
This document, titled \doctitle , deals with ...

Get more section levels in Latex

Sometimes you need more section levels in your Latex document. With little effort you can get up to 5 section levels (the equivalent of a \subsubsubsubsection command), just include the following command in the preamble:

1
\setcounter{secnumdepth}{5}

To get the fourth and fifth levels use \paragraph and \subparagraph respectively. The sectioning hierarchy remains as follows:

1
2
3
4
5
\section{First level}
\subsection{Second level}
\subsubsection{Third level}
\paragraph{Fourth level}
\subparagraph{Fifth level}