[comp.text.tex] Latex bug???

knuutila@tucos.utu.fi (Timo Knuutila) (02/20/91)

Just encountered the following. Can someone please explain why the text
produces `weird errors' with LaTeX.

=== EXAMPLE TEXT ===
\documentstyle{report}
\begin{document}
$$\begin{array}{l}
[b_1]\\
\ldots\\
[b_m]
\end{array}$$
\end{document}

=== LOG FILE ===
! Missing number, treated as zero.
<to be read again> 
                   b
...
l.8 [b_m]
         
? 
! Illegal unit of measure (pt inserted).
<to be read again> 
                   b
...
l.8 [b_m]
         
? 
! Missing = inserted for \ifdim.
<to be read again> 
                   b
...
l.8 [b_m]
         
? 
! Missing number, treated as zero.
<to be read again> 
                   b
...
l.8 [b_m]
         
? 
! Illegal unit of measure (pt inserted).
<to be read again> 
                   b
...
l.8 [b_m]
=== END OF LOG FILE ===

The following works just fine ({} inserted before [b_m]):

\documentstyle{report}
\begin{document}
$$\begin{array}{l}
[b_1]\\
\ldots\\
{}[b_m]
\end{array}$$
\end{document}

Regards,

     Timo Knuutila
     knuutila@cs.utu.fi

sanders-malcolm@CS.YALE.EDU (SANDERS-MALCOLM) (02/21/91)

In article <1991Feb20.145148.13403@polaris.utu.fi> knuutila@tucos.utu.fi (Timo Knuutila) writes:

>  Just encountered the following. Can someone please explain why the text
>  produces `weird errors' with LaTeX.
>
>  === EXAMPLE TEXT ===
>  \documentstyle{report}
>  \begin{document}
>  $$\begin{array}{l}
>  [b_1]\\
>  \ldots\\
>  [b_m]
>  \end{array}$$
>  \end{document}
>
>   === LOG FILE ===
   [much complaining ...]
>   === END OF LOG FILE ===
>
>   The following works just fine ({} inserted before [b_m]):
...

If you check out the definition of the latex "\\" command(section C.1.6
in the Latex Manual), you will find that it has an optional length 
argument and the proper syntax is "\\[len]".  As long as the next 
character after a "\\" is anything other than "[", then there is
no problem. If the next character *is* a "[", however, then the 
following text must be a length followed by "]", or else latex 
complains.  The string, "b_m" is not a lenght, hence, putting "\\[b_m]" 
causes a problem. Using "\\{}[b_m]" instead fixes it.

Malcolm Sanders
Applied Physics
Yale University			sanders@ycc.yale.edu

yxoc@cs.uni-sb.de (Ralf Treinen) (02/21/91)

In article <1991Feb20.145148.13403@polaris.utu.fi> knuutila@tucos.utu.fi (Timo Knuutila) writes:

   Just encountered the following. Can someone please explain why the text
   produces `weird errors' with LaTeX.

   $$\begin{array}{l}
   [b_1]\\
   \ldots\\
   [b_m]
   \end{array}$$

   === LOG FILE ===
   ! Missing number, treated as zero.

The reason is that a specification of an additional vertical space in 
brackets may follow the \\ command (see page 153 of the LaTeXbook).
As Timo Knuutila said in his original posting, a {} between the \\ and
the offending brackets solves the problem.

Ralf.
--
 Ralf Treinen                         | email: treinen@cs.uni-sb.de          
 FB 14 - Informatik (Dept. of CS)     |
 Universitaet des Saarlandes          | phone: +49 681 302 2065
 W-6600 Saarbruecken , Germany        | fax:   +49 681 302 4421

krab@iesd.auc.dk (Kresten Krab Thorup) (02/22/91)

>>>>> On 20 Feb 91 14:51:48 GMT, knuutila@tucos.utu.fi (Timo Knuutila) said:


Timo> Just encountered the following. Can someone please explain why the text
Timo> produces `weird errors' with LaTeX.

Timo> === EXAMPLE TEXT ===
Timo> \documentstyle{report}
Timo> \begin{document}
Timo> $$\begin{array}{l}
Timo> [b_1]\\
Timo> \ldots\\
Timo> [b_m]
Timo> \end{array}$$
Timo> \end{document}

Timo> === LOG FILE ===
Timo> ! Missing number, treated as zero.
Timo> <to be read again> 
Timo>                    b
Timo> ...
Timo> l.8 [b_m]
Timo>          
Timo> ? 
Timo> ! Illegal unit of measure (pt inserted).
Timo> <to be read again> 
Timo>                    b
Timo> ...
Timo> l.8 [b_m]
Timo>          
 ...
 ... <stuff deleted>
 ...
Timo> === END OF LOG FILE ===

This is NOT a bug in LaTeX - It's a bug in your input file!

When LaTeX reads the `\\' it can optionally read a dimen in square
braces specifying the interline skip. E.g. you could say: 

     bloops & bloops \\[1in]

Which would produce one inch of space after this line.

Timo> The following works just fine ({} inserted before [b_m]):

Timo> \documentstyle{report}
Timo> \begin{document}
Timo> $$\begin{array}{l}
Timo> [b_1]\\
Timo> \ldots\\
Timo> {}[b_m]
Timo> \end{array}$$
Timo> \end{document}

That's true -  The scan for the [??] stops when LaTeX reads the {}.

/Kresten
--


			        /  |__  __/   |  /
			       /_/_|   / ___/   |
			    _____/  __/ __/__/__|
				     ____/

			LaTeX's not crap --- that's me