# I intend to change only the font of a line using LaTeX Font Catalogue, but the whole of document will be changed [duplicate]

While I intend to change the font of only a line in the document using one of the fonts presented in the LaTeX Font Catalogue (https://tug.org/FontCatalogue/mathfonts.html) (for example, concmath: https://tug.org/FontCatalogue/computerconcrete/), but the font of the whole of document will be changed.

I do as follows:

\usepackage{concmath}
\usepackage[T1]{fontenc}
\newenvironment{concmath}{\fontfamily{concmath}\selectfont}{\par}

\begin{document}
The font of this text must be remained as it is by default.
\begin{concmath}
I want to change only the font of this line using one of the fonts in The LaTeX Font Catalogue.
\end{concmath}
The font of this text must be remained as it is by default.
\end{document}


P.S. I am using LNCS as template and TeXstudio as editor.

If you look into concmath.sty you will find a line \renewcommand{\rmdefault}{ccr}. This gives you a clue about the family name of the font.

\documentclass{article}  %
\usepackage[T1]{fontenc}
\newenvironment{concmath}{\fontfamily{ccr}\selectfont}{\par}

\begin{document}
The font of this text must be remained as it is by default.
\begin{concmath}
I want to change only the font of this line using one of the fonts in The LaTeX Font Catalogue.
\end{concmath}
The font of this text must be remained as it is by default.
\end{document}


• It works. But, now another problem: after \end{concmath}, a new paragrapg is generated. How to continue in the same line after \end{concmath} ? Thanks Feb 11 '20 at 10:50
• Don't use a \par in the environment if you don't want it (it was from your example). Feb 11 '20 at 10:52
• Yes, I removed \par and it is now like this: \newenvironment{concmath}{\fontfamily{ccr}\selectfont} , but yet a new paragraph is created after \end{concmath} , strange! Feb 11 '20 at 10:59
• there is no paragraph, but you should probably use {\ignorespaces} as the second argument. Feb 11 '20 at 11:01
• Yes, it works. Thanks Feb 11 '20 at 11:03

I have extended your MWE so that it is compilable by adding documentclass{article} as the first line.

% fontprob.tex SE 527806  local font change

\usepackage{concmath}
\usepackage[T1]{fontenc}
\newenvironment{concmath}{\fontfamily{concmath}\selectfont}{\par}

\begin{document}
The font of this text must be remained as it is by default.
\begin{concmath}
I want to change only the font of this line using one of the fonts in The LaTeX Font Catalogue.
\end{concmath}
The font of this text must be remained as it is by default.
\end{document}


Processing this does typeset with a different font within the concmath environment while not changing fonts outside that.

However there were warning messages such as:

  LaTeX Font Warning: Font shape T1/concmath/m/n' undefined
(Font)              using T1/cmr/m/n' instead on input line 10.
`

Perhaps your problem is with the LNCS template (whatever that is and however you have used it) and maybe other code you haven't shared. GOM

• Thank you. I’m going to test your code tomorrow and share the result here. Feb 10 '20 at 19:47