Errors in math

3.2 Errors in math

Even in such a simple note there are opportunities for errors. To help familiarize your- self with some of the most commonly seen L A TEX math errors and their causes, we deliberately introduce mistakes into math.tex. The version of math.tex with mis- takes is mathb.tex. By inserting and deleting % signs, you make the mistakes visible

to L A TEX one at a time—recall that lines starting with % are comments and are therefore ignored by L A TEX.

20 Chapter 3 Typing math

Type the following source file, and save it under the name mathb.tex in the work folder or copy the file mathb.tex from the samples folder (see page 4). Do not type the line numbers—they are shown here to help you with the experiments.

1 % Sample file: mathb.tex

2 \documentclass{sample}

4 \begin{document}

5 In first-year calculus, we define intervals such

6 % as $(u, v)$ and $(u, \infty)$. Such an interval

7 as $(u, v)$ and (u, \infty)$. Such an interval

8 is a \emph{neighborhood} of $a$

9 if $a$ is in the interval. Students should

10 realize that $\infty$ is only a

11 symbol, not a number. This is important since

12 we soon introduce concepts

13 such as $\lim_{x \to \infty} f(x)$.

14 %such as $\lim_{x \to \infty f(x)$.

16 When we introduce the derivative

18 \lim_{x \to a} \frac{f(x) - f(a)}{x - a}

\lim_{x \to a} \frac{f(x) - f(a) x - a}

21 we assume that the function is defined and

22 continuous in a neighborhood of $a$.

23 \end{document}

Experiment 1 In line 7, the $ before the (u is missing. Typeset the mathb.tex

source file. L A TEX generates the following error message:

! Missing $ inserted. <inserted text>

l.7 as $(u, v)$ and (u, \infty )$. Such an interval

Since the $ was omitted, L A TEX reads (u, \infty) as text; but the \infty command instructs L A TEX to typeset a math symbol, which can only be done in a math formula. So L A TEX offers to put a $ in front of \infty while typesetting the source file—it does not put the $ in the source file itself. L A TEX attempts a cure, but in this example it comes too late, because the math formula should start just before (u.

3.2 Errors in math

Whenever you see the ? prompt, you may press Return to ignore the error and continue typesetting the document. Section D.4 lists a number of other options and prompts.

Experiment 2 Uncomment line 6 by deleting the % at the beginning of line 6 and comment out line 7 by inserting a % at the beginning of line 7. This eliminates the previous error. Uncomment line 14 and comment out line 13. This introduces a new error, the closing brace of the subscript is missing. Now typeset the note. You get the error message

! Missing } inserted. <inserted text>

l.14 such as $\lim_{x \to \infty f(x)$ L A TEX reports that a closing brace (}) is missing, but it is not sure where the brace should

be. L A TEX noticed that a subscript (see page 23) started with {, but L A TEX reached the end of the math formula before finding a closing brace }. To remedy this, you must look in the formula for an opening brace { that is not balanced, and insert the missing closing brace }. Make the necessary change and typeset again to view the difference.

Experiment 3 Uncomment line 13 and comment out line 14, removing the previous error. Delete the % at the beginning of line 19 and insert a % at the beginning of line 18, introducing our final error, omitting the closing brace of the first argument and the opening brace of the second argument of \frac. Save and typeset the file. You get the error message

! Too many }’s. \frac #1#2->{\begingroup #1\endgroup \@@over #2}

l.20 \] L A TEX got confused. The second line of the message explains that \frac has two

arguments and it is not working out, but the error is incorrectly identified. If the typo on line 19 is \frac{f(x)-f(a) x-a}g, then L A TEX produces

f (x) − f(a)x − a

and no error message is generated. Experiment 4 Make sure all the errors are commented out. Typeset mathb.tex,

testing that there are no errors. Now delete the two $ signs in line 22, that is, replace $a$ by a. Typeset the file. It typesets with no errors. Here is the last line of the typeset

file you get:

22 Chapter 3 Typing math

we assume that the function is defined and continuous in a neighborhood of a. instead of

we assume that the function is defined and continuous in a neighborhood of a. This is probably the error most often made by beginners. There is no error mes-

sage by L A TEX and the typeset version looks good. You need sharp eyes to catch such an error. See Section 4.3.1 for more information about finding and fixing problems in your L A TEX source files.

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