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 am completely new to Latex so forgive me if this is a stupid question.

What I want to be able to do is specify a number of different font styles for use in different parts of my document. So for example, I might create a style called title which uses Helvetica Black at 14pt, and a style sub-title that uses Helvetica Condensed at 12pt, and a body style that uses Tahoma at 10pt in 80% grey. I would then just label the various bits of my document.

I am currently using XeLaTeX, like so:

\usepackage{xltxtra}
\setmainfont[Mapping=tex-text]{Tahoma}
\begin{document}

But this just gives me one font throughout and then the document styles the headers etc, I don't get a chance to use a different type face, or take fine grained control. I'm probably missing something here, but I'm sure what I'm asking is possible?

Thanks

share|improve this question
    
Are you sure that this is a good idea? The many fonts style is perhaps encouraged by word processors in which you "paint" your document. But, the results are rarely aesthetically pleasing. –  vanden Sep 19 '10 at 21:57
add comment

4 Answers

xltxtra automatically loads the fontspec package (which is actually where \setmainfont comes from), which gives you as much fine grained control over fonts and font options in xelatex as you could possibly want. Read its documentation. In particular, the \fontspec and \addfontfeatures should cover you.

If you want to set styles for the headings at various levels, etc., however, considering using a package like titlesec or sectsty. Again, their documentation will give you more info than I can give here. (Most likely, you'll want to use \fontspec commands along with these.)

share|improve this answer
    
thanks, this looks good.. –  flesh Sep 19 '10 at 16:04
    
@flesh: You have several questions for which you seem to found a good answer (based on your comments). You should accept the answers by clicking on the check mark next to them. For the other questions, if the given answers aren't sufficient, you should refine your question and say why they are not what you're looking for. –  TH. Sep 25 '10 at 11:06
add comment

Use \newfontfamily command, check the documentation for more details:

\documentclass{article}
\usepackage{fontspec}

\newfontfamily\MyTitle[Ligatures=TeX]{TeX Gyre Pagella}
\newfontfamily\FooBar[Numbers=OldStyle]{Foo Bar}

\begin{document}
{\MyTitle some text} {\FooBar other text}
\end{docment}
share|improve this answer
add comment

It feels from your question that you're coming from another class of text processors.

LaTeX is (approximately) a semantic markup system where the structure of your document defines the reslutant layout and typography. Thus, rather than saying "define chapterfont as 10pt Helvetica Small Caps" and then using "select chapterfont", this tends to be hidden much more behind the scenes.

Typically, you might say

\chapter{Loomings}

which would, as well as printing the chapter title in its own layout and font, make a TOC entry, set up a page header, skip to an odd page...

The tailoring of this stuff would (obviously) normally be done in the preamble.

If you're new to LaTeX, you might want to consider investing your time in one or more of these packages:

memoir for general book/article/report tailoring, with extensive incorporation of many other useful LaTeX packages, but all documented in two big books

beamer for presentation material

pgf/tikz for diagramming

With these three (admittedly large) packages under my belt, only very rarely do I feel the need to look for anything else. It's a big learning hump, yes, but once you've got a bit of the way, there are only three manuals you need to search, and usually you know which one of them is relevant.

Please forgive me if this answer appears patronising, as that is definitely not my intention; I hope you'll get to love LaTeX as much as most of us who hang out here do.

share|improve this answer
add comment

The KOMA-Script classes have a dedicated interface for fonts:

\newkomafont{abc}{\large\bfseries}
...
\usekomafont{abc}

Otherwise you can just use \newcommand:

\newcommand*{\abc}{\large\bfseries}
...
\abc
share|improve this answer
    
I also recommend the KOMA-Script-classes - one of their main advantages is the costumization of font attributes. –  lockstep Sep 19 '10 at 16:09
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.