[comp.text.tex] LaTeX problem

stanly@crunch.unm.edu (Stanly Steinberg) (09/27/90)

At the beginning of the source the LaTeX for a document, I have the following:

\documentstyle[12pt]{article}
\renewcommand{\theequation}{\thesection.\arabic{equation}}
\renewcommand{\thefigure}{\thesection.\arabic{figure}}
\renewcommand{\thetable}{\thesection.\arabic{table}}

In Section 3, I have a figure and a table that are labelled with
a \label{xxx} command. In the figure and table captions and in the
list of figures and list of tables, the numbering is correct (3.1)
but when \ref{xxx} is used it produces only a 3 (i.e. the .1 is  missing).
Does anyone have a fix for this?

I do not read this newsgroup so please reply directly to me.
--
Professor Stanly Steinberg, Department of Mathematics and Statistics
University of New Mexico, Albuquerque, NM 87131, 505 277 5323
stanly@crunch.unm.edu    stanly@unmb.bitnet

piet@cs.ruu.nl (Piet van Oostrum) (09/27/90)

>>>>> In article <1990Sep26.185900.1879@ariel.unm.edu>, stanly@crunch.unm.edu (Stanly Steinberg) (SS) writes:

SS> At the beginning of the source the LaTeX for a document, I have the following:

SS> \documentstyle[12pt]{article}
SS> \renewcommand{\theequation}{\thesection.\arabic{equation}}
SS> \renewcommand{\thefigure}{\thesection.\arabic{figure}}
SS> \renewcommand{\thetable}{\thesection.\arabic{table}}

SS> In Section 3, I have a figure and a table that are labelled with
SS> a \label{xxx} command. In the figure and table captions and in the
SS> list of figures and list of tables, the numbering is correct (3.1)
SS> but when \ref{xxx} is used it produces only a 3 (i.e. the .1 is  missing).
SS> Does anyone have a fix for this?

This is one of the standard errors: the correct place for the \label is IN
the \caption argument or after the \caption command (LaTeX book, page 72).
-- 
Piet* van Oostrum, Dept of Computer Science, Utrecht University,
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
Telephone: +31 30 531806   Uucp:   uunet!mcsun!ruuinf!piet
Telefax:   +31 30 513791   Internet:  piet@cs.ruu.nl   (*`Pete')

scherock@ALLEGRO.MIT.EDU ("Stephen F. Scherock") (03/07/91)

 
 
I have compiled TeX from web2c5.8a.tarZ on both a Sun 4 (SunOS 4.1)
and a Decstation 5000 (ULTRIX 4.0).  Both pass the trip test.  I am
using the plain.tex (version 3.0) macro from labrea, and slightly
modified lplain.tex (version 2.09-February 8, 1990) from labrea.  The
modifications were as suggested in the web2c package (using a small
file lplain3.tex that set \lefthyphenmin and \righthyphenmin).
 
Now for the problem:  None of the popular "spacing" macros work
properly (I'm speaking of setspace.sty, doublespace.sty, and
fnspacing.tex).  They invariably produce errors like the following:
 
Input File:
    \documentstyle[doublespace]{article}
 
    \begin{document}
 
    Now is the time for all good men to come to the aid of their country.
    Now is the time for all good men to come to the aid of their country.
    Now is the time for all good men to come to the aid of their country.
    Now is the time for all good men to come to the aid of their country.
    Now is the time for all good men to come to the aid of their country.
 
    \begin{onehalfspace}
    Now is the time for all good men to come to the aid of their country.
    Now is the time for all good men to come to the aid of their country.
    Now is the time for all good men to come to the aid of their country.
    \end{onehalfspace}
 
    Now is the time for all good men to come to the aid of their country.
    Now is the time for all good men to come to the aid of their country.
 
    \end{document}
 
LaTeX run:
    This is TeX, C Version 3.1
    (test.tex
    LaTeX Version 2.09 <7 Dec 1989>
    (/v/lib/tex/macros/article.sty
    Document Style `article' <16 Mar 88>.
    (/v/lib/tex/macros/art10.sty)) (/v/lib/tex/local-macros/doublespace.sty)
    (test.aux)
    LaTeX error.  See LaTeX manual for explanation.
                  Type  H <return>  for immediate help.
    ! \begin{document} ended by \end{onehalfspace}.
    \@latexerr ...for immediate help.}\errmessage {#1}
 
    \@checkend ...empa \@currenvir \else \@badend {#1}
                                                      \fi
    \end #1->\csname end#1\endcsname \@checkend {#1}
                                                    \if@endpe \global \let \@gte
..
    l.15 \end{onehalfspace}
 
In other words, the \end{whateverspacingmacro} causes latex to barf.
This happens with all three macros sets.  To the best of my
understanding, latex is interpreting the \endgroup (in the \end{.}
macro) as ending the document environment.  If I wrap the spacing
envronment in another environment, latex thinks that environment has
been ended by the \endgroup.  If I just ignore the error, latex seems
to do the right thing.  Since I get the error on both machines, I'm
sure that its either a genuine bug, or I have a bad file.  Do you have
any clues?
 
Thanks
 
Stephen Scherock
scherock@dspvax.mit.edu
 
P.S.  I had to turn off all optimizations to compile on the
      decstation, OPT=-O0
 
P.P.S.  I posted this to comp.text.tex a week or so ago, and got one
reply from an OzTeX user who had the same problem!  Also, during the
past week, I successfully compiled TeX on an HP (you guessed it, same
problem).  Finally, TeX, C Version 3.0 on athena (MIT's big academic
computing project) does not have the bug.  I don't know what version
of lplain or plain they have.
 
 
 
 

Schoepf@SC.ZIB-BERLIN.DBP.DE (Rainer Schoepf) (03/07/91)

   From: "Stephen F. Scherock" <scherock@allegro.mit.edu>
 
   I have compiled TeX from web2c5.8a.tarZ on both a Sun 4 (SunOS 4.1)
   and a Decstation 5000 (ULTRIX 4.0).  Both pass the trip test.  I am
   using the plain.tex (version 3.0) macro from labrea, and slightly
   modified lplain.tex (version 2.09-February 8, 1990) from labrea.  The
   modifications were as suggested in the web2c package (using a small
   file lplain3.tex that set \lefthyphenmin and \righthyphenmin).
 
Note that lplain.tex and splain.tex have been updated accordingly, the
files are available at least from labrea and Heidelberg.
 
   Now for the problem:  None of the popular "spacing" macros work
   properly (I'm speaking of setspace.sty, doublespace.sty, and
   fnspacing.tex).  They invariably produce errors like the following:
 
    (omitted)
 
Sorry, that's correct behaviour.  This is due to a bug fix in
latex.tex made in May 89.  Previously, LaTeX's check of environment
nesting was not correct.
 
The spacing environments in doublespace.sty use an \endgroup ...
\begingroup trick that messes up the new check mechanism.
 
Probably you should ask the author of doublespace.sty to correct the file.
 
   problem).  Finally, TeX, C Version 3.0 on athena (MIT's big academic
   computing project) does not have the bug.  I don't know what version
   of lplain or plain they have.
 
This means that their version of LaTeX is at least two years old (see
above).
 
Rainer Schoepf
 
 
   Dr. Rainer Schoepf
   Konrad-Zuse-Zentrum fuer Informationstechnik Berlin
   Heilbronner Strasse 10
   D-1000 Berlin 31
   Federal Republic of Germany
   <Schoepf@sc.ZIB-Berlin.dbp.de> or <Schoepf@sc.ZIB-Berlin.de>