[Tuglist] Environment slide in pdfscreen.sty

Manoj K N tuglist@tug.org.in
Wed, 12 Jun 2002 14:59:50 +0530


On Wed, Jun 12, 2002 at 09:59:32AM +0200, David Kastrup wrote:

> Manoj K N <knm@india.ti.com> writes:
> 
> > On Tue, Jun 11, 2002 at 09:29:33PM +0530, Radhakrishnan CV wrote:
> > 
> > > Figure environment can't be used inside slide because it is already a
> > > minipage. However you can make use of \caption command provided you
> > > define \@captype.
> > > 
> > >  \def\@captype{figure}
> > 
> > It did not work, but its following variant worked:
> > 
> > \makeatletter\newcommand{\@captype}{figure}\makeatother
> > 
> > What is the difference? With the first command, the following error
> > appeared.
> > 
> > ! Undefined control sequence.
> > <argument> c@\@captype 
> >                        
> > l.184 \caption
> >               {Binary Symmetric Channel}\label{fig:bsc}
> > ? 
> 
> The difference is the \makeatletter...\makeatother that allows making
> @ part of command names.  That the first version does not immediately
> give an error message does not mean a thing:  you redefine the macro
> \@ with a mandatory argument of captype to evaluate to figure.
> 
> Now, when you will write
> \@captype
> in your text (without \makeatletter, \makeatother), it will produce
> figure, if you type \@ followed by anything else you will get a "use
> of \@ does not match its definition" error.

Do you mean that there is a macro \@ with a mandatory argument already
defined in TeX, or is it my \def statement that defines it?

I removed the line \makeatletter....\makeatother and reinserted the line  

\def\@captype{figure}

in my code. With the lines 

! Undefined control sequence.
<argument> c@\@captype 
                       
l.208 \caption
              {Binary Symmetric Channel}\label{fig:bsc}
? 

! Undefined control sequence.
 ...rrmessage  LaTeX Error: No counter '\@captype 
                                                  ' defined.^^J^^JSee the
La...
l.208 \caption
              {Binary Symmetric Channel}\label{fig:bsc}
? 

This is what I understood by reading latex.ltx

\caption has a line \refstepcounter\@captype, which uses \stepcounter; that
uses \addtocounter. This is the code for \addtocounter.

\def\addtocounter#1#2{%
  \@ifundefined{c@#1}%
    {\@nocounterr{#1}}%
    {\global\advance\csname c@#1\endcsname #2\relax}}


Had the line \@ifundefined{c@#1}% been true, we would have got the error
`No counter \@captype not defined' as the first error, wouldn't we? Is it
the line \@ifundefined{c@#1}% that causes the first error to appear?

Thanks.

Manoj.



-- 
Manoj K N,
Texas Instruments India Limited, 
Diamond District, Airport Road, 
Bangalore. PIN: 560037. Karnataka. India.

Ph: +91-80-5099894

12.58 N, 77.39 E