0

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.

2 Answers2

2

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

\documentclass{article}  % added
\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

Peter Wilson
  • 28,066
1

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}

enter image description here

Ulrike Fischer
  • 327,261