Use Minion Pro / Myriad Pro with LaTeX on Mac

Get Sebastian Schubert’s FontPro and the LCDF Typetools:

git clone git@github.com:sebschub/FontPro.git
brew install lcdf-typetools
cd FontPro

Repeat the following commands with each font you want to install:

mkdir -p otf
cp /Library/Fonts/MinionPro-* otf
./scripts/makeall MinionPro
mkdir -p ~/Library/texmf
./scripts/install ~/Library/texmf
updmap --enable Map=MinionPro.map
./scripts/clean

Replace MinionPro with MyriadPro and others.

Run ./scripts/install /usr/local/texlive/texmf-local and use updmap-sys for system-wide installation.

To get the default Texmf installation directory, run kpsexpand '$TEXMFLOCAL' or kpsexpand '$TEXMFHOME'. See this and this for details.

Advertisements
Use Minion Pro / Myriad Pro with LaTeX on Mac

Make Home / End key move the cursor to the beginning / end of line on Mac OS X

Add the following lines in your ~/Library/KeyBindings/DefaultKeyBinding.dict:

{
  "\UF729"  = "moveToBeginningOfLine:";
  "\UF72B"  = "moveToEndOfLine:";
  "$\UF729" = "moveToBeginningOfLineAndModifySelection:";
  "$\UF72B" = "moveToEndOfLineAndModifySelection:";
}

Reference: http://www.evansweb.info/2005/03/24/mac-os-x-and-home-end-keys/

Make Home / End key move the cursor to the beginning / end of line on Mac OS X

install matplotlib on mac

If it fails to install matplotlib on mac because the compiler cannot locate some freetype header files, and if you don’t have freetype, then first install it using brew for instance:

brew install freetype

Odds are the compiler still complains when you try the installation second time.

The reason is that many libraries are installed under /usr/X11 on mac, and they are not correctly located at compile time due to the non-canonical location. If you’re using pkg-config, an easy way to use them is to include the package database there in /usr/X11 when locating headers and libraries using pkg-config. Export the following variable before compiling matplotlib:

export PKG_CONFIG_PATH=/usr/X11/lib/pkgconfig

then

pip install matplotlib
install matplotlib on mac

Create an audio CD image on Mac

On Mac, it is easy to create a CD image using Disk Utility. On recent versions of Mac OS, however, it is disabled to create images of audio CDs—the function is grayed out in the menu when you insert an audio CD. In order still to create an image from an audio CD, there are a couple of ways on the command line.

1. hdiutil

hdiutil is the command line version of Disk Utility. Run the following command to create the CD image:

hdiutil create -srcdevice /dev/diskn -format UDTO image.iso

Replace n with the correct disk number, which can be found using diskutil:

diskutil list

2. dd

dd is a low-level file copy utility which is oblivious of the type or the content of file. As in Unix-based OS every device is a file, you can copy a “file” corresponding to a drive to a normal file:

dd if=/dev/diskn of=image.iso

You will need to unmount the drive before copying it:

sudo umount /dev/diskn

Note:

When creating an exact copy of a (data) CD/DVD using Disk Util, select the “device” instead of the “folder” within the device. And use DVD/CD-R master as the format.

By default, Mac assigns the file extension of .cdr, which is exchangeable with .iso.

If you want to create a cross-platform data CD image using hdiutil:

hdiutil makehybrid -iso -joliet -o image.iso /input/path

References:

http://superuser.com/questions/85987/mac-os-x-best-way-to-make-an-iso-from-a-cd-or-dvd

man pages, e.g., man hdiutil or https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/hdiutil.1.html

Create an audio CD image on Mac

Mouse wheel scrolling with GLUT on Mac OS X

In order to use wheel scrolling event with GLUT on Mac, you should patch the GLUT source code and compile it. The Mac-version GLUT source code is available here on Apple’s developer website. After unzipping, modify or patch the source code appropriately referring to this page. In my MacBook Pro running Lion, I had to use the old Xcode 3 to compile the code. I modified the project settings so that it uses GCC 4.0 as the C/C++ compiler instead of the default GCC 4.2, and rolls back the base SDK to the old Mac OS X 10.5. Then I release built the code and replaced the resulting framework with the existing /System/Library/Frameworks/GLUT.framework after making a backup of course ;).

Now it should send the mouse *up* events having button values of 3 or 4, respectively for wheel up and down.

Mouse wheel scrolling with GLUT on Mac OS X