28.03.2013 Views

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

C.2. Some sample errors 413<br />

message once again, this time stating that it cannot find the file x.ext.<br />

Some installations provide a dummy file named null.tex, while one of<br />

the extension packages available (Section B.5.4) offers a set of files named<br />

after the st<strong>and</strong>ard response letters x.tex, e.tex, r.tex, h.tex, s.tex<br />

<strong>to</strong> emulate the responses <strong>to</strong> normal error messages.<br />

Emergency s<strong>to</strong>p: sometimes one reaches a situation where the program<br />

cannot be halted after an error, even with I\s<strong>to</strong>p or X. In such a case, one<br />

has <strong>to</strong> apply the operating system’s program interrupt, usually CTRL Z.<br />

C.2.3 Mathematical errors<br />

Surprisingly few errors occur as a result of incorrect application of mathematical<br />

formula comm<strong>and</strong>s themselves, even for a user with only a little<br />

experience. More often, the errors in mathematical formulas are fiddly<br />

ones such as forgetting a closing brace } or neglecting <strong>to</strong> switch back<br />

<strong>to</strong> text mode. Another type of common error is <strong>to</strong> use a symbol in text<br />

mode that may only appear in math mode. We will point out a few typical<br />

examples here.<br />

One wants <strong>to</strong> produce the text: ‘The price is $3.50 <strong>and</strong> the order<br />

number is type sample’, <strong>and</strong> types the input text:<br />

The price is $3.50 <strong>and</strong> the order number is type_sample.<br />

This text contains two errors, such that the first cancels the second one:<br />

the $ sign is the math mode switch for generating formulas within text<br />

(Section 5.1). The proper way <strong>to</strong> write a true dollar sign in text is as \$.<br />

Instead, in the sample text, the $ alone switches <strong>to</strong> math mode, setting<br />

everything that follows as a formula. However, the closing switch-back $<br />

is missing, something that T E X will first notice at the end of the current<br />

paragraph.<br />

! Missing $ inserted.<br />

<br />

$<br />

l.4<br />

?<br />

If 〈return〉 is simply pressed as a response, T E X inserts a $ at this point.<br />

For our sample text, this would be at the end of the text before the blank<br />

line. This means that the text from the first $ <strong>to</strong> the end of the paragraph<br />

will be set as a text formula:<br />

The price is 3.50<strong>and</strong>theor der number istypesample.<br />

This output should show the user right away what went wrong. Near<br />

the end of the line, there is a letter s printed as an index. This is the<br />

second error in the example. The underbar character _ is only permitted

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!