Tuesday, November 22, 2011

And The Winner Is... TeX Live

Well, after all that rubbish I went through earlier in the day, finally some results! TeX Live installed correctly the second time. Of course it decided to place itself in the root of C: drive, not where nice-behaving apps should go. But I'll see if I can re-locate it later.

Right now, it's down to the business of laying out equations. In this follow-up article I will compare renderings of two LaTeX engines and three typefaces.

First, some more fiddling. I needed to update the compilation paths in my editor TeXstudio to point to the new installation. Then I created some shortcuts to make life easier. The F1 key now compiles the layout code using the pdfTex engine; F2 does the same for the XeTeX engine. Both steps result in a PDF that gets auto-displayed using the editor's built-in PDF reader. It's almost possible to forget everything is being done on the command line. It's WYSIWYG with a small delay built in.

Here's what the older pdfTex engine produces using the default Computer Modern Roman typeface. It's thin and far too light. (Click to see at 100%.)



Here's the same pdfTex engine with Utopia Regular (with Math Design) as illustrated at the FontCatalogue. It's very much nicer. The text is more compact and tracking seems massively improved. The justified lines flow with a great deal more visual appeal.



Finally, here is the XeTeX engine rendering the Cambria typeface that came with Windows 7 (and Vista). The advantage of this approach is that any and all system fonts you may already have are at your disposal. You can exactly match LaTeX documents to others you may produce using different tools. This is a far more compatible and flexible approach.



Cambria is lighter optically than Utopia but is easy to read both on the screen and on the page. I am a big fan of the "C" fonts Microsoft had designed for Windows. Certainly they are head and shoulders above previous offerings. I even prefer them to anything Apple has given us. Cambria, Calibri and Consolas all get used a fair amount.

But I have to say that for mathematics this version of Utopia is superior. Maybe I need to find something better than Calibri for this application. At least now I have the entire world of Type 1 and OpenType to choose from!

For those of you interested in the internals, here is the conditional section of my .tex file, found near the head. It's set up so either engine works properly.

\ifxetex
 \usepackage{fontspec}
 \setmainfont{Cambria}
\else
 \usepackage[utf8]{inputenc}
 \usepackage[T1]{fontenc}
 \usepackage[adobe-utopia]{mathdesign}
\fi
And here is the section of the document on display.

Usually you will want brackets that size automatically, so 
use \textbackslash left and \textbackslash right. Here are 
examples with and without using these commands:
$$(\frac{x^2}{y^3})$$
$$\left(\frac{x^2}{y^3}\right)$$

If you want a solved equation to format nicely, use the 
"eqnarray" block, or "eqnarray*" if you do not want line 
numbers. If you only want to suppress certain numbers, use 
the former but put \textbackslash nonumber before the line-
ending double slash on those lines you want blank.

\begin{eqnarray*}
  10xy^2+15x^2y-5xy & = & 5\left(2xy^2+3x^2y-xy\right) \\
   & = & 5x\left(2y^2+3xy-y\right) \\
   & = & 5xy\left(2y+3x-1\right)
\end{eqnarray*}
You can perhaps see why I want to use LaTeX. After learning the syntax, editing equations in this manner is far preferable to other methods.

(If this has helped you save time then consider donating using the PayPal link in the sidebar.)

RELATED POSTS

1 comment:

robin said...

P.S. If you are on a Mac you likely want the MacTeX distribution, since it is based on TeX Live.

Post a Comment