# Borrowing accents from a different font

I’m setting the body of my LATEX book in Monotype Ehrhardt. I have a long sentimental attachment to this typeface and I’m on my second purchased copy of the face (I bought it originally in PC Type 1 format and now I have the Opentype version on my Mac). Unfortunately, I decided to cheap out and I didn’t buy the Pro version of the font since I figured I wouldn’t need the Eastern European accents. Oops, it turns out that I do kind of want to have access to hačeks and also the macron accent for a section where I talk about mahāprañāpāramita. But how to get these? Well, the macron accent wasn’t even present in the font, giving a missing character symbol where the accent should appear, so I decided, given its typographic simplicity, that I’d “borrow” it from Latin Modern which I knew had the character.

The thing is, the \accent primitive is a finicky beast. As anyone who’s ever tried to do something like \’{\textbf{a}} would know, you can’t just throw anything inside an accent command. Instead, a more subtle approach is necessary. Thankfully, this already exists thanks to the \t accent. Here’s the definition from plain.tex:

\def\t#1{{\edef\next{\the\font}\the\textfont1\accent"7F\next#1}}

What’s happening here is that TEX saves the current font in the \next macro, changes to \textfont1¹ and issues the accent command and then returns the font to the saved font.² I ended up doing the following in my class file to give me access to the accent from Computer Modern (well, actually Latin Modern).

{\fontfamily{lmr}\selectfont\xdef\thelmrfont{\the\font}}
\def\=#1{{\edef\@tempa{\the\font}\thelmrfont\accent"0304\@tempa#1}}

I could have gotten away with replacing the whole song and dance around \thelmrfont by using \csname TU/lmr/m/n/10\endcsname  but I want the flexibility to adjust the font—I’m already thinking that changing the size to, e.g., 9.5pt might not be a bad idea to make the accent blend better with the provided ñ.

1. \textfont1 is math italic in plain TEX.
2. \the\font or \the\textfont1 expand to the command to load the appropriate font, which under LaTeX will be an otherwise difficult to obtain name like \TU/lmr/bx/n/10.