Tuesday, April 22, 2008

Leopard and MacTeX

Leopard's on the MacBook. TeXShop still loads and runs. But typesetting in the TeXShop GUI complains about latex2pdf missing. So some underlying MacTeX components went missing in the upgrade from Tiger to Leopard.

The solution was to (re)install MacTeX from the site. The catch being that the .dmg is 744M.

Tuesday, April 15, 2008

Mixed French, German & English LaTeX

Unicode characters enter easily into any LaTeX document using inputenc correctly. But different languages style and space punctuation and other typographic elements differently. The LaTeX babel package and the \selectlanguage command account for typographic differences between languages.

\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[german, french, english]{babel}

\begin{document}
\begin{enumerate}
\item \selectlanguage{english} Taken together ...
\item \selectlanguage{french} Cette combinaison ...
\item \selectlanguage{german}Zusammen ...
\end{enumerate}
\end{document}




So multilingual LaTeX documents require two things. The LaTeX inputenc and babel packages. And repeated calls to the \selectlanguage command inline.

Tabloid landscape in LaTeX

The geometry package initializes LaTeX tabloid landscape documents in one line.

\documentclass[10pt]{article}
\usepackage[papersize={17in, 11in}]{geometry}
\begin{document}
This document is in tabloid landscape.
\end{document}

CTAN offers other page sizing packages.

Using LaTeX setstretch

LaTeX single spaces text by default.

\documentclass[10pt]{article}


\begin{document}
`Curiouser and curiouser!' cried Alice ...
\end{document}




LaTeX offers different line spacing options. The setspace package implements \setstretch.

\documentclass[10pt]{article}
\usepackage{setspace}
\setstretch{1.4}

\begin{document}
`Curiouser and curiouser!' cried Alice ...
\end{document}




The sort of scaling factor mirrors the idea of single- and double-spacing but differs from type leading.

Setting LaTeX docs to Palatino

LaTeX documents set text by default in the Computer Modern Roman, Computer Modern Sans Serif and Computer Modern Monospaced font families.

\documentclass[10pt]{article}

\begin{document}
\begin{list}{ }{ }
\item Whan that Aprille with his Shoures soote ...
\item \textsf{Whan that Aprille with his Shoures soote ...}
\item \texttt{Whan that Aprille with his Shoures soote ...}
\end{list}
\end{document}




The palatino package changes all three font families.

\documentclass[10pt]{article}
\usepackage{palatino}

\begin{document}
\begin{list}{ }{ }
\item Whan that Aprille with his Shoures soote ...
\item \textsf{Whan that Aprille with his Shoures soote ...}
\item \texttt{Whan that Aprille with his Shoures soote ...}
\end{list}
\end{document}




Prebuilt packages like palatino do not exist for all fonts.

Friday, April 11, 2008

Invoking lilypond-book

A minimal LaTeX file contains these four lines.

\documentclass[10pt]{article}
\begin{document}
hello!
\end{document}

A minimal lilypond-book file contains these seven lines.

\documentclass[10pt]{article}
\begin{document}
hello!
\begin{lilypond}
\new Staff { c'4 }
\end{lilypond}
\end{document}

The lilypond context inserts in .tex documents directly.

Process lilypond-book docs like this.

lilypond-book --pdf --output=out test.tex
cd out
pdflatex test.tex
open test.pdf

Invoking lilypond-book with the --pdf option tells lilypond-book to generate a postprocessed version of test.tex named test.tex together with a number of helper files necessary to create some final .pdf.

Note that invoking lilypond-book with the --pdf option does not tell lilypond-book to create a .pdf directly; further processing with pdflatex is still required.