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'm using ConTeXt, with XeTex. So I'm compiling my document: texexec --xetex foo.tex

I would like to follow the convertion of having my headings all in Sans Serif, and my body text in Serif. I want to do this with my own fonts:

%&context
\definetypeface[BerlinSSDB][ss][sans][Berlin Sans FB Demi]
\definetypeface[Minion][rm][Xserif][Minion Pro]
\setupbodyfont[Minion, 12pt]

\setuphead[chapter][
    style=\ss,
    sectionnumber=yes
    ]

\setuphead[section][
    style=\ss,
    sectionnumber=no
    ]

\starttext

\chapter{Welcome}
A well known text, used to fill space.

\section{H. Rackham 1914}
But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness... But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?

\stoptext

Everything, headings, body and all is coming up in Minion Pro. This seems reasonable since no where have I told it what font to use, except to say "Use Minion". (I believe \setupbodyfont, uses the word body with a different meaning to what I have here.)

share|improve this question
    
This seems related: tex.stackexchange.com/questions/45853/…, but as someone new to ConTeX, and XeTex I can't see how to mesh in the XeTex font stuff with the ConTeXt style stuff –  Oxinabox Jul 20 '12 at 10:47
    
See also: tex.stackexchange.com/a/58153/5245 –  Marco Jul 20 '12 at 12:17
1  
Is there a reason for not using LuaTeX with MkIV? The simplefonts module would make font switching more easy. –  Marco Jul 20 '12 at 12:27
2  
Short incomplete explanation: If you compile with texexec <file> it's pdfTeX with MkII, if you compile with texexec --xetex <file> it's xeTeX with MkII (not well supported) and if you compile with context <file> it's LuaTeX with MkIV. When you're in doubt what to use, go for context <file>. –  Marco Jul 20 '12 at 13:21
1  
As an aside: your allusion to dolorem ipsum is a very nice touch. –  Esteis Jul 20 '12 at 19:08
show 1 more comment

2 Answers

up vote 2 down vote accepted

The answer is surprisingly simple: in your example, the first term in the line

\definetypeface[BerlinSSDB][ss][sans][Berlin Sans FB Demi]

is just an identifier which can be anything. If you want to have a full set (rm + sans), you need to use the same identifier so ConTeXt knows that these fonts form one collection. So here's your example rewritten (I have tested with other fonts because I don't have the ones you use; better use generic fonts for your MWE):

\definetypeface [Oxinabox] [rm] [Xserif] [Minion Pro]
\definetypeface [Oxinabox] [ss] [Xsans]  [Berlin Sans FB Demi]
\setupbodyfont  [Oxinabox, 12pt]

\setuphead[chapter][
    style=\ss,
sectionnumber=yes
]

\setuphead[section][
style=\ss,
sectionnumber=no
]

\starttext

\chapter{Welcome}
A well known text, used to fill space.

\section{H. Rackham 1914}
But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness... But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?

\stoptext

But as others have already said, if you're serious about using ConTeXt, better have a look at luatex/mkiv. It can almost everything that XeTeX can, and then so much more.

share|improve this answer
    
I'm accepting this answer, as it answers the question. (If someone comes back here looking for how to do this in XETEX, then this is the answer they will want. –  Oxinabox Jul 21 '12 at 0:32
add comment

Since you are starting with ConTeXt, I would suggest that you use LuaTeX backend instead of XeTeX.

With luatex backed (called Context MkIV), you can use the simplefonts module that makes it easy to load Opentype/Truetype fonts. For example (I changed the fonts to generic fonts) and made a few stylistic changes as well. Compile the document using context <filename>.

\usemodule[simplefonts][size=12pt]
\setmainfont[Linux Libertine O]
\setsansfont[Dejavu Sans]

\setuphead
  [chapter]
  [
    style=\ssb, % Same as \ss but uses bigger font size
    sectionnumber=yes, % Note the comma!
  ]

\setuphead
  [section]
  [
    style=\ssa, % Same as \ss but uses bigger font size
    sectionnumber=no, % Note the comma!
  ]

\starttext

\chapter{Welcome}
A well known text, used to fill space.

\section{H. Rackham 1914}
But I must explain to you how all this mistaken idea of denouncing pleasure
and praising pain was born and I will give you a complete account of the
system, and expound the actual teachings of the great explorer of the truth,
the master-builder of human happiness... But who has any right to find fault
with a man who chooses to enjoy a pleasure that has no annoying
consequences, or one who avoids a pain that produces no resultant pleasure?

\stoptext
share|improve this answer
    
Might want to note that simplefonts is a 3rd party module, and to install it use: first-setup.bat --modules="t-simplefonts" (There is probably a betterway to install it than this, since that seems to do alot of reinstalling) –  Oxinabox Jul 21 '12 at 13:06
    
I usually use first-setup.sh --modules=all while installing context. –  Aditya Jul 21 '12 at 13:45
    
Can I set the font size when I set the font: \setsansfont[Berlin Sans FB Demi][size=34pt] doesn't seem to work Berlin Sans is a tiny font, –  Oxinabox Jul 21 '12 at 14:10
    
Use \setsansfont[...][scale=2] to scale the sans font by a factor of two. –  Aditya Jul 21 '12 at 17:55
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.