[Tex/LaTex] Separate font for chapter and text

fonts

I need to use a serif font – eg Times (New Roman) or Palatino – for the main text and a sans serif font – eg Helvetica or Arial – for headings and labelling diagrams, etc.

How do I get this format ?

In my class file, I have this:

\RequirePackage{sectsty,caption}
\ifthenelse{\boolean{sansheadings}}
{\allsectionsfont{\sffamily}
 \renewcommand{\@chapterfont}{\sffamily}
 \renewcommand{\captionfont}{\sffamily}
 \renewcommand{\headfootstyle}{\normalsize\sffamily}}
{}

Ideally I want to use Tahoma or Verdana (sans serif) for chapter titles and
serif fonts (Charter or Palatino) in the remaining text. How do I get this?

Best Answer

With xelatex, the definition of fonts is done this way (at least I do it this way):

\usepackage{xltxtra}
    \setmainfont{Palatino}
    \setsansfont{Tahoma}

Concerning the titles, you're right by using the sectsty package. But there is a more efficient way to define the font to use for all title or just for chapter.

\usepackage{sectsty} % Allows your to change titles style
    \allsectionsfont{\sffamily \mdseries} % Define the style of all titles

If you only want to change the chapter title font:

\usepackage{sectsty} % Allows your to change titles style
    \chapterfont{\sffamily \mdseries} % Delete the bold style and set the sans-serif font

For further informations, you can read the documentation: http://texdoc.net/texmf-dist/doc/latex/sectsty/sectsty.pdf

For the captions, the caption package allows you to do some customisations by passing parameters.

\usepackage[font=sf]{caption}

Here again, the documentation gives some example of customization (e.g. if you just want the label to be sans-serif or the whole caption).

\documentclass[11pt]{article}
    \usepackage{xltxtra}
        \setmainfont{Palatino}
        \setsansfont[Scale=.9]{Tahoma}
    \usepackage{sectsty} % Allows your to change titles style
        \allsectionsfont{\sffamily \mdseries} % Define the style of all titles
    \usepackage[font=sf]{caption}
\begin{document}
    \section{Just a title}
        My paragraph with the content of my mind.

        \begin{figure}[h]
            \centering
            \LaTeX
            \caption{The logo of \LaTeX}
        \end{figure}

        The rest of what I want to say.
\end{document}

enter image description here