Strange behaviour (to me) of [

20 views
Skip to first unread message

William Unruh

unread,
Nov 24, 2022, 12:50:21 PM11/24/22
to
Running in Latex , I have an equations

\bea
[\Phi(u,v),\Pi(u',v') ]_{(u+v=u'+v')}&=& i \delta((v-u-(v'-u'))/2)
\\
[\Phi(u,v),\Phi(u',v') ]_{u+v=u'+v'}&=&0
\\
[\Pi(u,v),\Pi(u',v') ]_{u+v=u'+v'}&=&0
\eea

(\bea is \begin{eqnarray} and \eea is \end{eqnarray})
The first equation lines is OK, but the second gives me the error

! Illegal unit of measure (pt inserted).
<to be read again>
(
l.107 [\Phi(u,v),\Phi(u',v') ]
_{u+v=u'+v'}&=&0
?

(that is of course the second equation line above)

If I replace those [ with \lbrack it works properly. but of course while
typing, [ is much easier than \lbrack and reads more easily as well
while proofreading the tex.


What am I not understanding about [ in this context

Ulrike Fischer

unread,
Nov 24, 2022, 1:24:38 PM11/24/22
to
Am Thu, 24 Nov 2022 17:50:15 -0000 (UTC) schrieb William Unruh:

> Running in Latex , I have an equations
>
> \bea
> [\Phi(u,v),\Pi(u',v') ]_{(u+v=u'+v')}&=& i \delta((v-u-(v'-u'))/2)
> \\
> [\Phi(u,v),\Phi(u',v') ]_{u+v=u'+v'}&=&0
> \\
> [\Pi(u,v),\Pi(u',v') ]_{u+v=u'+v'}&=&0
> \eea
>
> (\bea is \begin{eqnarray} and \eea is \end{eqnarray})

Avoid eqnarray https://tug.org/pracjourn/2006-4/madsen/madsen.pdf

And avoid such shortened definitions. It makes your source less
readable for other and disables the environment checking of your
editor.

> The first equation lines is OK, but the second gives me the error
>
> ! Illegal unit of measure (pt inserted).
> <to be read again>
> (
> l.107 [\Phi(u,v),\Phi(u',v') ]
> _{u+v=u'+v'}&=&0
> ?
>
> (that is of course the second equation line above)
>
> If I replace those [ with \lbrack it works properly. but of course while
> typing, [ is much easier than \lbrack and reads more easily as well
> while proofreading the tex.
>
>
> What am I not understanding about [ in this context

\\ takes an optional argument, \\[5pt] or \\ [5pt] inserts a space,
and with eqnarray it finds the [ on the next line and then complains
that no dimension follows.

Use amsmath and align:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
[\Phi(u,v),\Pi(u',v') ]_{(u+v=u'+v')}&=i \delta((v-u-(v'-u'))/2)
\\
[\Phi(u,v),\Phi(u',v') ]_{u+v=u'+v'}&=0
\\
[\Pi(u,v),\Pi(u',v') ]_{u+v=u'+v'}&=0
\end{align}

\end{document}

William Unruh

unread,
Nov 24, 2022, 9:57:23 PM11/24/22
to
On 2022-11-24, Ulrike Fischer <ne...@nililand.de> wrote:
> Am Thu, 24 Nov 2022 17:50:15 -0000 (UTC) schrieb William Unruh:
>
>> Running in Latex , I have an equations
>>
>> \bea
>> [\Phi(u,v),\Pi(u',v') ]_{(u+v=u'+v')}&=& i \delta((v-u-(v'-u'))/2)
>> \\
>> [\Phi(u,v),\Phi(u',v') ]_{u+v=u'+v'}&=&0
>> \\
>> [\Pi(u,v),\Pi(u',v') ]_{u+v=u'+v'}&=&0
>> \eea
>>
>> (\bea is \begin{eqnarray} and \eea is \end{eqnarray})
>
> Avoid eqnarray https://tug.org/pracjourn/2006-4/madsen/madsen.pdf

Ah yes. Reminds me of the vi vs emacs wars.
"Full of sound and fury, signifying little"

From what I have read it would seem that array has just as many
infelicities or messiness as does eqnarray.


>
> And avoid such shortened definitions. It makes your source less
> readable for other and disables the environment checking of your
> editor.

It makes typing my manuscript easier, which for me is the a dominant
requirement.
After all I could also carve my equations into granite as well, and they
would last much longer and my freedom for generating just the layout I
want would be much greater :-)
>
>> The first equation lines is OK, but the second gives me the error
>>
>> ! Illegal unit of measure (pt inserted).
>> <to be read again>
>> (
>> l.107 [\Phi(u,v),\Phi(u',v') ]
>> _{u+v=u'+v'}&=&0
>> ?
>>
>> (that is of course the second equation line above)
>>
>> If I replace those [ with \lbrack it works properly. but of course while
>> typing, [ is much easier than \lbrack and reads more easily as well
>> while proofreading the tex.
>>
>>
>> What am I not understanding about [ in this context
>
> \\ takes an optional argument, \\[5pt] or \\ [5pt] inserts a space,
> and with eqnarray it finds the [ on the next line and then complains
> that no dimension follows.

Ah. That I certainly never knew. Another suggestion I found was to use either
{[} or \lbrack. I guess {}[ would also work. All are a pain, but I guess
necessary given the peculiarity of latex.
>
> Use amsmath and align:
>
> \documentclass{article}
> \usepackage{amsmath}
>
> \begin{document}
> \begin{align}
> [\Phi(u,v),\Pi(u',v') ]_{(u+v=u'+v')}&=i \delta((v-u-(v'-u'))/2)
> \\
> [\Phi(u,v),\Phi(u',v') ]_{u+v=u'+v'}&=0
> \\
> [\Pi(u,v),\Pi(u',v') ]_{u+v=u'+v'}&=0
> \end{align}

But if \\ takes an optional argument won't this have the same problem? Or is it
just \\ in the eqnarray environment that has the problems?

Just tried it, and it does not seem to be a problem in the align
environment.


>
> \end{document}
>

Axel Berger

unread,
Nov 25, 2022, 4:50:08 AM11/25/22
to
William Unruh wrote:
> It makes typing my manuscript easier,

That is you editor's job. You define shortcuts for typing and have them
expanded. Thus you could e.g. have "<bea" (inspired by HTML but also
because on a German keyboard "<" is easy but "\" a pain) expand to

\begin{eqnarray}

\end{eqnarray}

with the cursor in the empty middle line. Your editor can't do that and
can't be configured to do it exactly the way you want it to? Ditch it!


--
/¯\ No | Dipl.-Ing. F. Axel Berger Tel: +49/ 221/ 7771 8067
\ / HTML | Roald-Amundsen-Straße 2a Fax: +49/ 221/ 7771 8069
 X in | D-50829 Köln-Ossendorf http://berger-odenthal.de
/ \ Mail | -- No unannounced, large, binary attachments, please! --

Peter Flynn

unread,
Nov 25, 2022, 8:00:18 AM11/25/22
to

Am Thu, 24 Nov 2022 17:50:15 -0000 (UTC) schrieb William Unruh:

> Running in Latex , I have an equations
>
> \bea
> [\Phi(u,v),\Pi(u',v') ]_{(u+v=u'+v')}&=& i \delta((v-u-(v'-u'))/2)
> \\
> [\Phi(u,v),\Phi(u',v') ]_{u+v=u'+v'}&=&0
> \\
> [\Pi(u,v),\Pi(u',v') ]_{u+v=u'+v'}&=&0
> \eea
>
> (\bea is \begin{eqnarray} and \eea is \end{eqnarray})

> On 2022-11-24, Ulrike Fischer <ne...@nililand.de> wrote:
>> Avoid eqnarray https://tug.org/pracjourn/2006-4/madsen/madsen.pdf
>
> Ah yes. Reminds me of the vi vs emacs wars.
> "Full of sound and fury, signifying little"

Macbeth, of course, used Emacs :-)

>> And avoid such shortened definitions. It makes your source less
>> readable for other and disables the environment checking of your
>> editor.
>
> It makes typing my manuscript easier, which for me is the a dominant
> requirement.

Yes, always a good reason, and if you are the only person ever to need
to read or edit the source code, I can see the attraction.

Do none of the many editors which insert markup for you meet the
requirements?

>> \\ takes an optional argument, \\[5pt] or \\ [5pt] inserts a space,
>
> Ah. That I certainly never knew.

It would be enormously useful to those of us who write documentation if
you could let us know how we are missing telling people this.

> Another suggestion I found was to use either {[} or \lbrack. I guess
> {}[ would also work. All are a pain, but I guess necessary given the
> peculiarity of latex.

Another good reason for using an editor which understands the syntax :-)

Peter

William Unruh

unread,
Nov 25, 2022, 2:56:02 PM11/25/22
to
Many (most) of the comments on \\ that I found on the web simply state
that gives line break (equivalent to \cr in tex) and \\* supresses page breaks. Some say "takes an
optional argument" sometimes.
For example \\ in the align enviroment apparently does not take an
optional argument. In the eqnarray environment it does even if the [ is
in a separate line and separated by spaces. So it seems \\ is a mess,
not eqnarray:-)

>
>> Another suggestion I found was to use either {[} or \lbrack. I guess
>> {}[ would also work. All are a pain, but I guess necessary given the
>> peculiarity of latex.
>
> Another good reason for using an editor which understands the syntax :-)

I use vim
It does not seem to understand this syntax.

By the way, another nice feature of the eqnarray is that it understands
the presence of 0 1 or 2 & in the equations. And it understands 0 or
many \\ in the set of equations. Which means I can use it as
a generic equation designator without having to worry about a single
line equation, or a multiline equation, with 0 1 or 2 & in them.
(well you have to be careful with one & as it will center the second
part of the equation, unlike align which left justfies it-- an error
which is immediately obvious in the formatted text.)

>
> Peter

Axel Berger

unread,
Nov 25, 2022, 3:26:14 PM11/25/22
to
William Unruh wrote:
> So it seems \\ is a mess, not eqnarray:-)

Some environments redefine stuff inside them. So it is with all kinds of
tables, of which arrays are asubset, and newlines. All this can be found
in the doc of the environments involved and Lamport himself says quite a
bit about it. His user's guide is something everyone ought to read in
full at least once and keep to hand after.

Ulrike Fischer

unread,
Nov 25, 2022, 3:57:27 PM11/25/22
to
Am Fri, 25 Nov 2022 19:55:56 -0000 (UTC) schrieb William Unruh:

> For example \\ in the align enviroment apparently does not take an
> optional argument. In the eqnarray environment it does even if the [ is
> in a separate line and separated by spaces. So it seems \\ is a mess,
> not eqnarray:-)

\\ takes an optional argument in align too:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align}
a&=b
\\[2cm]
c&=d
\end{align}

\end{document}

But align requires that there is no space or line break, and so it
doesn't fail in your case.

And eqnarray is faulty. There is no doubt about it. You should
really read the article to see the problems.


--
Ulrike Fischer
http://www.troubleshooting-tex.de/

Peter Flynn

unread,
Nov 25, 2022, 5:04:19 PM11/25/22
to
On 25/11/2022 19:55, William Unruh wrote:
> On 2022-11-25, Peter Flynn <pe...@silmaril.ie> wrote:
[...]
>> It would be enormously useful to those of us who write documentation if
>> you could let us know how we are missing telling people this.
>
> Many (most) of the comments on \\ that I found on the web simply
> state that gives line break (equivalent to \cr in tex) and \\*
> suppresses page breaks.

Thank you; that is very useful. This sounds like rough-and-ready
documentation written by people who themselves don't know the facts.

> Some say "takes an optional argument" sometimes.
I don't know which is worse, failing to say it takes an argument, or
saying that it does so sometimes without saying when.

> For example \\ in the align enviroment apparently does not take an
> optional argument. In the eqnarray environment it does even if the [
> is in a separate line and separated by spaces. So it seems \\ is a
> mess, not eqnarray :-)

As Axel said, "Some environments redefine stuff inside them." All we can
do is document the default behaviour. It's up to the authors of packages
to identify when their package modifies that behaviour. Yes, it's a
mess, but it is all there.

> By the way, another nice feature of the eqnarray is that it understands
[snip]

I'll leave that to the mathematicians :-)

Peter

William Unruh

unread,
Nov 25, 2022, 9:11:38 PM11/25/22
to
I did. I am not convinced.
>
>

Ulrich D i e z

unread,
Nov 26, 2022, 8:04:03 AM11/26/22
to
William Unruh schrieb:

> It makes typing my manuscript easier, which for me is the a dominant
> requirement.

Having an editor type longer sequences of text into your .tex-input-file
when you type shortcuts to the editor is also a convenient way of
easing up typing the manuscript.

> Ah. That I certainly never knew. Another suggestion I found was to use either
> {[} or \lbrack. I guess {}[ would also work. All are a pain, but I guess
> necessary given the peculiarity of latex.

In order to prevent \\ from finding [ and taking that for an optional argument
you can append \relax or \empty, i.e., do s.th. like \\\relax or \\\empty :

\begin{<whatsoever environment>}
[\Phi(u,v),\Pi(u',v') ]_{(u+v=u'+v')}&=& i \delta((v-u-(v'-u'))/2)
\\\empty
[\Phi(u,v),\Phi(u',v') ]_{u+v=u'+v'}&=&0
\\\empty
[\Pi(u,v),\Pi(u',v') ]_{u+v=u'+v'}&=&0
\end{<whatsoever environment>}

Ulrich
Reply all
Reply to author
Forward
0 new messages