Suppose I wanted to use a different font for a title then the body text in LaTeX (pdflatex). (For example, if I wanted to use a slightly fancier font for titles, or a sans-serif one.) How would I do that, change the font of a class of thing throughout the document, in a proper way. (Likewise, if I wanted to change the document title, captions, etc. Is there a general way of doing this?)

  • ln `which xelatex` `which pdflatex` – Sean Allred Jun 27 '15 at 4:21
  • @SeanAllred Why? – cfr Jun 27 '15 at 12:55
  • @cfr Sorry about that – that kind of snark was the effect of two-years-expired cough syrup that I unwittingly took… My point was that there is little reason that I can think of to stick to pdftex especially when you want to do fancy things with your fonts. – Sean Allred Jun 27 '15 at 14:31
  • @SeanAllred I don't really agree, but my main point was that it wouldn't even work. – cfr Jun 27 '15 at 16:13
  • 1
    @SeanAllred I don't use other engines, since then I'll learn features I can't use when submitting to journals. If I only ever use PDFlatex I won't have that problem. – Canageek Jun 27 '15 at 18:21

The titlesec or sectsty packages are your friends for the standard classes. If you want some more control, try the komascript classes or memoir. See the UKTeXFAQ.

  • I suggest you broaden you answer by giving some code. – Sveinung Jun 27 '15 at 7:46
  • The OP made a rather broad question, so the broad general answer. – erreka Jun 27 '15 at 19:49

I would say that really much depends on what you are trying to achieve.

Do you want to make a class that others can use as well? You can define your own commands for sectioning. Are there just minor changes within one of your documents? Use package etoolbox and patch your changes. Are there bigger changes to the sectioning and titles? Package titlesec is commonly used with the standard classes.

KOMA-classes have their own way of defining the font for various instances of a document. The following example shows the interface.

Disclaimer: This is just for demonstration, nobody should use that many stuff in just one document.


\chapter{lazy Leguan}
\section{walzing wombat}
\captionof{figure}{A figure caption}

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.