ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* first page special numbering
@ 2000-11-04 22:33 Ed L Cashin
  2000-11-05 21:17 ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Ed L Cashin @ 2000-11-04 22:33 UTC (permalink / raw)


Hi.  Often, very simple papers will have the first page with a page
number at the bottom and all following pages will have a pagenumber at
the top.  This is how I did it just now:

    \setuppagenumbering [location=]
    \setupheadertexts   [\ifnum\pageno=1\else\pagenumber\fi]
    \setupfootertexts   [\ifnum\pageno=1 1\fi]

(Strangely, if I say, "\ifnum\pageno=1\pagenumber\fi", then nothing is
printed, yet when I use a literal "1" it works as expected.)

Is there a more idiomatic way that I'm missing?    

-- 
--Ed Cashin                     PGP public key:
  ecashin@coe.uga.edu           http://www.coe.uga.edu/~ecashin/pgp/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: first page special numbering
  2000-11-04 22:33 first page special numbering Ed L Cashin
@ 2000-11-05 21:17 ` Hans Hagen
  2000-11-06 15:26   ` Ed L Cashin
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2000-11-05 21:17 UTC (permalink / raw)
  Cc: NTG-ConTeXt mailing list

At 05:33 PM 11/4/00 -0500, Ed L Cashin wrote:
>Hi.  Often, very simple papers will have the first page with a page
>number at the bottom and all following pages will have a pagenumber at
>the top.  This is how I did it just now:
>
>    \setuppagenumbering [location=]
>    \setupheadertexts   [\ifnum\pageno=1\else\pagenumber\fi]
>    \setupfootertexts   [\ifnum\pageno=1 1\fi]
>
>(Strangely, if I say, "\ifnum\pageno=1\pagenumber\fi", then nothing is
>printed, yet when I use a literal "1" it works as expected.)
>
>Is there a more idiomatic way that I'm missing?    

Well, to mention a few:

% interface=en

%\setupfootertexts[\ifnum\pageno=1 \pagenumber\fi]
%\setupfootertexts[\doif{\folio}{1}{\pagenumber}]
\setupfootertexts[\ifnum\realpageno=1 \pagenumber\fi]
%\setupfootertexts[\doif{\realfolio}{1}{\pagenumber}]

\setupheader[state=high]

\starttext

\dorecurse{10}{\input tufte }

\stoptext

Now, the reason why \ifnum\pageno=1\pagenumber does not work has to do with
the fact that this expands to
\ifnum\pageno=11 since \pagenumber expands to 1. A space or \relax after
the 1 is the way out.  

The real pagenumber is available as count register (\realpageno), or number
(\realfolio) while the pagebumber itself is available in ... you can guess.
With \doif, you need the string representation. [prefixing a number with
\number is a pretty good safeguard] 

Hans
-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: first page special numbering
  2000-11-05 21:17 ` Hans Hagen
@ 2000-11-06 15:26   ` Ed L Cashin
  2000-11-06 16:15     ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Ed L Cashin @ 2000-11-06 15:26 UTC (permalink / raw)
  Cc: NTG-ConTeXt mailing list

Thanks, Hans!

Hans Hagen <pragma@wxs.nl> writes:

> At 05:33 PM 11/4/00 -0500, Ed L Cashin wrote:
...
> >    \setuppagenumbering [location=]
> >    \setupheadertexts   [\ifnum\pageno=1\else\pagenumber\fi]
> >    \setupfootertexts   [\ifnum\pageno=1 1\fi]
>
>(Strangely, if I say, "\ifnum\pageno=1\pagenumber\fi", then nothing is
>printed, yet when I use a literal "1" it works as expected.)
>
> >Is there a more idiomatic way that I'm missing?    
> 
> Well, to mention a few:
> 
> % interface=en
> 
> %\setupfootertexts[\ifnum\pageno=1 \pagenumber\fi]
> %\setupfootertexts[\doif{\folio}{1}{\pagenumber}]
> \setupfootertexts[\ifnum\realpageno=1 \pagenumber\fi]
> %\setupfootertexts[\doif{\realfolio}{1}{\pagenumber}]

Well, I feel better now -- I was on the right track!

> \setupheader[state=high]

Yes, I need to look that up again in the manual, since I keep
forgetting what it does.

> \starttext
> 
> \dorecurse{10}{\input tufte }

Why not distribute tufte.tex and knuth.tex in the context
distribution?  :)

> \stoptext
> 
> Now, the reason why \ifnum\pageno=1\pagenumber does not work has to do with
> the fact that this expands to
> \ifnum\pageno=11 since \pagenumber expands to 1. A space or \relax after
> the 1 is the way out.  

That's not what I'd expect:

  \ifnum\pageno=1\pagenumber\fi 
     -----> [tokens] "\ifnum", "\pageno", "=", "1", "\pagenumber", "\fi"

... since I thought that tokenizing happens before any macro
processing.  It's interesting.

-- 
--Ed Cashin                     PGP public key:
  ecashin@coe.uga.edu           http://www.coe.uga.edu/~ecashin/pgp/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: first page special numbering
  2000-11-06 15:26   ` Ed L Cashin
@ 2000-11-06 16:15     ` Hans Hagen
  2000-11-06 20:38       ` Ed L Cashin
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2000-11-06 16:15 UTC (permalink / raw)
  Cc: NTG-ConTeXt mailing list

At 10:26 AM 11/6/00 -0500, Ed L Cashin wrote:

>Why not distribute tufte.tex and knuth.tex in the context
>distribution?  :)

They are in the cont-doc zip file [a few more too, like zapf]

>That's not what I'd expect:
>
>  \ifnum\pageno=1\pagenumber\fi 
>     -----> [tokens] "\ifnum", "\pageno", "=", "1", "\pagenumber", "\fi"
>
>... since I thought that tokenizing happens before any macro
>processing.  It's interesting.

actually tex reads a number until a \relax or space or something not
expanding into a digit is encountered. 2\pageno is also a number, i.e. 2
times \pageno. This is why you sometimes need a \relax. The following tex
code is potentially faulty: 

\ifnum\somenum=\anothernum
  \ifnum\anothernum>1

since tex will keep on reading and an \if is handled, so: 

\ifnum\somenum=\ifnum\anothernum>10 3\else4\fi is pretty legal and is
equivalent to either

\ifnum\somenum=3 or \ifnum\somenum=4

Hans
-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: first page special numbering
  2000-11-06 16:15     ` Hans Hagen
@ 2000-11-06 20:38       ` Ed L Cashin
  2000-11-06 22:45         ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Ed L Cashin @ 2000-11-06 20:38 UTC (permalink / raw)


Hans Hagen <pragma@wxs.nl> writes:

> At 10:26 AM 11/6/00 -0500, Ed L Cashin wrote:
> 
> >Why not distribute tufte.tex and knuth.tex in the context
> >distribution?  :)
> 
> They are in the cont-doc zip file [a few more too, like zapf]

I could not find a link to cont-doc.zip on www.pragma-ade.com, so I
edited the location of cont-tmf.zip, and that worked.  

-- 
--Ed Cashin                     PGP public key:
  ecashin@coe.uga.edu           http://www.coe.uga.edu/~ecashin/pgp/


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: first page special numbering
  2000-11-06 20:38       ` Ed L Cashin
@ 2000-11-06 22:45         ` Hans Hagen
  2000-11-07  0:28           ` Ed L Cashin
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2000-11-06 22:45 UTC (permalink / raw)
  Cc: NTG-ConTeXt mailing list

At 03:38 PM 11/6/00 -0500, Ed L Cashin wrote:
>Hans Hagen <pragma@wxs.nl> writes:
>
>> At 10:26 AM 11/6/00 -0500, Ed L Cashin wrote:
>> 
>> >Why not distribute tufte.tex and knuth.tex in the context
>> >distribution?  :)
>> 
>> They are in the cont-doc zip file [a few more too, like zapf]
>
>I could not find a link to cont-doc.zip on www.pragma-ade.com, so I
>edited the location of cont-tmf.zip, and that worked.  

It's the same place. You can also access them from the beta page. The doc
files contain module documentation styles, say that you are at the context
path: 

texexec --modu --pdf syst-gen

will give you a pretty printed source file of a system module [you may want
to take a look at the definition of \doifnumberelse to see a few \ifnum
tricks that make use of what we discussed in earlier mails), 

Hans

-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: first page special numbering
  2000-11-06 22:45         ` Hans Hagen
@ 2000-11-07  0:28           ` Ed L Cashin
  0 siblings, 0 replies; 7+ messages in thread
From: Ed L Cashin @ 2000-11-07  0:28 UTC (permalink / raw)
  Cc: NTG-ConTeXt mailing list

Hans Hagen <pragma@wxs.nl> writes:

...
> It's the same place. You can also access them from the beta page. The doc
> files contain module documentation styles, say that you are at the context
> path: 
> 
> texexec --modu --pdf syst-gen
> 
> will give you a pretty printed source file of a system module [you may want
> to take a look at the definition of \doifnumberelse to see a few \ifnum
> tricks that make use of what we discussed in earlier mails), 

That worked like a charm on the first try after I unzipped
cont-doc.zip into $TEXMF/tex/context and ran mktexlsr.  Thanks!

-- 
--Ed Cashin                     PGP public key:
  ecashin@coe.uga.edu           http://www.coe.uga.edu/~ecashin/pgp/


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2000-11-07  0:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-04 22:33 first page special numbering Ed L Cashin
2000-11-05 21:17 ` Hans Hagen
2000-11-06 15:26   ` Ed L Cashin
2000-11-06 16:15     ` Hans Hagen
2000-11-06 20:38       ` Ed L Cashin
2000-11-06 22:45         ` Hans Hagen
2000-11-07  0:28           ` Ed L Cashin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).