# advanced typography with pdfLaTeX

I have been using LaTeX for several years now, but only a couple months ago did I start experimenting with pdflatex. Actually, most current LaTeX distributions use pdflatex as the default LaTeX engine, but if you use the latex command, then it will produce a .dvi file, which most people then convert to .ps and probably to .pdf. Using the pdflatex command produces pdf directly, thus skipping two steps. This is always a plus. However, there are many other benefits of using pdflatex, which I would like to talk about here.

### Including images

Including images with LaTeX has been possible (and easy) for quite some time, but it has been restricted to .eps files. While .eps is a vectorized (and thus high-quality and scalable) format, fewer and fewer programs will produce .eps (perhaps most notably Microsoft excel, which many unenlightened people use to make plots). In contrast, pdflatex allows inclusion of .png, .pdf, and .tiff files (and maybe a few others I am missing). It does not allow inclusion of .eps files, which at first was a major obstacle for me to switch, since I already had a bunch of .eps files laying around. It turns out that there is a very easy workaround to this though. Simply use the epstopdf package, and when you compile use the shell-escape option like so: pdflatex --shell-escape. Also, make sure that you do not include the file extensions for your graphics. What this does is it allows pdflatex to temporarily stop processing the document if no pdf version of the document is found and convert the eps file to a pdf using ghostscript. Most LaTeX distributions also include ghostscript by default.
 \documentclass{minimal} \usepackage{graphicx} \usepackage{ifpdf} %check if we are using pdflatex \ifpdf \usepackage{epstopdf} %convert eps to pdf on the fly \fi \begin{document} \includegraphics{foo} \end{document} 

One potential downside of using pdflatex regarding graphics is that pstricks does not work with pdflatex. This makes sense, since pstricks using postscript specials to make graphics, and pdflatex produces pdf directly. There are some supposed work arounds, but they all seem fairly complicated to me, and I have not tried them. I have chosen to use a different graphics package instead — tikz/pgf. This is a a newer package which can produce both .ps and .pdf files, and it has some very nice features. It is not quite as full-featured as pstricks yet, but it is in active development, and is constantly improving. The beamer package for making slides uses pgf for its graphics, which produces incredibly beautiful slides. I have written about pgf elsewhere on the blog, and will be writing about beamer in the near future.

### Micro-typesetting features

Another feature of pdflatex is the availability of so-called micro typesetting features. In fact, this is one of the major motivations of writing pdflatex (written by HÃ n ThÃª ThÃ nh for his thesis). Accessing these features directly is quite complicated, but fortunately there is the microtype package. There are two main features of the microtype package:

margin kerning
This involves allowing the text to protrude into the margin slightly. You’re probably thinking: “What?! That doesn’t make any sense! LaTeX gives me nicely justified text. Why would I want to ruin that?” Of course you are correct, but it turns out that even though LaTeX lines up text perfectly, it can appear slightly off, because of our human perception. Where this really comes about is in punctuation. Periods, commas, dashes and the like are generally much smaller characters than normal letters, so when such punctuation ends a line, it can seem that the line is slightly indented in the right margin. Microtypes margin kerning feature puts punctuation slightly in the margin, which gives the perception of a straighter line. The microtype package automatically has most standard punctuation defined for this purpose, but it is also possible to customize its behavior.
font expansion
This involves actually making the glyphs slightly wider than normal in order to avoid having to make the interword spacing too large. This is also done on the fly

As always, happy TeXing!