ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* how to put page X of N in header or top space?
@ 2018-08-14 16:28 David Walther
  2018-08-14 19:32 ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: David Walther @ 2018-08-14 16:28 UTC (permalink / raw)
  To: ntg-context

Hi, I am slowly learning ConTeXt.  I am generating tables and spreadsheets, and
transforming them into ConTeXt, finally got it working after a lot of
mysterious errors about missing } as macro arguments.

I have read this page carefully:  http://wiki.contextgarden.net/Layout

How can I alter the page number?  Is it in the header, or is it in the
topspace?

I want this to be at the top of each page of my spreadsheet:

My Spreadsheet (centered) Page 1 of 3 (right justified)

And on even pages, the other way around:

Page 2 of 3 (left justified) My Spreadsheet (centered)

What is the right way to do this?  Is there an override and a blob of code I need to put into one of the boxes in the Layout?

David
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: how to put page X of N in header or top space?
  2018-08-14 16:28 how to put page X of N in header or top space? David Walther
@ 2018-08-14 19:32 ` Wolfgang Schuster
  2018-08-14 20:44   ` David Walther
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2018-08-14 19:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users, David Walther

\setuppagenumbering
   [alternative=doublesided,               % doublesided layout
   %alternative={singlesided,doublesided}, % singlesided layout with 
left/right pages
    location=none]

\setupheadertexts [My Spreadsheet]

\setupheadertexts
   [] [Page \userpagenumber\ of \lastuserpagenumber]
   [Page \userpagenumber\ of \lastuserpagenumber] []

\starttext
\dorecurse{10}{\page[dummy]}
\stoptext


Wolfgang


David Walther schrieb am 14.08.18 um 18:28:
> Hi, I am slowly learning ConTeXt.  I am generating tables and 
> spreadsheets, and
> transforming them into ConTeXt, finally got it working after a lot of
> mysterious errors about missing } as macro arguments.
>
> I have read this page carefully:  http://wiki.contextgarden.net/Layout
>
> How can I alter the page number?  Is it in the header, or is it in the
> topspace?
>
> I want this to be at the top of each page of my spreadsheet:
>
> My Spreadsheet (centered) Page 1 of 3 (right justified)
>
> And on even pages, the other way around:
>
> Page 2 of 3 (left justified) My Spreadsheet (centered)
>
> What is the right way to do this?  Is there an override and a blob of 
> code I need to put into one of the boxes in the Layout?
>
> David
> ___________________________________________________________________________________ 
>
> If your question is of interest to others as well, please add an entry 
> to the Wiki!
>
> maillist : ntg-context@ntg.nl / 
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: how to put page X of N in header or top space?
  2018-08-14 19:32 ` Wolfgang Schuster
@ 2018-08-14 20:44   ` David Walther
  2018-08-14 20:58     ` Alan Braslau
  2018-08-15  3:41     ` Wolfgang Schuster
  0 siblings, 2 replies; 8+ messages in thread
From: David Walther @ 2018-08-14 20:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thank you Wolfgang, that worked nicely.  Two artifacts I'm not sure how to address:

I did page Page X of N, but in the output, it displays like
Page 2of 3, Page 1of 3, etc.  It ignores the space between the number and the word of.

Secondly, when I use the doublesided and the {singlesided,doublesided}
alternative page numbering, it rounds up to an even number of pages, even
though the last page is blank.  When I just use the singlesided option I get 3
pages as expected, but it doesn't do the nice interior margins and switching
sides of page numbers.  Even context doesn't view the blank page at the end as
a page, because it doesn't print the header or footer on it.

David


On Tue, Aug 14, 2018 at 09:32:29PM +0200, Wolfgang Schuster wrote:
>\setuppagenumbering
>  [alternative=doublesided,               % doublesided layout
>  %alternative={singlesided,doublesided}, % singlesided layout with 
>left/right pages
>   location=none]
>
>\setupheadertexts [My Spreadsheet]
>
>\setupheadertexts
>  [] [Page \userpagenumber\ of \lastuserpagenumber]
>  [Page \userpagenumber\ of \lastuserpagenumber] []
>
>\starttext
>\dorecurse{10}{\page[dummy]}
>\stoptext
>
>
>Wolfgang
>
>
>David Walther schrieb am 14.08.18 um 18:28:
>>Hi, I am slowly learning ConTeXt.  I am generating tables and 
>>spreadsheets, and
>>transforming them into ConTeXt, finally got it working after a lot of
>>mysterious errors about missing } as macro arguments.
>>
>>I have read this page carefully:  http://wiki.contextgarden.net/Layout
>>
>>How can I alter the page number?  Is it in the header, or is it in the
>>topspace?
>>
>>I want this to be at the top of each page of my spreadsheet:
>>
>>My Spreadsheet (centered) Page 1 of 3 (right justified)
>>
>>And on even pages, the other way around:
>>
>>Page 2 of 3 (left justified) My Spreadsheet (centered)
>>
>>What is the right way to do this?  Is there an override and a blob 
>>of code I need to put into one of the boxes in the Layout?
>>
>>David
>>___________________________________________________________________________________
>>
>>If your question is of interest to others as well, please add an 
>>entry to the Wiki!
>>
>>maillist : ntg-context@ntg.nl / 
>>http://www.ntg.nl/mailman/listinfo/ntg-context
>>webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>>archive  : https://bitbucket.org/phg/context-mirror/commits/
>>wiki     : http://contextgarden.net
>>___________________________________________________________________________________
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: how to put page X of N in header or top space?
  2018-08-14 20:44   ` David Walther
@ 2018-08-14 20:58     ` Alan Braslau
  2018-08-14 21:19       ` David Walther
  2018-08-15  3:41     ` Wolfgang Schuster
  1 sibling, 1 reply; 8+ messages in thread
From: Alan Braslau @ 2018-08-14 20:58 UTC (permalink / raw)
  To: David Walther; +Cc: mailing list for ConTeXt users

On Tue, 14 Aug 2018 13:44:43 -0700
David Walther <david@clearbrookdistillery.com> wrote:

> I did page Page X of N, but in the output, it displays like
> Page 2of 3, Page 1of 3, etc.  It ignores the space between the number and the word of.

You must have forgotten the trailing "\ " of "\userpagenumber\ ".

Alan
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: how to put page X of N in header or top space?
  2018-08-14 20:58     ` Alan Braslau
@ 2018-08-14 21:19       ` David Walther
  2018-08-14 21:40         ` Alan Braslau
  0 siblings, 1 reply; 8+ messages in thread
From: David Walther @ 2018-08-14 21:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, Aug 14, 2018 at 02:58:58PM -0600, Alan Braslau wrote:
>On Tue, 14 Aug 2018 13:44:43 -0700
>David Walther <david@clearbrookdistillery.com> wrote:
>
>> I did page Page X of N, but in the output, it displays like
>> Page 2of 3, Page 1of 3, etc.  It ignores the space between the number and the word of.
>
>You must have forgotten the trailing "\ " of "\userpagenumber\ ".

Thank you Alan.  That worked.  I didn't forget it; I never knew it.  I'm
starting to run into the area where the Wiki isn't enough, but I don't know
enough TeX to read the Context source for the macros.  What is recommended to
get up to speed on Context?  Should I go back and re-read Knuth's book on TeX
then try reading ConTeXt source?  Last time I read it was 20 years ago, and
only got half way through; that was enough for my needs back then.  I guess a
week or two reading everything on this page would help too:

  http://www.luatex.org/documentation.html

Now just need an answer for the blank page issue and I can start shipping these
spreadsheets to clients.

David
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: how to put page X of N in header or top space?
  2018-08-14 21:19       ` David Walther
@ 2018-08-14 21:40         ` Alan Braslau
  0 siblings, 0 replies; 8+ messages in thread
From: Alan Braslau @ 2018-08-14 21:40 UTC (permalink / raw)
  To: David Walther; +Cc: mailing list for ConTeXt users

On Tue, 14 Aug 2018 14:19:25 -0700
David Walther <david@clearbrookdistillery.com> wrote:

> On Tue, Aug 14, 2018 at 02:58:58PM -0600, Alan Braslau wrote:
> >On Tue, 14 Aug 2018 13:44:43 -0700
> >David Walther <david@clearbrookdistillery.com> wrote:
> >  
> >> I did page Page X of N, but in the output, it displays like
> >> Page 2of 3, Page 1of 3, etc.  It ignores the space between the number and the word of.  
> >
> >You must have forgotten the trailing "\ " of "\userpagenumber\ ".  
> 
> Thank you Alan.  That worked.  I didn't forget it; I never knew it.  I'm
> starting to run into the area where the Wiki isn't enough, but I don't know
> enough TeX to read the Context source for the macros.  What is recommended to
> get up to speed on Context?  Should I go back and re-read Knuth's book on TeX
> then try reading ConTeXt source?  Last time I read it was 20 years ago, and
> only got half way through; that was enough for my needs back then.  I guess a
> week or two reading everything on this page would help too:
> 
>   http://www.luatex.org/documentation.html
> 
> Now just need an answer for the blank page issue and I can start shipping these
> spreadsheets to clients.

TeX commands such as \userpagenumber "gobble" a trailing blank space, delimiting the end of the token name ("userpagenumber"). It can also be terminated by any non-token-name character or another token. So we generally write \userpagenumber\ . One could also write {\userpagenumber}, i.e. enclosing the TeX command within delimiters, and it is a question of taste what coding is more readable. \userpagenumber{} is also valid, yet I find this even less readable.

You can learn much from emulation, paying attention to details, as Wolfgang had written

\setupheadertexts
   [] [Page \userpagenumber\ of \lastuserpagenumber]
   [Page \userpagenumber\ of \lastuserpagenumber] []



One tricky point that might not be obvious, \setupheadertexts can take a varying number of arguments enclosed in []. The form above (4 groups of []), sets the left/right headertexts for even/odd pages. Whereas the single group instance

\setupheadertexts [My Spreadsheet]

sets the center text. Having three or five group versions gets unwieldy or ambiguous (the two group version sets left/right for singlesided layout), so having to make two "calls" to \setupheadertexts as above is cleaner, although was confusing to me at first.

Alan
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: how to put page X of N in header or top space?
  2018-08-14 20:44   ` David Walther
  2018-08-14 20:58     ` Alan Braslau
@ 2018-08-15  3:41     ` Wolfgang Schuster
  2018-08-15  5:29       ` David Walther
  1 sibling, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2018-08-15  3:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users, David Walther

\setuppagenumbering
   [alternative=doublesided,
    location=none,
    page=no]


Wolfgang


David Walther schrieb am 14.08.18 um 22:44:
> Thank you Wolfgang, that worked nicely.  Two artifacts I'm not sure 
> how to address:
>
> I did page Page X of N, but in the output, it displays like
> Page 2of 3, Page 1of 3, etc.  It ignores the space between the number 
> and the word of.
>
> Secondly, when I use the doublesided and the {singlesided,doublesided}
> alternative page numbering, it rounds up to an even number of pages, even
> though the last page is blank.  When I just use the singlesided option 
> I get 3
> pages as expected, but it doesn't do the nice interior margins and 
> switching
> sides of page numbers.  Even context doesn't view the blank page at 
> the end as
> a page, because it doesn't print the header or footer on it.
>
> David
>
>
> On Tue, Aug 14, 2018 at 09:32:29PM +0200, Wolfgang Schuster wrote:
>> \setuppagenumbering
>>  [alternative=doublesided,               % doublesided layout
>>  %alternative={singlesided,doublesided}, % singlesided layout with 
>> left/right pages
>>   location=none]
>>
>> \setupheadertexts [My Spreadsheet]
>>
>> \setupheadertexts
>>  [] [Page \userpagenumber\ of \lastuserpagenumber]
>>  [Page \userpagenumber\ of \lastuserpagenumber] []
>>
>> \starttext
>> \dorecurse{10}{\page[dummy]}
>> \stoptext
>>
>>
>> Wolfgang
>>
>>
>> David Walther schrieb am 14.08.18 um 18:28:
>>> Hi, I am slowly learning ConTeXt.  I am generating tables and 
>>> spreadsheets, and
>>> transforming them into ConTeXt, finally got it working after a lot of
>>> mysterious errors about missing } as macro arguments.
>>>
>>> I have read this page carefully: http://wiki.contextgarden.net/Layout
>>>
>>> How can I alter the page number?  Is it in the header, or is it in the
>>> topspace?
>>>
>>> I want this to be at the top of each page of my spreadsheet:
>>>
>>> My Spreadsheet (centered) Page 1 of 3 (right justified)
>>>
>>> And on even pages, the other way around:
>>>
>>> Page 2 of 3 (left justified) My Spreadsheet (centered)
>>>
>>> What is the right way to do this?  Is there an override and a blob 
>>> of code I need to put into one of the boxes in the Layout?
>>>
>>> David
>>> ___________________________________________________________________________________ 
>>>
>>>
>>> If your question is of interest to others as well, please add an 
>>> entry to the Wiki!
>>>
>>> maillist : ntg-context@ntg.nl / 
>>> http://www.ntg.nl/mailman/listinfo/ntg-context
>>> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>>> wiki     : http://contextgarden.net
>>> ___________________________________________________________________________________ 
>>>
>>
> ___________________________________________________________________________________ 
>
> If your question is of interest to others as well, please add an entry 
> to the Wiki!
>
> maillist : ntg-context@ntg.nl / 
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: how to put page X of N in header or top space?
  2018-08-15  3:41     ` Wolfgang Schuster
@ 2018-08-15  5:29       ` David Walther
  0 siblings, 0 replies; 8+ messages in thread
From: David Walther @ 2018-08-15  5:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, Aug 15, 2018 at 05:41:33AM +0200, Wolfgang Schuster wrote:
>\setuppagenumbering
>  [alternative=doublesided,
>   location=none,
>   page=no]

Thanks Wolfgang, that works like a champ.  Now I've found the documentation for
ConTeXt in Debian, it is tucked away in
/usr/share/texmf/doc/context/documents/general/manuals directory as a pile of
PDFs.  I have some reading to do now.  Thank you everyone for your help.

David

>
>
>Wolfgang
>
>
>David Walther schrieb am 14.08.18 um 22:44:
>>Thank you Wolfgang, that worked nicely.  Two artifacts I'm not sure 
>>how to address:
>>
>>I did page Page X of N, but in the output, it displays like
>>Page 2of 3, Page 1of 3, etc.  It ignores the space between the 
>>number and the word of.
>>
>>Secondly, when I use the doublesided and the {singlesided,doublesided}
>>alternative page numbering, it rounds up to an even number of pages, even
>>though the last page is blank.  When I just use the singlesided 
>>option I get 3
>>pages as expected, but it doesn't do the nice interior margins and 
>>switching
>>sides of page numbers.  Even context doesn't view the blank page at 
>>the end as
>>a page, because it doesn't print the header or footer on it.
>>
>>David
>>
>>
>>On Tue, Aug 14, 2018 at 09:32:29PM +0200, Wolfgang Schuster wrote:
>>>\setuppagenumbering
>>> [alternative=doublesided,               % doublesided layout
>>> %alternative={singlesided,doublesided}, % singlesided layout with 
>>>left/right pages
>>>  location=none]
>>>
>>>\setupheadertexts [My Spreadsheet]
>>>
>>>\setupheadertexts
>>> [] [Page \userpagenumber\ of \lastuserpagenumber]
>>> [Page \userpagenumber\ of \lastuserpagenumber] []
>>>
>>>\starttext
>>>\dorecurse{10}{\page[dummy]}
>>>\stoptext
>>>
>>>
>>>Wolfgang
>>>
>>>
>>>David Walther schrieb am 14.08.18 um 18:28:
>>>>Hi, I am slowly learning ConTeXt.  I am generating tables and 
>>>>spreadsheets, and
>>>>transforming them into ConTeXt, finally got it working after a lot of
>>>>mysterious errors about missing } as macro arguments.
>>>>
>>>>I have read this page carefully: http://wiki.contextgarden.net/Layout
>>>>
>>>>How can I alter the page number?  Is it in the header, or is it in the
>>>>topspace?
>>>>
>>>>I want this to be at the top of each page of my spreadsheet:
>>>>
>>>>My Spreadsheet (centered) Page 1 of 3 (right justified)
>>>>
>>>>And on even pages, the other way around:
>>>>
>>>>Page 2 of 3 (left justified) My Spreadsheet (centered)
>>>>
>>>>What is the right way to do this?  Is there an override and a 
>>>>blob of code I need to put into one of the boxes in the Layout?
>>>>
>>>>David
>>>>___________________________________________________________________________________
>>>>
>>>>
>>>>If your question is of interest to others as well, please add an 
>>>>entry to the Wiki!
>>>>
>>>>maillist : ntg-context@ntg.nl / 
>>>>http://www.ntg.nl/mailman/listinfo/ntg-context
>>>>webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>>>>archive  : https://bitbucket.org/phg/context-mirror/commits/
>>>>wiki     : http://contextgarden.net
>>>>___________________________________________________________________________________
>>>>
>>>
>>___________________________________________________________________________________
>>
>>If your question is of interest to others as well, please add an 
>>entry to the Wiki!
>>
>>maillist : ntg-context@ntg.nl / 
>>http://www.ntg.nl/mailman/listinfo/ntg-context
>>webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>>archive  : https://bitbucket.org/phg/context-mirror/commits/
>>wiki     : http://contextgarden.net
>>___________________________________________________________________________________
>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2018-08-15  5:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-14 16:28 how to put page X of N in header or top space? David Walther
2018-08-14 19:32 ` Wolfgang Schuster
2018-08-14 20:44   ` David Walther
2018-08-14 20:58     ` Alan Braslau
2018-08-14 21:19       ` David Walther
2018-08-14 21:40         ` Alan Braslau
2018-08-15  3:41     ` Wolfgang Schuster
2018-08-15  5:29       ` David Walther

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).