Simple tutorial for programmers — part 2
RTF – Fonts, Color & Tabs
Building on the basics: multiple fonts, color highlighting, tab justification, and tab leaders
This page builds on the first example. Fonts are straightforward — define them all in the font table at the top of the document and reference them by number as needed.
Multiple fonts
The font table accepts as many entries as you need. Each font is given a sequential number starting at f0. Switch fonts mid-document by writing \fN:
Text color and highlighting
The color table can hold as many colors as needed. Colors are indexed from 1 (the first entry after the opening semicolon). Switch the foreground color with \cfN and apply a highlight with \highlightN — turn the highlight off with \highlight0.
The example below adds yellow (color index 3) to the palette from part 1:
Tab justification
Tab stops can be left-, center-, or right-aligned. Each line is wrapped in its own paragraph (\par\pard) so tab settings reset cleanly. Place the tab alignment command before the \txN stop:
- \tqrRight-aligned tab
- \tqcCenter-aligned tab
- \tqdecDecimal-aligned tab (aligns on the decimal point)
- (none)Default left-aligned tab
| right → | Right tab |
| center → | Center tab |
| left → | Left tab |
Tab leaders
Leader characters fill the space between the start of a line (or the previous tab stop) and the tab stop itself. They are commonly used in tables of contents. Combine a leader code with a tab alignment and position:
- \tldotDotted leader (. . . . . .)
- \tlhyphHyphen leader (- - - - - -)
- \tlulUnderline leader (________)
| . . . . . . . . . . . . . . . . . . . . . . Right tab with leading dots |
| - - - - - - - - - - - - - - - - - - - - - - Right tab with leading hyphens |
| Right tab with leading underline |
| 1" tab . . . . . . . . . . . with 1" of dots between |
| - - - - 1" tab with 1" of space between and hyphens outside - - - - - - - - |