I have the files for The Preppy Lion books in a folder on my hard drive that’s gone through moves from who knows how many computers since around 1990ish and I found a letter to an editor at Springer-Verlag from November 1992 with this gem of a sentence:

Because LATEX 3 is likely to appear in approximately two years, the latter volumes are currently at a low priority.

Also, loads of old stuff for volumes 2, 3 and 5 that I’d forgotten about.

I had a bit of a shock while looking over a section of my book on typesetting special characters to discover that my example of how to typeset a four-dot ellipsis in LATEX was coming out like:

This….

when I was pretty sure it was supposed to look like:

This....

 It was pretty easy to discover that this was because in XeLATEX (and LuaLATEX), \ldots was no longer typesetting spaced dots but using the Unicode … character instead. The appearance, as evidenced above is quite different and the Unicode character doesn’t compose nicely with a following period (as required by some styles, most notably MLA, but some others as well—the example made it into the book originally because it was repeatedly asked about when I was teaching LaTeX classes back in the 80s/90s).

With some digging into source2e.pdf, I turned up \UndeclareTextCommand which lets me undo this. It’s just a matter of adding 

\UndeclareTextCommand{\textellipsis}{TU}

to my document class to get the intended result and my ellipses are returned to normal. Unfortunately, I’ll also need to include a mention of this into a sidebar for those who might encounter this edge case on their own.

Update: While writing the text for the book, I discovered that the sequence …. came out almost correct in Monotype Ehrhardt (the spacing is still a little uneven, but not as dramatically so as with Latin Modern), which made it a little complicated to write the sidebar. I had to switch to Latin Modern for those ellipses to illustrate the problem. It looks fine on the blog too. Latin Modern’s ellipsis is broken!

I just posted the table of contents of the book on the site, but I ended up spending a day fiddling with things to enable me to print the LATEX logo formatted in the fancy way. For the table of contents, this was pretty straightforward: Add some CSS to the site, and since the table of contents is generated automatically from the .toc file, it’s a simple matter to replace \LaTeX with LATEX (do your own view source to see the ugly details). But then I wanted to put this into the site’s tagline and also in the page title. I spent about a day digging into how WordPress works to find where I could add a PHP function to keep all the ugly HTML/CSS from being printed literally, but then when it came to the page title, I realized I had a new problem. The PHP solution felt fragile to me. So instead, I ended up adding a bit of JavaScript to find the string LaTeX in a page title and replace it with LATEX. A day spent on aesthetics instead of writing.

As I’m working on The Preppy Lion, I was not happy with how the LaTeX logo was being typeset in the main body typeface that I’m using, Monotype Ehrhardt. I decided to make some small adjustments to the spacing and decided that I also wanted to make slight variations if the logo was being typeset in bold or italic or bold italic. The catch was being able to identify what the current font was.

This should be simple. I could simply compare \f@shape to \itdefault or \f@series to \bfdefault. Problem solved right?

So I did the following in my code:

\ifx\f@shape\itdefault
   italic code
\else
   non-italic code
\fi

and discovered that it didn’t work.

I typeset the values of \f@shape and \itdefault and they looked the same. So I turned to some TeX debugging skills and typeset \texttt{\meaning\f@shape} and \texttt{\meaning\itdefault} instead and discovered that \itdefault was defined as a long macro thanks to having been defined in latex.ltx with \newcommand{\itdefault}{it} instead of \newcommand*{\itdefault}{it}. I suspected that this might be a subtle bug in LaTeX, did the workaround of adding \renewcommand*{\itdefault}{it} to my class file and started working on the bold adjustments.

These also weren’t working. I’d done the same \renewcommand magic for \bfdefault but something was still wrong. It appeared that the fontspec package was adding \@empty to the end of the \bfdefault definition.

The old-school way to deal with this would be to write something like:

\edef\next{\bfdefault}
\ifx\f@series\next ...

but this was ugly. It turned out though, while digging through the fontspec code in search of where the \@empty was being added that there was a simpler approach. The expl3 macros provide a way to compare the fully expanded definitions of two macros with the \str_if_eq:eeTF command. I ended up creating two utility macros to handle the checks for bold and italic as:

\DeclareDocumentCommand{\ForIt}{ mm }
   {
      \str_if_eq:eeTF
        \f@shape
        \itdefault
        {#1}
        {#2}
   }


\DeclareDocumentCommand{\ForBf}{ mm }
   {
      \str_if_eq:eeTF
        \f@series
        \bfdefault
        {#1}
        {#2}
   }

and was able to make my adjustments without difficulty afterwards.

While working on the manuscript for the book, I noticed that one of my page headings was being rendered as

Putting together a document—part i

thanks to my writing “part I” using a small caps i for the “I.” I was also getting an annoying warning on every odd page:

LaTeX Font Warning: Font shape `TU/EhrhardtMTStd(0)/m/scit' undefined
(Font)              using `TU/EhrhardtMTStd(0)/m/sc' instead on input line 12.

Monotype Ehrhardt does not have an italic small caps and normally I would shun the use of obliquing against the designer’s wishes but here it was going to be a limited case of a single character which, if it were to exist would be obliqued (in fact, other than losing hinting, there’s not a strong argument against using a mechanical oblique for italic small caps, especially not for a small caps I). The catch was how to persuade fontspec to let me do this.

It took a bit of digging through the documentation of fontspec to figure this out (most of the discussion on the topic on Stack Exchange was to express horror at fake italic small caps), but I eventually managed to get the desired result which I present here for anyone trying to solve this particular problem:

\setmainfont[Numbers=OldStyle,Mapping=tex-text,
    ItalicFeatures=
       {
           SmallCapsFont={Ehrhardt MT Std},
           SmallCapsFeatures={FakeSlant=0.2, Letters=SmallCaps}
       }
   ]{Ehrhardt MT Std}