Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to know, how should I configure so that my latex configuration will set as follow:

  • For sections and sub-sections, the font is san-serif.
  • For contents, the font is Computer Modern and Latin Modern

I'm specifically interested in configuring like one article in this link regarding the fonts used.

How to set it in my preamble, so that I don't need to configure it over and over.

share|improve this question
add comment

4 Answers

up vote 4 down vote accepted

For standard document classes (e.g. article), use titlesec package or sectsty pacakage:

\documentclass{article}
\usepackage[sf,bf]{titlesec}
\usepackage{lmodern}

\begin{document}
\section{Test}
Blah bla.
\end{document}

or

\documentclass{article}
\usepackage{sectsty}
\allsectionsfont{\sffamily}
\usepackage{lmodern}

\begin{document}
\section{Test}
Blah bla.
\end{document}
share|improve this answer
add comment
\documentclass{scrartcl}
\usepackage[ansinew]{inputenc} %adjust
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\begin{document}
\section{Blub}
text text text

\end{document}

Read the documentation of the class (scrguide) to learn how to change the settings.

share|improve this answer
add comment

If you really want no configuration in the document class then you can define your own class. The following is based n Ulrike's solution. Save it in a file called myclass.cls.

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myclass}[2012/02/14 Shah's Class]

\DeclareOption*{%
  \PassOptionsToClass{scrartcl}{\CurrentOption}%
}
\ProcessOptions\relax

\RequirePackage[ansinew]{inputenc} %adjust
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern}

\LoadClass{scrartcl}

Now you can use it as follows:

\documentclass{myclass}

\begin{document}
   Hello world.
\end{document}

any options passed to myclass will be forwarded to the scrartcl class.

share|improve this answer
add comment

Have a look on the titlesec package. There are many opportunities for a change of the headline's layout.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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