1

I have a .tex file and I want to use a particular font for a single word. So since I'm new to latex, what I'm doing is adding in the preample this

\usepackage[T1]{fontenc}
\usepackage[scaled=.85]{FiraSans}
\usepackage{newtxsf}

but clearly then it is applied to all the pdf document. How can I use this font for only a single word ? Thank you. (I'm using texmaker)

2
  • 1
    Welcome to TeX.SE. Please tell us whether you're open to using XeLaTeX or LuaLaTeX to compile your document.
    – Mico
    Dec 29, 2020 at 11:21
  • The newtxsf package doesn't choose a particular sans serif font. Which one would you like to get?
    – egreg
    Dec 29, 2020 at 13:22

2 Answers 2

3

A solution without loading the full font package:

\documentclass{article}

\usepackage[T1]{fontenc}
% \usepackage{newtxsf}  % from the question, not needed here.

\makeatletter
\newcommand*{\FiraSans@scale}{.85}
\makeatother

\newcommand*{\FiraSans}{%
  \fontfamily{FiraSans-LF}%
  \selectfont
}
\DeclareTextFontCommand{\textFiraSans}{\FiraSans}

\begin{document}
The single \textFiraSans{word} inside a sentence.
\end{document}

enter image description here

Remarks:

  • The font package FiraSans.sty supports the traditional Type 1 fonts and the newer OpenType fonts of XeTeX/LuaTeX. Since the file in the question uses \usepackage[T1]{fontenc}, the test file uses Type 1 fonts.

  • LF in the family name means "lining figures"; use "OsF" for "old-style figures".

  • Not relevant for a single word: a T at the end of the family name means that figures are intended to be used in tables and are therefore mono-spaced.

4
  • Your suggestion is better than mine, shall I remove mine?
    – MadyYuvi
    Dec 29, 2020 at 13:31
  • 1
    @MadyYuvi The question is not very clear, why a single word needs to be in a special font (logo?), therefore my suggestion does not change \textsf, and \sffamily unchanged. But if the text does not need other sans serif fonts, your suggestion is easier to use. Dec 29, 2020 at 13:39
  • Thank you both ,actually it's only one word because is a logo. I tried the two answers but the problem is that all the mathematical expressions change their font then, while I would like only one word to change the font. But maybe the question itself makes no sense.
    – RIXS
    Dec 29, 2020 at 16:06
  • @RIXS The font in math is changed by package newtxfs that you have explicitly added in your question. If you do not want the package, do not load it. It is not needed for using the font FiraSans for the logo. Dec 29, 2020 at 16:51
1

Hope this meets your requirement:

\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage[scaled=.85]{FiraSans}
\usepackage{newtxsf}

\begin{document}
\textsf{FiraSans}
\end{document}

Output

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .