# Overwrite used font

I'm using a a Package, which uses a special font I don't own. (The package is a beamer-style)

In the .sty-file there are lines like \renewcommand{\sfdefault}{xyz} and several times \usefont{T1}{xyz}{m}{n} (or other).

Is there a way to replace every xyz by abc without doing is manually?

• Is there a reason you can’t open the .sty file in a text editor (or even in Word) and then search and replace-all? Or is that what you mean by manually? – Sandy G Nov 13 '17 at 5:26
• This is what I mean by "manually". I was curious if it's possible to to something like \renewcommand{xyz}{abc} – Ben Nov 13 '17 at 5:53
• How many instances of xyz are there? Two or three, or dozens and dozens? – Mico Nov 13 '17 at 6:24

You can specify a font substitution for the font you don't have to one you do, here I make xyz family use the cm DunHill font.

\documentclass{article}

% Substitute cm DunHill in place of font xyz at all sizes
\usepackage[T1]{fontenc}
\DeclareFontFamily{T1}{xyz}{}
\DeclareFontShape{T1}{xyz}{m}{n}
{<->sub*cmdh/m/n}{}

\begin{document}

\usefont{T1}{xyz}{m}{n} hello world

\end{document}

• Thanks. Two bonus questions: 1) can this be done without causing the warning LaTeX Font Warning: Font shape 'T1/xyz/m/n' in size <10> not available. (Font) Font shape 'T1/cmdh/m/n' tried instead on input line 15. 2) To substitute all font shapes I think I have do "copy" the declaration each time? – Ben Nov 13 '17 at 15:02
• @Ben use ssub instead of sub then the warning just goes to the log yes at this level there are no wildcards so you need one with each shape, though as I said in a comment under the question you always have the option of redefining \usefont to do anything at all. – David Carlisle Nov 13 '17 at 15:09