+ All Categories
Home > Documents > A Beginner’s Book of TEX || The characters of TEX

A Beginner’s Book of TEX || The characters of TEX

Date post: 09-Dec-2016
Category:
Upload: silvio
View: 221 times
Download: 2 times
Share this document with a friend
5
2 The characters of TEX Here is the list of characters that you can use when typing TEX: A B .. . Z a b ... z 0 1 9 ; : ! ? , , " ... , + - * / I < > ( ) [ ] (Q $ # % &: \ { } - - - These are mostly characters you're accustomed to using: lowercase and uppercase letters, digits, punctuation, accents, and certain mathematical symbols. Of course, you can use the space SP and the carriage return CR. 2.1 Characters that are special to TEX Look carefully at the last line of the table: it lists the characters that have special meaning to TEX. These characters don't print as themselves, but are instead used to communicate with TEX in special ways. The first four of them sometimes occur in text, and you can get them by preced- ing them with a backslash: type \$ to get $, \% for %, \&: for & and \# for #. The others normally occur only in special situations, for example, braces in mathematics. We will discuss them in later chapters. The character $ declares that the texts following it should be treated in a special mode, called math mode. To get out of this mode, type $ again. It is essential to tell TEX when you're about to type mathematics, because a different set of rules and conventions takes effect then (for instance, spaces are treated quite differently). R. Seroul et al., A Beginner’s Book of T E X © Springer Science+Business Media New York 1991
Transcript
Page 1: A Beginner’s Book of TEX || The characters of TEX

2 The characters of TEX

Here is the list of characters that you can use when typing TEX:

A B .. . Z a b ... z

0 1 9 ; : ! ? , ,

" ... ,

+ - * / I < > ( ) [ ] (Q

$ # % &: \ { } - --

These are mostly characters you're accustomed to using: lowercase and uppercase letters, digits, punctuation, accents, and certain mathematical symbols. Of course, you can use the space SP and the carriage return CR.

2.1 Characters that are special to TEX Look carefully at the last line of the table: it lists the characters that have special meaning to TEX. These characters don't print as themselves, but are instead used to communicate with TEX in special ways.

The first four of them sometimes occur in text, and you can get them by preced­ing them with a backslash: type \$ to get $, \% for %, \&: for & and \# for #. The others normally occur only in special situations, for example, braces in mathematics. We will discuss them in later chapters.

The character $ declares that the texts following it should be treated in a special mode, called math mode. To get out of this mode, type $ again. It is essential to tell TEX when you're about to type mathematics, because a different set of rules and conventions takes effect then (for instance, spaces are treated quite differently).

R. Seroul et al., A Beginner’s Book of T E X© Springer Science+Business Media New York 1991

Page 2: A Beginner’s Book of TEX || The characters of TEX

18 A Beginner's Book of T g<

Be extra careful with the symbol %! When TEX finds a % not preceded by a backslash, it skips everything remaining on the line, starting with the %. In this way, you can include comments in a TP<: file that won't show in the output-a reminder to yourself, an explanation for future reference, or a remark not meant for public eyes. For example, if you type

Annual Report % Judy, of the Board of Directors % can you believe of Graham, Grimm \& Groome % that Steve % stood me up again last night?

TP<: "sees" only the following:

Annual Report of the Board of Directors of Graham, Grimm \& Groome

and proceeds to typeset the Annual Report of the Board of Directors of Gra­ham, Grimm & Groome, completely ignoring your justifiable indignation.

Notice the use of \& above in order to get a &. The character &, together with # , is reserved for use in alignments and tables.

Braces, too, deserve special attention. A pair of braces like this:

... { ... a group ... }

defines a group. See chapter 3 for more details.

The characters ~ and _ are used in typing mathematical formulas.

Finally, the character - creates a tie, or unbreakable space. TEX will not break lines at a tie. For example, you should type p. -314 rather than p. 314 in order to prevent an unsightly break. The tie serves another important function: it tells TP<: not to leave extra space after the abbreviation, as it generally does following a period. You'll find examples in the first text of section 1.6 and in section 2.5; see also section 5.9.

2.2 Quotes You should distinguish carefully between opening and closing quotes, ' and '; they are on different keys, ' and ' . The position of the closing single quote, or apostrophe, is pretty much standard, but the other depends on what keyboard you're using, and is sometimes hard to find. To get double quotes (of either type) type the corresponding single quotes twice.

So to get

"I've no idea what 'holonomy' means", he said sheepishly.

you should type "I've no idea what 'holonomy' means", and so on.

The double-quote character " has the same effect as two closing single quotes "

Page 3: A Beginner’s Book of TEX || The characters of TEX

The characters of T e< 19

2.3 Ligatures and special characters TEX treats the sequence of characters " in a special way, and prints a combined character, or ligature, in its place. Here is a complete list of TEX's ligatures:

ff ~ ff ffi ~ ffi ' , ~ " ! ' ~

fi ~ fi ifl ~ ffi ' , ~ " ?' ~ i

fl ~ fl ~ - ~

There are four types of dashes in TEX. They are:

• The hyphen, used in compound words, is obtained by typing a single -. TEX inserts a hyphen automatically when it breaks a word between lines.

• The en-dash is a bit longer: -. You get it by typing --, and it is used to indi­cate ranges of numbers; for example, to get pages 13-47 you should type pages 13--47. • The em-dash is even longer-it's used as punctuation, as in this sentence, and

you get it by typing ---. • The minus sign appears spontaneously in math mode: $-$ gives -.

Whenever you want to typeset plus or minus signs, you should do it in math mode, that is, inside a pair of $ ... $ . The result looks much better:

1 +2-3 ........................................................ . ... 1+2-3 $1+2-3$ ............. . ......................................... 1 + 2 - 3

Several other special characters are obtained by typing control sequences:

\oe, \OE

\aa, \AA

\1, \L

~ ee, CE

~ a, A ~ I, L

\ae, \AE

\0, \0

\ss

~ re, lE

~ 91,0

~ B

To get les eeuvres d 'lEsope, you should type les \oe uvres d'\AE sope. Why are there spaces after the \oe and the \AE? To tell TEX where the name of the control sequence ends. Any number of spaces, and up to one carriage return, are discarded after a control sequence made up of letters. Here are some more examples:

Stra \ss burg -t StraBburg Bergstr\o m -t Bergstr9lm

Wroc\l aw -t Wrodaw \AA rhus -t Arhus

If the space in the middle of a word bothers you, you can delimit the control se­quence in another way: Stra{\ss}burg, Bergstr{\o}m, and so on. Here the } also tells TEX that the control sequence has ended.

Suppose you're a physicist, and want to typeset

Light with a wavelength of 3000 A is invisible.

Page 4: A Beginner’s Book of TEX || The characters of TEX

20 A Beginner's Book of T EX

If you type ... \AA is invisible, you get ... Ais invisible: not at all what you want! For the space not to be discarded, you must make sure it doesn't come right after the control sequence name. You can choose according to taste:

{\AA} is invisible or \AA\ is invisible.

2.4 Accents

To get an accent above a letter, type the appropriate control sequence before the letter: for example, e is obtained by typing \' e . Any letter or symbol can follow an accent. Here is a list of the available accents, and how they look on the letter '0':

\'0 0 grave accent \'0 6 acute accent

\-0 6 circumflex accent \"0 0 dieresis or umlaut

\-0 6 tilde \u 0 0 breve

\=0 6 macron or bar \.0 6 dot accent

\b 0 Q bar-under accent \d 0 9 dot-under accent

\t 0 60 tie-after accent \v 0 0 hacek or check

\H 0 0 Hungarian umlaut \c 0 Q cedilla

Notice the difference in syntax between \' 0 and \.0, on the one hand (no space after the accent), and \b 0, \v 0 on the other (space required). Here are some examples:

l\'ese-majest\'e

\v Cekoslovensko

---+ lese-majeste

---+ Cekoslovensko

Fr\" aulein ---+ Fraulein

na\"\i ve ---+ naIve

na \ "{\i}ve ---+ naIve

When an 'i' gets an accent, it should first be deprived of its dot. That's why we use the control sequence \i in the last two lines above. As usual, we have to leave a space after it or enclose it in braces. The same remarks apply to 'j', whose dotless version is obtained by typing \j .

If you need to use certain accents a lot-if you're writing a text in French, say­it's possible to arrange things so that fewer keystrokes are needed for each accent. For instance, you can redefine " so that it stands for the dieresis, rather than for quotation marks. You can even make TEX look ahead and replace an accented 'i' by '1', so you would just type na"ive to get naIve. We'll come back to this point in section 12.6.

Page 5: A Beginner’s Book of TEX || The characters of TEX

The characters of T EX 21

2.5 Two exercises Test yourself by trying to typeset this bibliographical reference in Rumanian, without looking at the solution below:

GEORGESCU, V. A., Bizantul §i institutiile romane§ti pina la mijlocul secolului al XVIII-lea (Byzanz und die rumanischen Institutionen bis zur Mitte des 18. Jahrhunderts). Bucure§ti, Ed. Academiei RSR, 1980. Re­viewed by C. R. Zach, in Siidost-Forschungen, 40, 1981, pp. 434-435.

GEORGESCU, V. A., Bizan\c tul \c si institu\c tiile rom\-ane\c sti p\-\i n\u a la mijlocul secolului al XVIII-lea (Byzanz und die rum\" anischen Institutionen bis zur Mitte des 18.-Jahrhunderts). Bucure\c sti, Ed.-Academiei RSR, 1980. Reviewed by C.-R.-Zach, in S\"udost-Forschungen, 40, 1981, pp.-434--435.

And here is a short text in Berber, a North African language. To get "( and E you can use the abbreviations \g and \e, after having defined them in the following way: \def\e{$\varepsilon$} \def\g{$\gamma$}.

Yenna-yas: J:tul). ~~u lejnan. Ma d ayefki, yenna-yas: rul). a"(tixsi tamezgult, zlu-t, tazuQ-t, twenEeQ-t irkweli, tawiQ-t "(er uqemmuc l-l"(ar t-tizemt.

Yenna-yas: \d Ru\d h \d z\d zu lejnan. Ma d ayefki, yenna-yas: \d ru\d h a\g tixsi tamezgult, zlu-\c t, tazu\d d-\c t, twen\e e\d d-\c t irkweli, tawi\d d-\c t \g er uqemmuc l-l\g a\d r t-tizemt.


Recommended