How do I use \renewcommand{\familydefault}{}
to use the times new roman font every where. I am using the scrreprt
document style, which has the sans-serif font in the chapter headings.
\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\addtokomafont{disposition}{\rmfamily}
\begin{document}
\section{Foo bar baz}
foo bar baz
\end{document}
You cannot use \renewcommand{\familydefault}{}
to change the font used in section headings because that will just change the default family which is TNR in any case if that's what you are using. Instead, you need to use the facilities provided by the class you are using for formatting headings.
I don't use these classes but according to the user manual, the command you want is probably:
\setkomafont{disposition}{\rmfamily}
See p. 93 for details. This should change the font family used for all headings in the document - chapter, section, part etc. (as appropriate to the class you are using - obviously they don't all provide chapter, for example).
If this does not do what you want and you cannot figure it out from the documentation, please post a Minimum Working Example showing what you have tried and explaining how the output differs from what you need.
There are some choices.
\usepackage{mathptmx}
\usepackage{mathptmx,tgtermes}
\usepackage{stix}
\usepackage{newtxtext,newtxmath}
Of these, the ones that load mathptmx
are the less desirable, because the math support is very limited (and some symbols are really bad). The difference in 2 is that a slightly better text font is loaded.
My preference would go to stix
or newtx
. Note that the full package of the STIX fonts has been made available for TeX Live just a few days ago.
For the titles using \sffamily
, the standard remedy in Koma-Script classes is
\addtokomafont{disposition}{\rmfamily}
Example
\documentclass{scrreprt}
\usepackage{stix}
\addtokomafont{disposition}{\rmfamily}
\begin{document}
\chapter{A chapter}
\section{A section}
\subsection{A subsection}
Some text and a formula $E=mc^{2}$ and
\[
\int_{-\infty}^{\infty}e^{-x^2}\,dx=\sqrt{\pi}
\]
\end{document}
The same with \usepackage{newtxtext,newtxmath}
The same with \usepackage{mathptmx}
\setkomafont{disposition}{\rmfamily}
is useful, but it made the heading appear without their boldface. This one did the trick:
\renewcommand{\sectfont}{\normalfont\bfseries}
-
It has reasons, why both egreg and Herbert use
\addtokomafont
. So the existing definition is not overwritten, only the switch, where you actually add the new definition. But one could also use\setkomafont{\normalfont\rmfamily\bfseries}
. I would add a\large
or\Large
, though, depending on the font. – Speravir Jan 21 '14 at 2:26