# unwanted text as part of font change

I have the following line:

{\fontencoding{T1}\fontfamily{Latin Modern}\fontseries{m}\fontshape{n}\selectfont P} is the total 2010 population in urban areas in Maricopa County or in sensitivity groups.


The output shows:

modern.fd Modern.fd P is the total 2010 population in urban areas for Maricopa County or in sensitivity groups.

I am not sure why the text "modern.fd Modern.fd" is appearing. Oddly, it only appears in the first instance of that line of code; i.e., I have repeated the line in different parts of the same .tex file, and in subsequent instances, it displays the "P" character in Latin Modern, as I intended.

You are looking for \fontfamily{lmr}:

\documentclass{article}

\begin{document}

{\fontencoding{T1}\fontfamily{lmr}\fontseries{m}\fontshape{n}\selectfont P} is the total 2010 population in urban areas in Maricopa County or in sensitivity groups.

\end{document}


The above can be simplified using \usefont:

{\usefont{T1}{lmr}{m}{n}P} is the total 2010 population in urban areas in Maricopa County or in sensitivity groups.


And, of course, if this is going to be used many times, you can define a command:

\documentclass{article}
\newcommand\myP{{\usefont{T1}{lmr}{m}{n}P}}

\begin{document}

\myP{} is the total 2010 population in urban areas in Maricopa County or in sensitivity groups.

\end{document}

• @Ramakan you're welcome! Don't forget that you can up-vote good answers and accept the one you consider solved your problem, by clicking the checkmark to its left. In case of doubt, please see How do you accept an answer?. – Gonzalo Medina May 31 '13 at 13:03