4

I'm using KOMA-Script and I would like to know how can I change the default font to FreeSans, or any other font-family? Also, how can I change all text to sans-serif?

  • 1
    I don't know about FreeSans. With regard to your second question: This should be of help. – lockstep Jun 14 '11 at 19:54
6

For fonts that are packaged for use with LaTeX, the Font Catalogue usually tells you how to use them.

If you specifically want to use FreeSans (which, as far as I know, has not been packaged for LaTeX), the easiest way is to use the fontspec package and XeLaTeX or LuaLaTeX.

% Compile with xelatex or lualatex.
\documentclass{article}
\usepackage{lipsum}% for testing

\usepackage{fontspec}
\setmainfont{FreeSans}

\begin{document}
\lipsum
\end{document}

example

4

I don't know about FreeSans, but if somebody has built a LaTeX package for your font, just loading the package should make that font the default sans-serif font. For example, add \usepackage{helvet} to the preamble of your document to change the default sans-serif font to Helvetica. To make the default sans-serif font the default font in your document, you need to additionally add \renewcommand{\familydefault}{\sfdefault} to the preamble.

In the rare case that there exists an .fd-file for your font but no LaTeX package, you need to look into that file for the LaTeX family name of this font and set the family manually by redefining \sfdefault. For example, the LaTeX family name for Helvetica is phv, so you can make Helvetica the default sans-serif font using \renewcommand*{\sfdefault}{phv}. (Additionally, it might be necessary to change the default font encoding.)

Finally, if there is no LaTeX support for your font and you do not want to switch to XeTeX or LuaTeX, there is the possibility to employ a tool such as autoinst to generate the necessary files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.