Converting to pdflatex

December 16th, 2009

Anywhere you use includegraphics, make sure to remove the .eps ending (latex will assume eps and pdflatex will assume pdf).  To convert existing eps files, use epstopdf.  Some may give you an error message:

==> Warning: BoundingBox not found!

You can avoid this by first running eps2eps on the eps file to normalize it, then run epstopdf.

Using Minion Pro Font in Latex

December 16th, 2009

Swapping to Minion Pro gives your document a more distinctive look, but it’s a bit involved.  I followed the instructions from:

http://ctan.tug.org/tex-archive/fonts/minionpro/

and:

http://tug.ctan.org/tex-archive/fonts/mnsymbol/

to install the MinionPro package and the symbol package it depends on.  I used fink to install the lcdf-typetools package (contains the otfinfo tool).  I also chose the enc-v2.000.zip package.  Note that most of the commands need to be run as sudo.  Also, I ran the MNSymbol commands in texmf-local, rather than texmf, without any apparent problems.

In the Latex file, you need \usepackage{MinionPro}, and you need to comment out (if you’re using it) the times and mathptm packages.

I found that the Minion font made ps2pdf take a long time (up to 24 seconds on my thesis), so I swapped to using pdflatex.

Installing Windows XP SP 1 on a Mac via Boot Camp

August 15th, 2009

Technically, Boot Camp requires that you have Windows XP with SP2 or later.  However, I had an SP 1 disk.  One approach would be to “slipstream” the SP 2 update together with the XP disk to create a new disk (see, e.g., http://www.winsupersite.com/showcase/windowsxp_sp2_slipstream.asp for details).

Instead, I chose a more direct route.  Since Windows didn’t recognize the network card, I went into the Windows Device Manager and right-clicked the network card (demarcated with a question mark) and selected update driver.  Windows managed to find the driver on my Mac OS X install disk.  This allowed it to download SP 2.  However, during installation, it produced the following absurd message:

“Service Pack 2 Setup Error:
There is not enough disk space on C:\WINDOWS\$NTServicePackUninstall$ to install Service Pack 2. Setup requires a minimum of 4 additional megabytes of free space or if you also want to archive the files for uninstallation, Setup requires 4 addtional megabytes of free space. Free additional space on your hard disk and then try again.”

It was absurd, since there was at least 21 GB of free space available.

Fortunately, a forum post suggested the following, simple remedy, which worked like a charm
1. Click Start - Run - Type “regedt32″ and press enter

2. Navigate to

HKEY_LOCAL_MACHINE
\Software
\Microsoft
\Windows
\CurrentVersion
\Setup

3. In the right pane, Right-click and select New - String value

4. Name it as “BootDir” and set its value to “C:\”

After making these changes, I was able to install SP 2 (no reboot needed).  Bizarre.

Latex Tables

March 18th, 2009

Here’s a useful guide to the many options controlling Latex tables:

http://www.tug.org/pracjourn/2007-1/mori/mori.pdf

Also available via: latextables.pdf

Satisfying IEEE PDFexpress

March 8th, 2009

IEEE has started using a service called PDFexpress for the camera-ready versions of conference papers.  You can use it to convert a variety of formats to PDF, or you can have it check your PDF for compatibility.

When I checked our paper for compatibility, it complained about two items:

  • Acrobat version is less than 5.0
  • Font Times-Italic, Times-Bold, Times-Roman, Helvetica, Courier, Helvetica-Oblique, Helvetica-Bold, Symbol is not embedded

This was resolved using the following series of flags for ps2pdf:

ps2pdf -dCompatibilityLevel=1.4 -dEmbedAllFonts=true -dPDFSETTINGS=/prepress

I believe the first flag solved the version problem, the second flag solved the fonts problem, and the third flag supposedly enhances the output quality for use on a printing press.

Increasing Mac OS X Process Limits

February 18th, 2009

In trying to run a test script that forks lots (~500) of processes, I ran into this error:

fork: Resource temporarily unavailable - fork(2) (Errno::EAGAIN)

To find out what the current limits are, use:

sudo sysctl kern.maxprocperuid
sudo sysctl kern.maxproc

In my case, they were 266 and 532 respectively.  I increased them using:

sudo sysctl -w kern.maxproc=2048
sudo sysctl -w kern.maxprocperuid=1024

You still need to increase the limit within your current process using:

sudo ulimit -u 1024

To make these changes more permanent, see:
http://www.macosxhints.com/article.php?story=200311151254441

Easy file access via sshfs

February 3rd, 2009

If you install the sshfs file system (built on top of Fuse), you can run a command like:

sshfs parno@192.168.0.25: ~/research/netattest/code/hawk -oauto_cache,reconnect,volname=hawkfiles

And you will wind up with a directory from a remote machine mounted on your local file system, with transfers happening over ssh.  Much simpler than trying to configure NFS.

On a Mac, Fuse is available at http://code.google.com/p/macfuse/ and the sshfs system is also available from Google: http://code.google.com/p/macfuse/wiki/MACFUSE_FS_SSHFS

Resizing a Parallels Virtual Disk

January 20th, 2009

This post had useful instructions.  To summarize, use the Parallels Image Tool to expand the size of the disk.  Then download, connect, and boot from the gpartd ISO.  Make sure to run gpartd in 640 x 480 mode.  Use gpartd to expand the Windows partition.  Reboot, let Windows run its disk check, and you’re good to go.

Debugging on Mac OS X

December 19th, 2008

In trying to figure out how to enable core dumps in Mac OS X, I came across a handy page summarizing the debugging tools and options available.
(For the core dumps, you can use “ulimit -c unlimited” to allow core dumps of an arbitrary size for the current terminal window.  The core dumps end up in /cores.  Analyze it with “gdb -c core_file_name” and add debugging symbols using “add-symbol-file“).

Dynamic Libraries in Linux and OS X

December 13th, 2008

If you need to find out which library files an executable is loading, use “ldd”:

hawk:/home/parno/root-attest/proj1/tqd2# ldd tqd
linux-gate.so.1 =>  (0xb7f81000)
libtspi.so.1 => /usr/lib/libtspi.so.1 (0xb7f10000)
libcrypto.so.0.9.8 => /usr/lib/i686/cmov/libcrypto.so.0.9.8 (0xb7dd6000)
libc.so.6 => /lib/libc.so.6 (0xb7cba000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb7c68000)
libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0xb797e000)
libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0xb78fd000)
libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0xb78e3000)
libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0xb78cd000)
libm.so.6 => /lib/libm.so.6 (0xb78a8000)
libpangocairo-1.0.so.0 => /usr/lib/libpangocairo-1.0.so.0 (0xb78a0000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb7875000)
libXext.so.6 => /usr/lib/libXext.so.6 (0xb7867000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb785f000)
libXinerama.so.1 => /usr/lib/libXinerama.so.1 (0xb785c000)
libXi.so.6 => /usr/lib/libXi.so.6 (0xb7853000)
libXrandr.so.2 => /usr/lib/libXrandr.so.2 (0xb7850000)
libXcursor.so.1 => /usr/lib/libXcursor.so.1 (0xb7847000)
libXfixes.so.3 => /usr/lib/libXfixes.so.3 (0xb7842000)
libpango-1.0.so.0 => /usr/lib/libpango-1.0.so.0 (0xb7808000)
libcairo.so.2 => /usr/lib/libcairo.so.2 (0xb77a6000)
libX11.so.6 => /usr/lib/libX11.so.6 (0xb76b9000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0xb767f000)
libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb767c000)
libdl.so.2 => /lib/libdl.so.2 (0xb7678000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb75e6000)
libz.so.1 => /usr/lib/libz.so.1 (0xb75d1000)
/lib/ld-linux.so.2 (0xb7f82000)
libpangoft2-1.0.so.0 => /usr/lib/libpangoft2-1.0.so.0 (0xb75a6000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb753c000)
libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb751c000)
libXau.so.6 => /usr/lib/libXau.so.6 (0xb7519000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb74f5000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb74f0000)
librt.so.1 => /lib/librt.so.1 (0xb74dd000)

In Mac OS X, you can use “otool -L” instead of “ldd”