2

Suppose I want to set a font that is universal in the article, report or book document class (such as Times New Roman) but have specific sections that I want to use a different font. How would I go about that? Would this require the mini-page environment? Or would a command to tell LaTeX where one font stops and another begins would suffice?

Here is an example to illustrate my question

\documentclass{article}

\usepackage{blindtext}

\usepackage[T1]{fontenc}
\usepackage{accanthis}
\usepackage{newcent}
\usepackage{tgcursor}

\begin{document}

%This first part should be in the default `Times New Roman`
\blindtext

\section{New cent}
%I want this section in `Newcent` Fant

\fontfamily{newcent}
\blindtext

\section{Accanthis}
%This section in `accanthis`

\fontseries{accanthis}
\blindtext

\section{Typewriter}
%This in `typewriter`

\fontfamily{tgcursos}
\blindtext

\end{document}

1 Answer 1

2

It appears that you are using pdfTeX with type1 fonts (not XeTeX, not LuaTeX): what follows assume this.

To set Times New Roman as the default font, load the newtxtext package. However, if you load other font packages after it, they might overwrite the default; so:

  • either load newtxtext as the last font package,

  • or do not load other font packages at all.

In particular, you can define “by hand” the commands you need to select other font families. If you issue those commands inside a group, the default font will be restored when the group ends.

MWE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{newtxtext}

\usepackage{blindtext}

\newcommand*\accanthisfamily{%
    \fontfamily{AccanthisADFStdNoThree-LF}\selectfont
}
\newcommand*\newcentfamily{\fontfamily{pnc}\selectfont}
\newcommand*\tgcursorfamily{\fontfamily{qcr}\selectfont}



\begin{document}

%This first part should be in the default `Times New Roman`
\blindtext

The current (external) font name is ``\fontname\font''.

\section{New cent}
%I want this section in `Newcent` Fant

\begingroup
    \newcentfamily

    The current (external) font name is ``\fontname\font''.

    \blindtext

\endgroup

\section{Accanthis}
%This section in `accanthis`

\begingroup
    \accanthisfamily

    The current (external) font name is ``\fontname\font''.

    \blindtext

\endgroup

\section{Typewriter}
%This in `typewriter`

\begingroup
    \tgcursorfamily

    The current (external) font name is ``\fontname\font''.

    \blindtext

\endgroup

Back to default font.

The current (external) font name is ``\fontname\font''.

\end{document}

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.