text:
## Chapter 3. Running TeX

$Revision: 1.1$

$Date: 2002/08/23 14:31:13$

The heart of processing a document with TeX is running the TeX program. In this chapter, you'll learn what happens between the time you first start the TeX program and the time it finishes. You'll also learn what files TeX really needs (in addition to your document) and what to do when TeX finds things in your document that it doesn't understand.

## What Do You Run?

The first thing you have to know is what program to run. Unfortunately, the actual file you have to execute varies between platforms and implementations. If you have built and/or installed TeX yourself, you probably already know what program to run. You'll have to ask your system administrator for help if you can't figure out what the name of the TeX executable is on your computer. The rest of this chapter assumes that the command tex runs TeX. You should substitute the name of the executable program on your own system for tex in the examples that follow.

Most implementations of TeX have some hard-coded memory limits. These limitations may cause problems if you are trying to run a very complex document through TeX. To combat this problem, some distributions include two versions of the TeX executable. One version is a “small” TeX that generally runs faster but has less memory available to process your documents. The other version, a “big” TeX, can process more complex documents but may run more slowly. If you get a “TeX capacity exceeded” error, and you have a big TeX available on your system, try processing your document with the big TeX.

If you still get an error, you have a document that is simply too complex for your implementation of TeX to handle, or you have an error in one of the macros in your document. By examining the error log, described later in this chapter in the section “the section called “Log Files”,” you can determine what macro TeX is interpreting when the error occurs. If the error occurs in a macro that you wrote, check to make sure the macro functions the way you intended by using it in a small test document.

## What Files Does TeX Need?

Naturally, TeX needs your input file in order to process it. However, TeX must be able to find several other files as well. The files that TeX needs are normally created during the installation process. Here is a common directory layout for TeX on a unix system:

 /usr/local/lib/tex/formats Format files /usr/local/lib/tex/pool Pool files /usr/local/lib/tex/formats Format files /usr/local/lib/tex/inputs “System” input files /usr/local/lib/tex/macros (styles, macros, and miscellaneous /usr/local/lib/tex/lib files distributed with TeX) /usr/local/lib/tex/ps PostScript support files /usr/local/lib/tex/fonts/pk PK fonts /usr/local/lib/tex/fonts/vf Virtual fonts /usr/local/lib/tex/fonts/tfm TFM metrics

A similar layout is frequently used on other operating systems, except that the TeX files are often stored in a top-level directory (for example, C:$\$TEX under MS-DOS). Because TeX is very flexible and has many different implementations, the exact directory structure varies. Pool files are sometimes placed in the format file directory (which is sometimes called fmt or fmts, rather than formats). Input files may occur in one or more of the standard places listed above (inputs, macros, and lib) as well as a number of other places (texinputs is another common name).

The files under the TeX tree usually come from outside distributions, so you don't have to change them often. (You definitely shouldn't put your personal macro files in that tree, even if you do have access to it.)

The following sections describe, in more detail, each of the files that TeX needs.

### Pool Files

Pool files contain string constants used by TeX at runtime. Each time TeX is compiled, it creates a pool file unique to the version being compiled. The pool file from one version of TeX will not work with a different version.

In contrast to format files (discussed in the next section), if you don't have a pool file, there's nothing you can do about it. If you obtained precompiled programs (from the Internet, from a friend, or commercially) and you don't have a pool file, you received an incomplete distribution.

If you did not install TeX yourself, but find that the pool file is missing, contact the system administrator who performed the installation. He or she did something wrong.

### Format Files

As mentioned in the section “the section called “Boxes and Glue”” in Chapter Chapter 1, Chapter 1, all of the control sequences and macros that your document uses must be defined somewhere. One way to do this is to use the \input command to load all of the definitions at the beginning of each document. However, with large macro packages like LaTeX, this process can be very time consuming. Format files are a way of predefining control sequences and macros so they don't have to be interpreted by TeX every time they're used. If TeX didn't use format files, you'd have to wait for TeX to interpret all of LaTeX every time you processed a document that used LaTeX.

Format files are created by a special version of TeX, usually called iniTeX. Some implementations combine TeX and iniTeX into one program. In this case, you must select iniTeX with a special option when you run TeX. IniTeX interprets all the control sequences in a macro package and builds the in-memory data structures that the TeX program needs. After loading the whole macro package, iniTeX writes the memory image it has constructed to a format file. When TeX later loads the format file, it simply copies it into memory; no interpretation is necessary. This is why loading a format file is such a fast way to define control sequences. This is also why format files are not usually portable from one system to another,[25] or even between different versions of TeX on the same system. Different versions of TeX are stored differently in memory, and this difference in loading makes the format files incompatible. For this reason, you need a “big” iniTeX to make format files for a big TeX and a “small” iniTeX for a small TeX.

You will find a complete discussion of macro packages and instructions for building format files for many of the common macro packages in Chapter Chapter 4, Chapter 4.

### User Files

When you run TeX, you have to tell it what file to process. If you specify a complete pathname, TeX will load the specific file that you request. For example, I could process the document myreport.tex in the directory /home/norm/tex/ by running:

\$tex /home/norm/tex/myreport  This example applies to both unix and PC implementations of TeX. Even though MS-DOS and OS/2 typically use the backslash to separate directory names, always use a forward slash when entering filenames for TeX. If you specify a simple filename without a path, TeX looks for the file in several user-defined and, possibly, system-defined locations. In the following example, TeX will attempt to locate the file myreport.tex in order to process it: \$ tex myreport

If the file myreport.tex exists in several directories, TeX will process the first file it finds without looking for any others. TeX always prints the complete name of the file it processes both on the display and in the log file, so you can always tell what file was really processed.

The most common way to specify user-defined locations is by setting the TEXINPUTS environment variable[26] to a list of subdirectories where TeX documents are kept. Setting TEXINPUTS specifies where TeX should look for documents (files that you input with \input or some other construct, style files, and macros). To change where TeX looks for other kinds of files (fonts, formats, pool files, etc.), setting different environment variables or performing some other customization is required. The format of the environment variable differs according to the platform you use. On unix systems, it is a list of directory names separated by colons. Here is a typical example:

.:/usr/local/lib/tex/inputs:/home/norm/tex/inputs

On MS-DOS and OS/2 systems, it is a list of directory names separated by semicolons. A typical example looks like this:[27]

.;\tex\inputs;\tex\styles;\tex\macros

Consult the documentation for your particular implementation of TeX for more information about system-defined locations where TeX looks for input files. Unfortunately, this is not always well documented. For example, an undocumented feature of version 1.4s of emTeX always searches in the directory \emtex\texinputs even if it does not occur in the TEXINPUTS path. In fact, there is no way to tell it not to look there, short of renaming the directory (which is what I did).

If TeX cannot find a file you specify, for example rpt-data.tex, it displays a prompt like this one:

! I can't find file rpt-data.tex'.
<*> \input rpt-data

The general form of TeX error messages is discussed in the section called “the section called “What About Errors?”” later in this chapter. TeX announces an error by printing the error message on a line that begins with an exclamation mark. Below the error, TeX provides the context in which the error occurred. In the example above, TeX encountered the command \input rpt-data and tried to find the file rpt-data.tex which it could not locate.

Notice that TeX automatically added the extension .tex to the name of the file it was looking for. In any context where you specify a filename, TeX will append .tex unless you specify an alternate extension.

TeX responds to a “can't find file” error by asking you to type the name of a different file. Some implementations of TeX allow you to abort by typing Ctrl-C or Ctrl-D at this point,[28] but other implementations insist that you enter a filename. In this case, you'll find it convenient to create an empty file called nul.tex in a directory in your TEXINPUTS path so you can get around this requirement by supplying a dummy answer to the prompt. nul.tex is part of many standard distributions.

## The Command Line

Except for the name of a document, TeX has very few command-line options. The only option that is regularly used is the name of a format file, but the use of this option is frequently buried inside a batch file or shell script.

It is helpful to think of TeX, LaTeX, SliTeX, etc. as different text processors (they aren't really; they're all TeX with different format files). This illusion is easy to provide with shell scripts or batch files. For example, on an MS-DOS system, you could easily have three batch files called tex.bat, latex.bat, and slitex.bat:

• The tex.bat file runs the TeX executable with the plain format file specified as an option.

• The latex.bat file runs TeX with the lplain format file.

• The slitex.bat file runs TeX with the splain format file.

Now typing tex filename processes Plain TeX documents; typing latex filename processes LaTeX documents; and typing slitex filename processes SliTeX documents.[29] The role of format files and macro packages is described fully in Chapter Chapter 4, Chapter 4.

### Command-line Options

A formal specification of the TeX command line looks like this:

$tex &lplain \nonstopmode \input doc1  When using OS/2, place a ^ in front of an ampersand to prevent it from being interpreted as a command separator. #### Filenames and TeX It is easy for TeX to recognize the presence of a format file on the command line; it must be the first option and it must begin with an ampersand.[30] After the format file, TeX determines whether the next option is a file name by looking at the first character of the option. If the first character is not a backslash, it is a filename; otherwise it is a TeX command, and TeX assumes that no filename is present. On some systems, notably MS-DOS and OS/2, the backslash is used to delimit the subdirectory components of a file name. On other systems, a forward slash is used. Regardless of the system you use, filenames passed to TeX must use forward slashes to delimit filenames. For example, TeX will not process the file letter.tex in the \tex\docs directory of the current drive if you execute the following command line on an MS-DOS system: \$ tex \tex\docs\letter

Instead, you must type the following, regardless of the operating system you're using:

\$tex /tex/docs/letter  If you don't, TeX will complain that the control sequence \tex is undefined. Even more confusing errors may result if the first subdirectory happens to be a valid control sequence. Unfortunately, filenames containing forward slashes are not always recognized by operating systems that use backslashes to delimit filenames. For example, under MS-DOS, IF EXIST C:/CONFIG.SYS returns false, even when a file called config.sys exists in the root directory of drive C:. Therefore, it is most convenient to use filenames with backslashes when other commands will be used (for example in a batch file). Filenames in batch files must have any backslashes translated into forward slashes before being passed to TeX. MS-DOS's command processor isn't really powerful enough, but the task is quite doable with JP Software's 4DOS command processor. 4DOS is a replacement for MS-DOS's normal command processor; it offers many advantages over the normal processor. You can get a shareware version of 4DOS from many large MS-DOS archive sites on the Internet[31] as well as most large bulletin board systems. The following lines, written in 4DOS's extended batch language, will translate all backslashes in the environment variable TEXFN to forward slashes: :FixBacks Set Count=%@Index[%TexFn,\] If "%Count" eq "-1" Goto FixDone Set Place=%@Eval[%Count+1] Set TexFn=%@SubStr[%TexFn,0,%Count]/%@SubStr[%TexFn,%Place] Goto FixBacks :FixDone  These lines also work under OS/2 with JP Software's 4OS2 command processor (akin to 4DOS; shareware versions of 4OS2 are also available). The same task can be completed in a single line with REXX under OS/2: TEXFN = TRANSLATE(TEXFN, '\', '/')  REXX is an interpreted systems-programming language distributed with OS/2. REXX runs under many other IBM operating systems in addition to OS/2. Several versions of REXX are available for MS-DOS and unix systems, too. #### Multiple documents Keep in mind that TeX interprets only the first option after the format file name as a document name. If you type the command line: \$ tex doc1 doc2

TeX will process only doc1.tex as a document. The result of the above command line will be exactly as if you had typed the literal word “doc2” at the very end of the file doc1.tex.

To get TeX to process both doc1 and doc2 as documents, type a command like the following:

\$tex doc1 \input doc2  or, for complete clarity, \$ tex \input doc1 \input doc2

In either case, the structure of your document files must allow them to be concatenated together. TeX does not process doc1 and then process doc2 separately. Instead, it processes all of doc1 and appends the text in the file doc2 directly onto the end of doc1.

## TeX Without Options

If you run TeX without specifying any options at all, it prints out some introductory information, then produces a ** prompt and stops. Here's what emTeX's tex386 produces:

This is emTeX (tex386), Version 3.141 [3c-beta8]
**

This is the only situation where the ** prompt occurs. TeX now expects you to enter text. TeX will interpret anything you type after the ** prompt exactly as if you had typed it on the command line. All of the rules regarding slashes (described in “the section called “Misinterpretation of the command line”” earlier) apply to commands that you type at the ** prompt. Remember, however, that input entered at the ** prompt is not seen by the operating system, so don't use quotation marks or doubled backslashes.

The last line of a document is usually a command telling TeX that the document is finished. TeX responds by writing the last page of the document and ending (returning control to the operating system). If a document doesn't end with such a command, TeX will wait for more input. When TeX runs out of input, it displays the * prompt (single asterisk). Anything you type at the * prompt is interpreted exactly as if it occurred in the document that TeX was processing. You cannot specify an alternate format or name a document at the * prompt. You can, however, use \input to insert another file.

If emTeX processes a document called unended.tex:

% This is UNENDED.TEX
Now is the time for all good men
to come to the aid of their country.
% Note: there's no \bye command to end
% TeX's processing...

the following output appears on the terminal:

This is emTeX (tex386), Version 3.141 [3c-beta8]
**unended
(unended.tex)
*

You can exit from the TeX program at the * prompt by telling TeX that it should stop processing the current document. Exactly how you get out depends on the format file you use. The following table shows the stop commands for some TeX macro packages.

Table 3.1.

Package Command
Plain TeX \bye
LaTeX \end{document}
SliTeX \end{document}
Lollipop \Stop
TeXinfo @bye

If you do not know which format is in use, you can almost always get out with the following steps:[32]

1. Type a control sequence that TeX will not recognize (control sequences \undefined and \gobbledygook will work). TeX will respond with the question mark prompt.

2. Enter x at the prompt. The question mark prompt is discussed fully in the section “the section called “Interpreting TeX Error Messages”,” later in this chapter.

To continue the above example, if I type \undefined at the * prompt, TeX will respond:

This is emTeX (tex386), Version 3.141 [3c-beta8]
**unended
(unended.tex)
*\undefined
! Undefined control sequence.
<*> \undefined

?

If I enter x at the question mark prompt, TeX will print several informative messages and then end, returning control to the operating system.

This is emTeX (tex386), Version 3.141 [3c-beta8]
**unended
(unended.tex)
*\undefined
! Undefined control sequence.
<*> \undefined

? x
No pages of output.
Transcript written on unended.log.

One word of caution: some macro packages redefine the meaning of the backslash (\) character so that it doesn't function as the beginning of a control sequence (for example, the TeXinfo format uses the at-sign, “@”). In this case, you must precede the undefined control sequence by the escape character, even if it isn't the backslash.

When you write TeX documents, you will occasionally make mistakes and as a result, TeX won't be able to process your document. There are six broad classes of mistakes you're likely to make:

1. Naming documents or files that TeX cannot find.

2. Misspelling the name of a TeX control sequence.

3. Failing to close an environment or forgetting to insert a closing brace after an opening brace.

4. Using math operators outside of math mode or forgetting to close an opened math environment.

5. Requesting a font that TeX cannot find.

6. Everything else.

TeX is legitimately criticized for having error messages that are very difficult to understand. TeX frequently provides far more information than you really need or want, and the excess information often obscures the actual cause of the error.

Nevertheless, understanding what TeX does when it encounters an error will help make error messages easier to understand. Let's begin with an example. Example Example 3.1 shows a simple LaTeX document using the New Font Selection Scheme (NFSS), which contains an error.[33] The error is that the control sequence \Large, which has been redefined to request a 17pt font, contains a typo: \cs[fontsize]{fontsiz} should be \fontsize.[34]

\documentstyle{article}
% The following definition changes the font that LaTeX
% uses for the 'Large' font.  I have introduced a typo
% into the definition, “\fontsiz” should be “\fontsize”.
% The  first time a \Large font is requested, an error will occur.
\renewcommand{\Large}{\fontsiz{17}{20pt}\selectfont}
\begin{document}

This text precedes the first section header.

% Note: LaTeX uses the \Large font in section
% headers...this will fail in a confusing way
% because the error is deep within the definition
% of \section where \Large is used...
\section{First Section}

This is the first and only sentence of the first section.

\end{document}

When TeX processes this file, using LaTeX with the New Font Selection Scheme, it produces these error messages:

This is TeX, Version 3.1415 (C version 6.1)
LaTeX Version 2.09 <25 March 1992> with NFSS2
Standard Document Style article' <14 Jan 92>.
(/usr/local/lib/tex/inputs/nfss2/T1cmr.fd)
! Undefined control sequence.
\Large ->\fontsiz{17}{20pt}\selectfont
<argument> \reset@font \Large
\bf
\@sect ...x \ifdim \@tempskipa >\z@ \begingroup #6
\relax \@hangfrom {\hskip ...
l.21 \end{section}
\section{First Section}

?

These messages exemplify the kind of confusing error messages that TeX produces. Remember the following rule: Always look at the first and last line of the TeX error message when trying to figure out what went wrong and where it went wrong. In this case, the first line is:

! Undefined control sequence.

and the last line is:

l.21 \end{section}
\section{First Section}

The error is that the control sequence \cs[fontsize]{fontsiz} is not defined and TeX was processing line 21 of the file when it occurred.

### Log Files

You don't have to remember or write down the error messages that TeX produces. When TeX processes a document, it produces a transcript of everything that occurs; you can refer to this transcript later if you need to recall what errors occurred when you processed your document. TeX stores this transcript in a file which has the same name as the document and the extension .log. For example, if you process main.tex, TeX produces a transcript in main.log.

### Note

Log files go in the current directory. TeX always places the log file in the current directory, even if you specify a path when you format your document. For example, if you process lectures/main.tex, TeX produces a transcript in main.log, not in lectures/main.log as you might expect.

### Interpreting TeX Error Messages

The first line of a TeX error message begins with an exclamation point followed by the text of the message. The lines that follow it show the context in which the error occurred.[35] In the previous example, the error message indicates an Undefined control sequence. This means that TeX encountered a control sequence which was not previously defined.

The final line, which says l.21 \section{First Section}, occurs right above the question mark prompt. It identifies the line in your document that TeX was processing when it encountered the error. The error occurred when TeX was at line 21 of the file, and that line began with \section{First Section}.

Between the first and last lines, TeX prints a detailed description of how the error occurred. This is necessary because the error may have occurred inside the replacement text of a macro that you used. When TeX encounters a control sequence, like \section, it has to look up the definition to figure out how to typeset your document. The definition of a control sequence may contain other control sequences which also have to be interpreted. It is possible for TeX to be several levels deep, as it was in this case, when an error occurs. To give the person who wrote the definition of the control sequence an opportunity to figure out what went wrong, TeX prints out a trace back of what happened before the error. As you gain experience with a particular macro package, you'll find the intervening lines more meaningful.

Correcting an error depends entirely on the nature of the error. In this case, all you need to do is correct the typo.

As stated above, there are six general classes of errors you might encounter when you run TeX. The following sections briefly describe each class.

### Naming a File TeX Cannot Find

Missing documents are discussed in the section called “the section called “User Files”,” earlier in this chapter.

If you request a format file that cannot be found, TeX issues the following warning message:

Sorry, I can't find that format; will try the default

TeX then attempts to typeset your document with Plain TeX.[36] To correct this problem, run TeX with the correct format file name. If the format file isn't available, you will have to build it. Chapter Chapter 4, Chapter 4, describes how to build format files for several common macro packages.

### Misspelling a Control Sequence Name

Misspelling a control sequence name is one of the most common errors. For example, you might type \ipnut{chap1} in your document instead of \input{chap1}. The solution is straightforward and usually easy to identify. In many cases, you can simply proceed after encountering this error. Although TeX may not typeset your document correctly, you can continue to look for other errors. The section called “the section called “Interpreting TeX Error Messages”,” later in this chapter, describes how to continue after an error.

In some cases, TeX may become badly confused by a misspelled control sequence name, in which case you should give up and fix the spelling error before trying to process your document further. This may happen if you misspell a LaTeX environment name (\begin{itemze} instead of \begin{itemize}, for example),[37] which will make LaTeX misinterpret many of the control sequences which follow.

Sometimes TeX will complain that a control sequence is undefined when you know that the control sequence is spelled correctly. When this occurs, make sure that you are using the correct format file (see the section “the section called “The Command Line”” earlier in this chapter), loading the correct macro files, and using the correct style options.

### Failure to Close an Environment

Failure to close an environment is another very common error. There are several distinct errors in this category:

• Failure to insert a closing brace (}) for each opening brace may cause a “TeX capacity exceeded” error when TeX processes your document. This happens because sometimes TeX tries to read everything between braces into memory. If the closing brace is absent, TeX may run out of memory.

If the braces are supposed to enclose the argument to a macro, you may also get this error:

! Paragraph ended before macro was complete.

In order to help detect errors of this type, TeX doesn't ordinarily allow the argument of a macro to consist of more than one paragraph, so the first blank line after the place where you failed to type the closing brace may produce this error.

• Failure to close a begin/end environment pair causes LaTeX to complain about a mismatch when it encounters the next \end{\texttt{environment}} command.

• If your document ends with an open environment, TeX will warn you that:

! (\end occurs inside a group at level n)

where n is the number of open groups, usually 1.

• Failure to close a mathematics environment will result in the error:

! Missing $inserted  when TeX reaches a macro that does not make sense in mathematics mode (like \section) or when a surrounding group ends. ### Math Outside of Math Mode TeX has a lot of operators for special treatment of mathematical formulas. These operators must occur inside mathematics mode, which is usually delimited by dollar signs in your document. If you attempt to use math operators, superscripts, subscripts, or other math-mode control sequences outside of mathematics mode, the following error will occur: ! Missing$ inserted

This is your clue that a mathematics environment has not been closed properly or that you failed to open one before using a math-mode operator.

For example, the underscore character is usually defined to be a math-mode operator which starts a subscript, in other words H${}_2$O produces “H${}_2$O” in your document.[38] If you use the underscore outside of mathematics mode, such as in regular text:

The file “test_one” contains the ...

TeX will respond:

! Missing $inserted <inserted text>$
_
The file “test_
one” contains the ...
?

In LaTeX, the easiest way around this problem is to enclose the offending text in a “verbatim” macro, like this:

  The file “test_one” contains the ...

Note that the argument to the macrois delimited by any two identical characters (in this case, two “+” signs).

In Plain TeX or another format, the problem can be circumvented in similar ways; consult the reference for the format you are using. Also consult Table  Table 1.2 in Chapter Chapter 1, Chapter 1, for a list of special characters and how to type them in your documents.

### Missing Fonts

The first time that you use each font, TeX loads font metric information about the font. The font metric information, stored in a TFM file, includes information about the sizes of each character as well as kerning and ligature information. These topics are discussed fully in Chapter Chapter 5, Chapter 5.

If you request a font that does not exist, for example crm10 (a misspelling of cmr10), TeX cannot find a TFM file for the font and therefore displays:

Font \myfont=crm10 not loadable: Metric (TFM) file not found

This means that TeX attempted to associate the font described by the TFM file crm10.tfm with the control sequence \myfont, but the TFM file didn't exist. You must have a TFM file for every font that you use.

A second kind of error---actually, a warning---occurs when you are using the New Font Selection Scheme (NFSS). The NFSS performs font substitution, if possible, when an unknown font is requested. The NFSS is described in Chapter Chapter 4, Chapter 4, in the “the section called “LaTeX”” section.

### Everything Else

There are, unfortunately, lots of other errors that can occur. Some of the errors are directly related to TeX while others are warning and error messages associated with particular macro packages. There is no way to catalog every one of them or suggest what can be done in every case.

The best advice I can offer is to isolate the problem in as small a document as possible, consult the references you have available very carefully, and, if all else fails, forward your problem to one of the electronic forums that deal with TeX (the Info-TeX mailing list and the comp.text.tex newsgroup, for example).

## The Question Mark Prompt

When TeX encounters an error, it displays an error message and a summary of the error, as described in the section called “the section called “What About Errors?”” earlier in this chapter. Following the error, TeX normally stops and displays the question mark prompt.

If you type a question mark of your own at the prompt, TeX displays the actions available to you:

? ?
Type <return> to proceed,
S to scroll future error messages,
R to run without stopping, Q to run quietly,
I to insert something, E to edit your file,
1 or ... or 9 to ignore the next 1 to 9 tokens
of input, H for help, X to quit.
?

You can type any of the following responses at the question mark prompt:

Simply typing Return will cause TeX to ignore the error and proceed. Depending on the nature of the error, this may cause more errors immediately or later on.

Type S to scroll future error messages.

Typing S tells TeX to continue and not to stop for most future errors. TeX will continue to print the error messages, both to the terminal and to the log file, but it will not display the question mark prompt again.

Type R to run without stopping.

The R option is just like S except that it tells TeX to ignore missing files as well. TeX will proceed blindly forward as best as it can. You will still see all of the error messages scroll by as TeX proceeds.

Type Q to run quietly.

This option is just like R except that error messages are not displayed on the screen. The messages are saved in the log file, however, even though they are not displayed.

Type I to insert something.

If you notice a simple typo, you can correct it with the I command. For example, suppose that TeX complains of an undefined control sequence: \cte{kn:art1}. You recognize that this should have been \cite{kn:art1}. You can insert the correct control sequence by responding i\cite to the question mark prompt. TeX will ignore the misspelled control sequence and insert the (correct) sequence \cite in its place.

Inserting words or commands at the question mark prompt does not change your input file. It simply instructs TeX to pretend that your file contained a different sequence of words and commands. You must change the input file with an editor, or the same error will occur the next time you format the document.

Type E to edit your file.

This option terminates TeX. If your system is configured appropriately, an editor will be loaded automatically, and the cursor will be placed at the offending line in your input file. This is not possible in all environments.

Type n, where n is a number between 1 and 9.

This option tells TeX to ignore some of the input. After skipping over the number of tokens you request, TeX returns to the question mark prompt so that you can delete more tokens.

What's a token? When TeX reads an input file, it breaks each line down into the smallest, indivisible chunks that have meaning. These are called tokens. For the most part, tokens are individual characters. The exceptions are control sequences, which are single tokens, and white spaces which are also single tokens. There are other exceptions (and more technical definitions of “token”), but that's the gist of it.

Type H for help.

Typing H displays a slightly more verbose description of the error that occurred and, usually, suggests the nature of the corrective action that you might take.

Type X to quit.

Typing X tells TeX to stop immediately and ends the TeX program. If there are any completed pages (pages processed before the error, in other words), they are written to the DVI file before TeX ends.

[25] {The exception occurs in some unix versions of TeX where provisions are made for different architectures to share the same format files. The exact same version of TeX must be running on both architectures for this to work.}

[26] {The exact name of the environment variable differs between implementations.}

[27] You will notice that I've used backslashes to separate directory components in the path. Environment variables are handled by the system-dependent portions of TeX, so it's okay to use backslashes here. You can also use forward slashes, but I use backslashes because that is more typical of MS-DOS and OS/2 environments.

[28] {MS-DOS and OS/2 implementations of TeX may use Ctrl-Z (possibly followed by a carriage return) instead of Ctrl-C or Ctrl-D.}

[29] {On unix systems, the same effect is often achieved with symbolic links. Most unix implementations look for different standard format files based upon the name of the executable that starts them.}

[30] {In the unlikely event that you have a TeX document stored in a file with a name beginning with an ampersand, use the following trick to process that file: instead of running tex &file, run tex \input &file (or even tex &format \input &file).

[31] {For example, oak.oakland.edu in the directory /pub/msdos/4DOS.}

[32] {Typing the break character (Ctrl-C or Ctrl-Break, for example) sometimes works as well, but some implementations of TeX don't respond to the break character at every prompt. On unix systems, use Ctrl-D. EmTeX responds to Ctrl-Z followed by Return.}

[33] {The details of LaTeX and the NFSS are discussed in Chapter Chapter 4, Chapter 4. It is simply convenient to use a concrete example in this case. Do not be concerned if you do not use LaTeX or the NFSS.}

[34] {In practice, redefining a control sequence like $\$Large in a document is a bad idea. I've done it here only to provide an example of an error that occurs inside another macro.}

[35] {The number of lines of context shown in the error message is determined by the value of the built-in parameter $\$errorcontextlines.}

[36] {It is possible to make other formats the default, but in practice I've never seen it done.}

[37] Technically, LaTeX environment names are not a control sequence names, but they behave in very much the same way in LaTeX.

[38] {The empty curly braces are necessary in this example because otherwise there wouldn't be anything in front of the subscript command for TeX to subscript below. Typically, another digit or symbol would come in front of the subscript command. In this case, I didn't want the “H” and “O” in the math environment because letters are printed in math-italics in math mode.}


text:
# Math Help - logarithmic equation

1. ## logarithmic equation

Show that alogcb =blogca

2. ## Re: logarithmic equation

Originally Posted by Trefoil2727
Show that alogcb =blogca
$\\\text{If }a^{\log_c(b)}=b^{\log_c(a)}\\\text{then }\log_c(b)}\log_c(a)}=\log_c(a)}\log_c(b)}$

3. ## Re: logarithmic equation

A true "direct proof" would go the other way.
From the obviously true $log_c(b)log_c(a)= log_c(a)log_c(b)$, by a "property of logarithms"
$log_c\left(b^{log_c(a)}\right)= log_c\left(a^{log_c(b)}\right)$
and then take c to the power of each side.

Of course, Plato's proof is a perfectly good "synthetic proof" where you start with what you want to prove and manipulate it (here by taking the logarithm, base c, of both sides) to produce something that is "obviously true" and each step is reversible.

format: plain


text:
# Can I use a package resource here instead of exec?

Hi,

I have a system where the admins do not manage the YUM repos very well and yum installs have to specify the entire URL to a given RPM I need to install. So the command line would look this this ...

# yum -y install http://big.long.url/path/to/YUMREPO/RPMS/nameofrpm-0.1.01-1.noarch.rpm

# yum -y install nameofrpm

So I am under the impression that I my puppet code has to look like this ...

exec { "yum -y install $rpm_url": path => ['/usr/bin'], unless => "rpm -q$packagename",
}

package { "$packagename": ensure => installed, }  Is there still a way I could be using a Package resource type rather than an Exec? Thanks edit retag close merge delete ## 2 Answers Sort by » oldest newest most voted Maybe like so: class some_software { file { 'nameofrpm_rpm': path => '/var/cache/yum/noarch/42/nameofrpm.rpm' ensure => present, mode => '0644', owner => 'root', group => 'root', source => 'http://big.long.url/path/to/YUMREPO/RPMS/nameofrpm-0.1.01-1.noarch.rpm', } package { 'name_of_rpm': name => 'nameofrpm', ensure => latest, provider => yum, source => File['nameofrpm_rpm']['path'], require => File['nameofrpm_rpm'], } }  Yeah, no, according to the source attribute documentation for package resources the yum provider ignores the source attribute. Can you build upon the rpm provider? Are there package dependencies? Otherwise, you apparently can't achieve the behavior you wanted (calling yum), at least not with puppet's native resource types. more ## Comments I was going to comment to use the rpm provider with a source parameter, we have done that in the past, and I think I have seen a few modules in the wild with an option to override the package information with a path to an rpm ( 2017-03-22 07:38:16 -0600 )edit Why aren't your admins managing YUM repos very well? That seems to be both the cause and solution to your problem; get them to start managing those repositories. I recommend that you install a custom yum repository file in /etc/yum.repos.d that references the URL where your (custom?) package can be found. Puppet can manage YUM repos just fine. Just make sure to order the resources properly. A bit more hackishly: file {'/path/to/your/rpm': ensure => present, source => 'puppet:///wherever/your/rpm/is', } exec { "yum -y localinstall /path/to/your/rpm": path => ['/usr/bin'], unless => "rpm -q$packagename", requires => File['path/to/your/rpm', }

Of course, this is pseudo-code. Puppet will ensure the file is downloaded to your local OS first and then do a 'yum localinstall' on the RPM.

I still think using yum repos is a better way to manage what you're tring to accomplish.

more


text:
# Meaning of standard error of the coefficients in a regression model?

Recall the model for simple linear regression $$y_i = \beta_0 + \beta_1 x_i + \varepsilon_i.$$

I am reading up on the standard error of the coefficients $$\beta_0$$ and $$\beta_1$$. As an experiment I generated some linear data using $$\beta_0 = 1$$ and $$\beta_1 = 2$$ and added some Gaussian noise with unit variance. So then when I fit the data the lm function and used the summary function to examine the model I have the following output: \begin{align} \hat \beta_0 & = 1.21054 \quad \text{with Std. Error} = 0.11508, \\ \hat \beta_1 & = 1.87723 \quad \text{with Std. Error} = 0.09844. \end{align}

So how do I interpret the standard error values? For instance, take $$\hat \beta_0$$, precisely what is $$0.11508$$ telling me?

Obviously if I ran the simulation a second time, this time adding Gaussian noise with a higher amount of variance, the standard error would increase as the extra variance in the noise shows up as an increase in the standard error of the coefficients. But, if we consider the first simulation in isolation, then what does this value of $$0.11508$$ mean?

The standard error is the square root of an estimate of the sampling variability of $$\hat\beta_j$$ as an estimator of $$\beta_j$$, or $$\sqrt{\widehat{Var}(\hat\beta_j)}$$.

As this is many things in one sentence, step-by-step:

1. "Square-root": should be self-explanatory, to turn a variance into a standard deviation (that turns out to be what we need in, for example, t-statistics and confidence intervals).
2. "$$\hat\beta_j$$ as an estimator of $$\beta_j$$": we use the LS estimator to estimate the unknown parameter $$\beta_j$$.
3. To do so, we make use of a sample from the underlying population. Had we drawn another sample (or were to draw a fresh one tomorrow, etc.) we would get another estimate $$\hat\beta_j$$. This is the source of sampling variability. We may summarize that variability through the variance, $$Var(\hat\beta_j)$$. An expression for this variance may be found, e.g., here.
4. "An estimate of the sampling variability": $$Var(\hat\beta_j)$$ depends on unknown quantities (like the variance of the Gaussian noise that you generated), which must therefore be estimated, as captured by the formula $$\widehat{Var}(\hat\beta_j)$$. A formula for this estimator is, for example, given here, or, more introductory, here.
• My question is about what this particular value of $0.11508$ means. I know we will get different outcomes if we draw other samples. But for a single sample in isolation: what does it tell me when the coefficient is $1.21054$ with a standard error of $0.11508$? – ManUtdBloke Sep 2 '20 at 12:32
• In and of itself, it does not tell us too much, but it becomes interesting when coupled with the distribution of the LS estimator, which is normal under suitable assumptions. Since 95% of the realizations of a normal random variables are (roughly) fall into two standard deviations around the mean and since LS is unbiased (again, under suitable assumptions), we may, e.g., use the point estimate and the standard error to obtain a confidence interval, which is heuristically often interpreted as a range of plausible estimates for the true parameter. – Christoph Hanck Sep 2 '20 at 12:35
• – Christoph Hanck Sep 2 '20 at 12:36
• Alternatively, point estimate/standard error is the t-statistic for the null hypothesis that the true coefficient is zero. So with your numbers, the t-statistic would far exceed two, the critical value at the 5% level, so that you would reject the null at that level. – Christoph Hanck Sep 2 '20 at 12:39
• No, (e.g.) the first link in my comment above recalls how to build a confidence interval. What I want to alert to is that the language used there might indicate that confidence intervals are interpreted that is not afforded by their definition. – Christoph Hanck Sep 7 '20 at 8:05

It’s the usual definition of the standard error: the (estimated) standard deviation of the sampling distribution of $$\hat{\beta}_0$$.

If you were to replicate the work many times with new observations, you would get a distribution of values. Sometimes it would be higher than you observed this time, sometimes lower.

We use the standard error in parameter inference. Being loose, if the p-value on the parameter is less than $$0.05$$, corresponding to a point estimate about $$2$$ standard errors above or below $$0$$, then we might say that the population parameter is not zero, so that variable has a measurable impact on the outcome.

(There are all sorts of caveats about p-values, and discussing them really warrants a separate question (or a master’s degree in statistics).)

• My question is about what this particular value of $0.11508$ means. I know we will get different outcomes if we draw other samples. But for a single sample in isolation: what does it tell me when the coefficient is $1.21054$ with a standard error of $0.11508$? – ManUtdBloke Sep 2 '20 at 12:32
• It has to do with hypothesis testing and creating confidence intervals, same as usual. – Dave Sep 2 '20 at 13:24

If

\begin{align} \hat \beta_0 & = 1.21054 \quad \text{with Std. Error} = 0.11508, \\ \hat \beta_1 & = 1.87723 \quad \text{with Std. Error} = 0.09844. \end{align}

it means that the range of values for the coefficient estimates are

$$\hat \beta_0 = 1.21054 \pm 0.11508$$

and

$$\hat \beta_1 = 1.87723 \pm 0.09844$$

In other words, you can be confident that $$\beta_0$$ can take on values between $$1.09546$$ and $$1.32562$$.

As for your repeated question of

But for a single sample in isolation: what does it tell me when the coefficient is 1.21054 with a standard error of 0.11508

it is not relevant because the $$\beta$$s (and therefore the $$\sigma(\beta)$$s) are computed based on the entire sample set, not from one specific observation. A $$\beta$$ relates the entire $$y$$ sample set with the entire sample set being input for (one of) the corresponding $$x$$ vector.

I think what you mean to ask is, what does $$\hat \beta_0 = 1.21054 \pm 0.11508$$ mean for the output $$\hat{y}$$ of my fitted model if a new sample $$x_i=0.2$$ is observed. Well, since $$y = \beta_0 x + \beta_0 x + \epsilon$$, then the predicted output given that new input is

$$\hat{y}_i = (1.21054 \pm 0.11508) \times 0.2 + (\beta_1 \pm \sigma(\beta_1))\times 0.2 + \epsilon$$

• I don't understand $$\hat \beta_0 = 1.21054 \pm 0.11508$$ $\hat \beta_0 = 1.21054$... I think I know what you're trying to say, but the notation here doesn't really make sense. – Do not reinstate Monica Sep 2 '20 at 14:48
• In other words, you can be confident that $\beta_0$ can take on values between $1.09546$ and $1.32562$.--- What I am really interested in is precisely how confident can I be that $\beta_0$ will be within that range? – ManUtdBloke Sep 2 '20 at 15:45
• Thsi answer and your last question seem to have a somewhat Bayesian flavor. The standard error cannot be used to make such confidence statements. It would be too broad to explain the Bayesian idea here, though, but there are many excellent posts on this site on this approach. – Christoph Hanck Sep 3 '20 at 4:26
• @ChristophHanck The answer of Emil Bode below indicates that we can give confidence intervals based on these standard errors. Is this user incorrect? – ManUtdBloke Sep 6 '20 at 18:04

What you created here is a model, that tries to reflect reality. But of course, unless we are exceptionally lucky, the model will never reflect reality perfectly. And the standard deviations reflect how confident the model is about itself.

In your question, you stated you generated data with $$\beta_0 = 1$$ and $$\beta_1=2$$. Those numbers are the reality your model tries to reflect. Now suppose you didn't tell us those values, just your model. What can we say about your input?

The model tells us the most likely values are $$\beta_0 = 1.21042$$ and $$\beta_1=1.87223$$. But could it be that you that the actual values you put in (the reality) were $$1.2$$ and $$1.9$$? Well, therefore we have to look at the standard deviation.

With the given standard deviations, the model tells you it's $$68 \%$$ sure the true value of $$\beta_0$$ is in the range $$1.09546 - 1.32562$$ (minus 1 sd and plus 1 sd). And it's $$95 \%$$ sure the true value is in the range $$0.98038 - 1.4407$$ (2 sd away). For $$\beta_1$$, we can do a similar calculation. That means the numbers $$1.2$$ and $$1.9$$ are very reasonable guesses, but that $$1$$ and $$2$$ are also not too outlandish.

Now in reality, we often don't have access to the true values of $$\beta_0$$ and $$\beta_1$$. We can just take measurements, and make the best model we have. Or sometimes, theorists will come up with a theory that has to be tested on reality, to check whether the model is right or wrong.

As an experimental physicist, you'll run some experiments and maybe get the same values you got. You'll make a model, and can publish this to show that a theory that predicts $$\beta_0 = 0$$ and $$\beta_1=5$$ is most definitely wrong (if you can prove your experimental setup is correct). The values you got of $$1.21$$ and $$1.87$$ are basically your best guesses as to what the true values could be. But a theory that predicts $$\beta_0=1$$ and $$\beta_1=2$$ may well be correct.

Until you come up with an experiment that's more sensitive. Suppose you do the same, and get a model that shows: \begin{align} \hat \beta_0 & = 1.19554 \quad \text{with Std. Error} = 0.01279, \\ \hat \beta_1 & = 1.88341 \quad \text{with Std. Error} = 0.02369. \end{align}

These values allign quite well with your earlier result (showing there was likely no systemic error in your first experiment). But they have much narrower standard deviations, and now also show the theory with $$\beta_0=1$$ and $$\beta_1=2$$ is also wrong. But the guesses of $$1.2$$ and $$1.9$$ are still holding.


text:
alignat problem

Whenever I try to use the alignat environment, it doesn't seem to work on my computer! I tried the following simple code (my file had \usepackage{amsmath}):

\begin{alignat}{3}
\min \quad x_1        & + 2x_2 & + 4x_3 &      &   & \\
\text{s.t.} \quad x_1 & + x_2  & + 3x_3 & =    & 5 & \\
2x_1                  & + x_2  & + 6x_3 & =    & 8 & \\
x_1                   &, x_2   &, x_3   & \geq & 0 & .
\end{alignat}

On compilation, I get the following error:

    ! Missing # inserted in alignment preamble.  <to be read again>
\crcr l.114   \end{alignat}

Any ideas why this might be?

-
That code works for me. Does it work for you if you just use that in an otherwise empty document? –  TH. Aug 18 '10 at 3:51

It's been a while, and you probably fixed your problem by now. But since another question involving alignat (well, my answer involves it anyway) came up, and this question scores quite high for the google query latex alignat, I wanted to make sure that there's more information here....

I'm not sure what you are trying to align. I'm assuming you want the x_i's aligned, in which case the correct solution would be

\begin{alignat}{3}
\min \quad x_1& {}+{}& 2x_2& {}+{}& 4x_3& \\
\text{s.t.} \quad x_1& {}+{}&x_2&{}+{} & 3x_3&=5\\
2x_1& {}+{}& x_2& {}+{}&6x_3& = 8\\
x_1&, &x_2&, &x_3& \geq 0 .
\end{alignat}

which produces:

As you see, you need to put alignment characters between the columns to be aligned, not only inside the columns.

-
There is a lot of missing white space in your example. You should perhaps write {}+{} instead of +? –  Jukka Suomela Oct 18 '10 at 19:45
Thanks Jukka! Fixed it. –  Yossi Farjoun Oct 18 '10 at 20:33
Explaining why the {}+{} are needed: (I think) LaTeX typesets the spaces around binary operators differently than it does around unitary ones. we would want +r to have less space between the two characters than b+r. And since each column in alignat is typeset separately, it doesn't "see" that the +'s are binary operators. –  Yossi Farjoun Oct 18 '10 at 20:35

Your code also compiles for me, and as Lev suggested constructing a minimal example will really help to narrow down where your problem lies, but I was able to generate a similar error to what you have by incorrectly using the tabular environment inside the alignat environment.

For example,

\begin{document}
\begin{alignat}{3}
\begin{tabular}{||}
test
\end{tabular}
\end{alignat}

results in the error

! Missing # inserted in alignment preamble.
\cr
l.9 \end{alignat}

Since the l.9 and l.114 just refer to line numbers in the code, the main difference is that my error includes \cr where yours says \crcr.

I can solve my alignment preamble error by using at least one correct column alignment character in the tabular environment, for example by switching to \begin{tabular}{|c|}.

-


text:
# Nonlinear finite elements/Homework 6/Solutions/Problem 1/Part 11

## Problem 1: Part 11

Compute the rate of deformation at the blue point.

The rate of deformation is given by

$\boldsymbol{D} = \frac{1}{2}[\boldsymbol{\nabla} \mathbf{v} + (\boldsymbol{\nabla} \mathbf{v})^T] ~.$

Using the velocity gradient from the previous question, the rate of deformation at the blue point is given by

$\mathbf{D} = \begin{bmatrix} 0.74184 & -1.2418 \\ -1.2418&1.7418 \end{bmatrix}$

The Maple code is given below.

> #
> # Compute rate of deformation
> #


text:
Problem 4: In a sample of 1000 Yuba College students, it was found that they consumed...

Question:

Problem 4: In a sample of 1000 Yuba College students, it was found that they consumed on average 23 grams of sugar with a standard deviation of 4 grams and that 230 planned to transfer to Chico State. a) (7 points) Can we conclude with 99% confidence that Yuba College students consume on average over 20 grams of sugar? Use the rejection region approach