Inline

Changing font style (italics, bold, etc.)

In order to create a different font style, such as italics or bold, start a group with an open bracket, issue the command, and close the group with a closed bracket.

% create italics style
{\it The Old Man and the Sea}

Here are the commands for the different font styles.

{\bf bold }
{\sl slanted}
{\it italics}
{\bi bold and italics}
{\bs bold and slanted}
{\sc small caps}

source file

Tips

Using em for more flexibility

The em command allows more flexibility for emphasizing text because it takes the context into consideration. If the surrounding font is upright, it will make the emphasized text slanted. If the surronding text is slanted, it will make it upright. The following example is hypothetical title of a book about the American novel Huck Finn. The title itself will be slanted, but Huck Finn will not.

{\em Thoughts on {\em Huck Finn}}

Underlining Text

Underline text with the underbar and underbars commands. The underbar command puts one line under all the text. The underbars underlines each word individually.

\underbar{underlined text}
\underbar{underline individual words}

Changing font face (serif, sans serif, etc.)

The default font face for ConTeXt is serif. In order to create different font faces, such as sans serif, look at the following example.

{\rm roman text}
{\tt mono spaced font}
{\ss sans serif}
{\hw this is hand written style}
{\cg this is caligraphic style}

source file

Font Size

Setting the body font size

Set the body font size with the setupbodyfont command.

\setupbodyfont[12pt]

The setupbodyfont is also used to set up font family.

Explicitly changing the font size

Use the switchtobodyfont to switch your body font.

{\switchtobodyfont[18pt] 18 point font}

source file

Proportionally changing the font size

An alternative to explicitly changing font size by a declaration is switching them proportionally by increasing or decreasing them by a size. (I’m not sure exactly how ConTeXt determines a size.) In order to increase the font size, use the letter a, b, c, or d after a font command (which I’ll explain below). In order to decrease the font size, use one or more of the letter x after a font command.

By font command, I mean any command that changes a font’s appearance, such as bf. If you wanted to create a font face which is bold in appearance, and decrease it by one size, type:

{\bfx bold reduced by one size}

If you just want to change the font size without changing any other characteristic, use the tf (type face) command followed by a letter.

{\tfa increase the font size by one size}

You can use the font-increasing/decreasing letters with bf, sl, it, rm, ss, tt, cg, hw, and sc. I may have missed some commands, so if you think you can add a letter after a font command, experiment.

{\tfxx decrease the font size by two}
{\tfa increase font size by one}
{\bfa increase font size by one and make bold}
{\tfb increase font size by two}
{\ssd create a sans serif font and increase its size by four}

source file

Creating horizontal space

Create space with the hspace command. You will first have to define the amount of space with the definespace command.

\definehspace[mine][12pt]
\hspace[mine]

source file

Superscript and Subscript

The high and low commands create super- and subscript text.

You can walk in \high{high} heels, but your height is still the same.\par
You can walk in \low{low} heels, but your height is still the same.\par

source file

Text on top of each other

Create text on top of each other with the lohi command. This command takes two parameter. The first parameters will be formatted as subscript, and the second will be formatted on top of that.

You can walk in \lohi{low}{high} heels, but your height is still the same.\par

source file

copyright 2005 Paul Henry Tremblay

License: GPL

home | contents | previous | next

SourceForge.net Logo

last updated: 2005-05-08