0

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?

  • 2
    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
  • well of course you can do \renewcommand\usefont[4]{hello} or \renewcommand\usefont[4]{\bfseries} or whatever you want, but whether that only has an effect where you want it to have an effect depends on details in the document. – David Carlisle Nov 13 '17 at 9:38
  • Defining \renewcommand\usefont[4]{hello} or \renewcommand\usefont[4]{\bfseries} is complete non-sense, isn't it? Since the first one prints "hello" at the start of the document and every time a different font is used; and the second one just sets the whole text after a font change to bold – Ben Nov 13 '17 at 15:55
6

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.

enter image description here

\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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.