I need to typeset a single Vietnamese word in my otherwise English document. My document is in Palatino, which doesn't support T5, so after I switch to T5, it uses a different font. So far, this is the same problem as described in this question. However, there the solution was to change the main font to TeX Gyre Pagella. I'd like to apply that solution locally, i.e. use TeX Gyre Pagella just for this one word.
\documentclass{memoir}
\usepackage[T1,T5]{fontenc}
\usepackage{fontspec}
\usepackage[defaultsups]{newpxtext}
\usepackage[english,vietnamese]{babel}
\newfontfamily\vnfont{TeX Gyre Pagella}
\begin{document}
Nguyen
\noindent
{\fontencoding{T5}\vnfont\selectfont{}Nguy\~\ecircumflex{}n}
\end{document}
However, this fails with:
LaTeX Error: Command
\ecircumflex
unavailable in encodingTU
.
If instead I write \vnfont\fontencoding{T5}
, then the latter overrides the former and I get the non-Palatino-looking font.
Best Answer
Since you are loading
fontspec
, I presume you are using eitherxelatex
orlualatex
. In such a case, don’t loadfontenc
and declare the font forvietnamese
in the following way: