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?

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

4 Answers 4

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

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

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

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

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.
http://tex.stackexchange.com/questions/3267/how-can-i-define-a-series-of-different-font-styles-for-use-in-a-document-like-a?answertab=oldest
tex.stackexchange.com
crawl=CC-MAIN-2015-35
88989
application/http; msgtype=response
sha1:URKVWJS7XPQHTJ5PDEBZU2DRWBR7M6DN
<urn:uuid:4c88def2-94ab-4458-aded-eec5b44facfa>
2015-08-30T06:16:07Z
104.16.16.128
sha1:MGQINWW4XPFOH3YXNPZB3VWIHR3S3SUE
<urn:uuid:8785bfd6-27e5-4a9f-856e-8560b4143697>
http://tex.stackexchange.com/questions/3267/how-can-i-define-a-series-of-different-font-styles-for-use-in-a-document-like-a?answertab=oldest
length
response
<urn:uuid:8e9a84be-026f-4c77-873e-8877becb3ffc>
robots: classic
hostname: ip-10-171-96-226.ec2.internal
software: Nutch 1.6 (CC)/CC WarcExport 1.0
isPartOf: CC-MAIN-2015-35
operator: CommonCrawl Admin
description: Wide crawl of the web for August 2015
publisher: CommonCrawl
format: WARC File Format 1.0
conformsTo: http://bibnum.bnf.fr/WARC/WARC_ISO_28500_version1_latestdraft.pdf