Math environments

7.1 Math environments

A formula in a L A R ∞ TEX document can be typeset inline, like the congruence a ≡ b (θ) or the integral 2

e −x dx = −∞ √ π, or displayed, as in

Notice how changing these two formulas from inline to displayed affects their appear- ance.

Inline and displayed math formulas are typeset using the math environments math and displaymath, respectively. Because math formulas occur so frequently, L A TEX has abbreviations: the special braces \( and \) or $ are used for the math environment, and \[ and \] for the displaymath environment. 1 So our inline example may be typed as

$a \equiv b \pod{\theta}$ or \( a \equiv b \pod{\theta} \) or \begin{math}

a \equiv b \pod{\theta} \end{math}

The displayed example can be typed as \[

\int_{-\infty}^{\infty} e^{-x^{2}} \, dx = \sqrt{\pi} \]

or \begin{displaymath}

\int_{-\infty}^{\infty} e^{-x^{2}} \, dx = \sqrt{\pi} \end{displaymath}

Using $ as a delimiter for a math environment is a bit of an anomaly, since the same character is used as both an opening and closing delimiter. This dual purpose use makes it more difficult for L A TEX to diagnose an incorrect use of $. For instance,

1 TEX uses $$ to open and close a displayed math environment. In L A TEX, this may occasionally cause problems. Don’t do it! Try the fleqn document class option of amsart (see Section 11.5) as an example of

what can go wrong.

7.1 Math environments 153

Let $a be a real number, and let $f$ be a function.

would be interpreted by L A TEX as follows:

Let is ordinary text $a be a real number, and let $

is math

f is interpreted as ordinary text $ be a function.

is thought to be a math environment (opened by $) that should be closed by the next $ in the paragraph

Because the paragraph ends with no more dollar signs appearing, you get the error message

!! Missing $ inserted. <inserted text>

l.29 and giving you the line number of the end of the paragraph. This message tells you that

L A TEX would place a $ at the end of the paragraph when it proceeds with the typesetting.

Press Return and L A TEX produces the following:

Let abearealnumber, andletfbeaf unction. The text that ended up in a math environment is run together because math environ-

ments ignore spaces (see Section 7.2). If you use \( and \) as special braces for the math environment, L A TEX handles the same mistake more elegantly:

Let \( a be a real number, and let \( f \) be a function. gives the error message

! LaTeX Error: Bad math environment delimiter. l.25 Let \( a be a real number, and let \(

f \) be a function.

L A TEX realizes that the first \( opens a math environment, so the second \( must be in error. In this case, the line number in the error message is correct. Throughout this book, like nearly everyone else, I use $ to delimit inline math.

Rule

Math environments No blank lines are permitted in a math or displaymath environment.

154 Chapter 7 Typing math

If you violate this rule, L A TEX generates an error message,

! Missing $ inserted. <inserted text>

... l.7

where the line number points inside the environment. Multiline math environments, such as the examples in Sections 3.4.2–3.4.3, are discussed in Chapter 9.

Dokumen yang terkait

c. Bridging Teknik memanjat pada celah vertikal yang lebih besar (gullies). Caranya dengan menggunakan kedua tangan dan kaki sebagai pegangan pada kedua celah tersebut. Posisi badan mengangkang kaki sebagai tumpuan dibantu juga tangan sebagai penjaga kese

0 1 10

2. Marah: adalah kunci setiap kejahatan. Nabi saw. telah berpesan pada seseorang untuk menjauhi sikap marah dengan sabda beliau: "Janganlah engkau marah". Beliau mengulanginya berkali-kali. (H.R Bukhari). - Kebersihan Hati

2 5 14

Object Oriented Programming dengan Delphi (

1 4 75

E volusi dan aplikasi sistem informasi berbasis komputer

1 8 18

b. Data Manipulation Language (DML) : Digunakan untuk memanipulasi data dengan menggunakan perintah : select, - SISTEM BASIS DATA 1.rar (7,386Kb)

1 3 15

Hubungan Pola Asuh Orang Tua dan Kesiapan Psikologis Anak dengan Kebersihan Toilet Traning pada Anak Usia Prasekolah di Paud Ab-Arisalah Kota Lubuklinggau

0 1 8

Hubungan Pengetahuan dsn Sikap dengan Tindakan Hygiene Penjual makanan Jajanan di Lingkungan Sekolah Dasar Kaamatan Baturaja Timur Kabupaten Ogan Komering UIU Tahun 2013 A. Gani

1 3 14

Faktor faktor yang berhubungan dengan manfaatan Posyandu lansia oleh kelompok usia lanjut didesa Kemalara dalam wilayah kerja Puskesmas Kemalaraja OKU Tahun 2013. Saprianto, M.Kes

3 3 21

Korelasi umur, pekerjaan, dan keberadaan kontainer dengan kejadian penyakit malaria di desa simpang Martapura wilayah Kabupaten Ogan Komering Ulu Selatan tahun 2014 – A. Gani

0 0 18

Pengaruh Ekstrak Daun Jambu Biji (Psidiu Guajava Linn) dan Ekstrak daun Teh Hijau (Camelia Sinensis) terhadap Pertumbuhan Escherichia Coli In Vitro dan Perbandingannya dengan Kotrimoksazol

2 16 20