Showing posts with label Fonts. Show all posts
Showing posts with label Fonts. Show all posts

Thursday, August 6, 2009

XeLaTeX 1,2,3...

I thought I'd explain how to get started with Xelatex as a three step process.

Firstly though..... why Xelatex?
  1. For arbitrary text and maths fonts in your document.
  2. Correct ligatures, kerning and other font features. This is only achieved in Latex using the microtype package, it is the default in Xelatex. See Beauty of Latex article.
  3. Easier to use arbitrary fonts.
  4. Unicode (UTF-8) encoding for special characters like international accents etc.
Step 1: Installing and Using Xelatex
Windows
: Xelatex can be found in Miktex 2.7 or above. Simply download and install Miktex Basic and install the xelatex package from the package manager. If any package is needed later on, Miktex will download and install it for you.
Linux: Install Texlive 2008 or above. Note that all versions of Ubuntu 9.04 and earlier have Texlive 2007. Download the Installer or the ISO file, burn the disc and run the install script ("install-tl"). See Texlive site for more detailed instructions. Go here to use Kile with Ubuntu after installing Texlive 2008.

Step 2: Using Xelatex
Using Xelatex is the same as using Latex. New to Latex? See this all you need guide. Create a new file and insert the following text into it.
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[a4paper]{article}

%XeLaTeX packages
\usepackage{xltxtra}
\usepackage{fontspec} %Font package
\usepackage{xunicode}

\title{Your Title}
\author{Your Name}
\date{\today}

\begin{document}

\maketitle

\section{Section Title}
Your text

\subsection{Subsection Title}
Your Text
\end{document}
Save the file with any name. Then using the command line type "xelatex [FileName].tex" where you file is, or in a text editor like SciTE or Texmaker click on the build button. Open and view the PDF file to see the result.

Step 3: Installing and Changing the Font
Changing the font is easy in Xelatex, just add the line "\setmainfont[Mapping=tex-text]{Fontname}" in your preamble (the space before the begin document line) with "Fontname" being the name of the Font. Any font installed on your system is applicable. See my post on Xelatex Thesis Choices for example of using Minion Pro fonts. For instance "Times New Roman" is comon on most systems. Use can see the fonts installed on your system using OpenOffice or any other font application.
Installing a font is easy too. Find and download a font you like (the hard part), see my font survey post to get some free and open ones, and extract if in archive.
Windows Vista: Right click on the TrueType (ttf) file(s) or OpenType (otf) file(s). Then select install. Thats it! To determine the name of the font, either look for it in OpenOffice, Wordpad or MS Office. Or double click to preview and the name is given in the preview.
Ubuntu Linux: Copy the TrueType (ttf) file(s) or OpenType (otf) file(s) to "/usr/share/fonts/opentype". If there is no opentype directory, create it.

That's it... you're good to go. Post any questions below.

Cheers
Shakes - L3mming

Saturday, August 1, 2009

Thesis Font: Baskerville

Having asked the opinions of some of my colleagues and my family (who are now quite sure I'm obsessed about fonts :D ) about the font choices, I have finally made the font choice for my thesis - Baskerville (or its open equivalent, see a sample).

The font has a great history starting from its inception in 1757, which makes it perfect for the type of I'm going for - a Classic font. Wikipedia says:

Baskerville is a transitional serif typeface designed in 1757 by John Baskerville (1706-1775) in Birmingham, England. Baskerville is classified as a transitional typeface, positioned between the old style typefaces of William Caslon, and the modern styles of Giambattista Bodoni and Firmin Didot.

The Baskerville typeface is the result of John Baskerville's intent to improve upon the types of William Caslon. He increased the contrast between thick and thin strokes, making the serifs sharper and more tapered, and shifted the axis of rounded letters to a more vertical position. The curved strokes are more circular in shape, and the characters became more regular. These changes created a greater consistency in size and form.

Baskerville's typeface was the culmination of a larger series of experiments to improve legibility which also included paper making and ink manufacturing. The result was a typeface that reflected Baskerville's ideals of perfection, where he chose simplicity and quiet refinement. His background as a writing master is evident in the distinctive swash tail on the uppercase Q and in the cursive serifs in the Baskerville Italic. The refined feeling of the typeface makes it an excellent choice to convey dignity and tradition.

The open alternatives include Baskervald from ADF Fonts, GFS Baskerville from Greek Font Society (which is Greek only, still good from Physicists/Mathematicians though. Map it to the XeLaTeX Greek fonts), Open Baskerville (UFO Font only.... don't know how to get to Opentype yet) and Boisk Font which is inspired by Baskerville. I will add more as I find them.

Cheers
Shakes - L3mming

Wednesday, July 29, 2009

A Font Survey...

I have recently been looking into Opentype fonts that I can use with XeLaTeX and in my thesis.

The first nice option is Minion/Myriad Pro combination (see previous post), but the fonts aren't open... just free for personal use. Another nice option is the Cambria/Cambria Math but there might be licensing issues since they require MS Windows on the Machine.

The free fonts with equivalent metrics to common fonts are another good option. There's a list of other free fonts also. Matching maths used to be a problem with XeLaTeX, though now the mathspec package makes this easy by allowing one to mix and match symbols and fonts together with simple commands (as shown in previous post for MnSymbol).

OpenOffice has some nice fonts install too... FreeSerif and Nimbus. Charis and Gentium are also good but don't have Small caps support. Fontin has won alot of praise but didn't blow me away. Asana Math doesnt have Italics.

I'm not satisfied by the current choices for math symbols either. Latin Modern (XeLaTeX default) math is nice, MnSymbol is ok and Cambria is very nice but not free.... sigh... the search continues.

Cheers
Shakes - L3mming

EDIT: Some more great links to font list.
Great set of GNU fonts is availble at ADF Fonts too. I'm looking forward for the official Science Publication Fonts.