ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Alan Braslau <braslau.list@comcast.net>
To: David Walther <david@clearbrookdistillery.com>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: how to put page X of N in header or top space?
Date: Tue, 14 Aug 2018 15:40:56 -0600	[thread overview]
Message-ID: <20180814154056.21640a53@comcast.net> (raw)
In-Reply-To: <20180814211925.GA16053@reactor-core.org>

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
___________________________________________________________________________________

  reply	other threads:[~2018-08-14 21:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-14 16:28 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 [this message]
2018-08-15  3:41     ` Wolfgang Schuster
2018-08-15  5:29       ` David Walther

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180814154056.21640a53@comcast.net \
    --to=braslau.list@comcast.net \
    --cc=david@clearbrookdistillery.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).