Re: [NTG-context] help with facing page image

2022-03-06 Thread śrīrāma via ntg-context
On Monday, March 7, 2022 11:50 AM jbf wrote:
> All ten images are different, though, in my case (Chapter1.jpg, 
> Chapter2.jpg... Chapter10.jpg all in a pics directory, so I'd point 
> \setupexternalfigures to that). I wonder if there is a way to list them 
> so that they get called in order as chapters proceed. A kind of "if such 
> and such then \setlayer 1,2,3"

I think that should be easy. Suppose you have images 
{chap-cover-1.jpg, chap-cover-2.jpg,  ... chap-cover-10.jpg}
each of which appear at the ends of their respective chapters, then the 
following achieves what you want (once you point ConTeXt to the right directory 
for figures of course):

% kate: hl ctx
%%% SOF
  \setuppagenumbering[alternative=doublesided]

  \definelayer
[chapCover]
[x=0mm,
 y=0mm,
 width=\paperwidth,
 height=\paperheight,repeat=yes]

  \startsetups chapter:before
  \doifoddpageelse{}
{\pushbackground[page]
 \resetlayer[chapCover]
 \setlayer
 [chapCover]
 {\determineheadnumber[chapter]
  \externalfigure
[chap-cover-\currentheadnumber]
[width=\paperwidth]}
  \setupbackgrounds[page][background=chapCover]
  \page[empty]
  \popbackground}
  \stopsetups

  \startsetups chapter:after
  \doifoddpageelse{}
{\page[empty]}
  \stopsetups

  \setuphead
[chapter]
[page=yes,
 before=\directsetup{chapter:before},
 aftersection=\directsetup{chapter:after}]

  \starttext
  \dorecurse{10}{
\startchapter[title={Chapter \convertnumber{word}{\recurselevel}}]
  \input knuth
  \ifnum\headnumber[chapter]=5
  {\bfd five}
  \fi
  \blank
  \input tufte
  \blank
  \input ward
  \blank
  \ifnum\recurselevel=5
\page
\input zapf
\input zapf
  \fi
\stopchapter
  }
  \stoptext
%%% EOF

So we figure out which chapter we are in and then set the layer to the 
corresponding picture. Personally, I much prefer to collect all the images into 
a separate PDF with:

%%% chap-covers.tex
\starttext
\dorecurse{10}{\startTEXpage
\externalfigure[chap-cover-\recurselevel]
\stopTEXpage}
\stoptext
%%% EOF

[and get 'chap-covers.pdf' from context]

... and then modify the 'before' setup to read as below

%%% 
  \startsetups chapter:before
  \doifoddpageelse{}
{\pushbackground[page]
 \resetlayer[chapCover]
 \setlayer
 [chapCover]
 {\determineheadnumber[chapter]
  \externalfigure
[chap-covers]
[page=\currentheadnumber,width=\paperwidth]}
  \setupbackgrounds[page][background=chapCover]
  \page[empty]
  \popbackground}
  \stopsetups
%%%

Sreeram


___
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
___


Re: [NTG-context] help with facing page image

2022-03-06 Thread jbf via ntg-context
I can see how that works, Sreeram, especially the chapter:after to cope 
with the chapters ending on an even page. Though I will have to try it 
now on a copy of the real document to test it there.


All ten images are different, though, in my case (Chapter1.jpg, 
Chapter2.jpg... Chapter10.jpg all in a pics directory, so I'd point 
\setupexternalfigures to that). I wonder if there is a way to list them 
so that they get called in order as chapters proceed. A kind of "if such 
and such then \setlayer 1,2,3"


Julian

On 7/3/22 16:38, śrīrāma wrote:

On Monday, March 7, 2022 9:19 AM jbf via ntg-context wrote:

Author wants an image on facing page to each of 10 chapters in the
bodypart of the document. Assume that everything else is working
properly for this document (double-sided etc.), but other than before
chapter 1, I can't seem to get my facing page image to appear where it
should!

 From what I understood from your explanation, I have this:

%%% SOF
   % for 'mill'
   \setupexternalfigures[location={default}]

   \setuppagenumbering[alternative=doublesided]

   
\definelayer[mill][x=0mm,y=0mm,width=\paperwidth,height=\paperheight,repeat=yes]
   \setlayer[mill]{\externalfigure[mill][width=\paperwidth]}

   \startsetups chapter:before
   \doifoddpageelse{}
 {\pushbackground[page]
 \setupbackgrounds[page][background=mill]
 \page[empty]
 \popbackground}
   \stopsetups

   \startsetups chapter:after
   \doifoddpageelse{}
 {\page[empty]}
   \stopsetups

   \setuphead
 [chapter]
 [page=yes,
 before=\directsetup{chapter:before},
 aftersection=\directsetup{chapter:after}]

   \starttext
   \dorecurse{10}{
 \startchapter[title={Chapter \convertnumber{word}{\recurselevel}}]
   \input knuth
   \blank
   \input tufte
   \blank
   \input ward
   \blank
   \ifnum\recurselevel=5
 \page
 \input zapf
 \input zapf
   \fi
 \stopchapter
   }
   \stoptext
%%% EOF

[I am just using the mill picture on every facing page of chapter]
If the chapter ends on an even page then we can insert an empty page with 
\page[empty] with [aftersection=...] in \setuphead. The [before=...] is push, 
set background to mill on a new (empty) left page and then pop back (much like 
the example from wiki).

Sreeram



___
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
___


Re: [NTG-context] help with facing page image

2022-03-06 Thread śrīrāma via ntg-context
On Monday, March 7, 2022 11:08 AM śrīrāma wrote:
> 
> From what I understood from your explanation, I have this:
> 

A formatted version below –

%%% SOF
  % for 'mill'
  \setupexternalfigures[location={default}]

  \setuppagenumbering[alternative=doublesided]

  \definelayer
[mill]
[x=0mm,
 y=0mm,
 width=\paperwidth,
 height=\paperheight,repeat=yes]
  \setlayer
[mill]
{\externalfigure[mill][width=\paperwidth]}

  \startsetups chapter:before
  \doifoddpageelse{}
{\pushbackground[page]
 \setupbackgrounds[page][background=mill]
 \page[empty]
 \popbackground}
  \stopsetups

  \startsetups chapter:after
  \doifoddpageelse{}
{\page[empty]}
  \stopsetups

  \setuphead
[chapter]
[page=yes,
 before=\directsetup{chapter:before},
 aftersection=\directsetup{chapter:after}]

  \starttext
  \dorecurse{10}{
\startchapter[title={Chapter \convertnumber{word}{\recurselevel}}]
  \input knuth
  \blank
  \input tufte
  \blank
  \input ward
  \blank
  \ifnum\recurselevel=5
\page
\input zapf
\input zapf
  \fi
\stopchapter
  }
  \stoptext
%%% EOF

Sreeram


___
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
___


Re: [NTG-context] help with facing page image

2022-03-06 Thread śrīrāma via ntg-context
On Monday, March 7, 2022 9:19 AM jbf via ntg-context wrote:
> Author wants an image on facing page to each of 10 chapters in the 
> bodypart of the document. Assume that everything else is working 
> properly for this document (double-sided etc.), but other than before 
> chapter 1, I can't seem to get my facing page image to appear where it 
> should!

From what I understood from your explanation, I have this:

%%% SOF
  % for 'mill'
  \setupexternalfigures[location={default}]

  \setuppagenumbering[alternative=doublesided]

  
\definelayer[mill][x=0mm,y=0mm,width=\paperwidth,height=\paperheight,repeat=yes]
  \setlayer[mill]{\externalfigure[mill][width=\paperwidth]}

  \startsetups chapter:before
  \doifoddpageelse{}
{\pushbackground[page]
\setupbackgrounds[page][background=mill]
\page[empty]
\popbackground}
  \stopsetups

  \startsetups chapter:after
  \doifoddpageelse{}
{\page[empty]}
  \stopsetups

  \setuphead
[chapter]
[page=yes,
before=\directsetup{chapter:before},
aftersection=\directsetup{chapter:after}]

  \starttext
  \dorecurse{10}{
\startchapter[title={Chapter \convertnumber{word}{\recurselevel}}]
  \input knuth
  \blank
  \input tufte
  \blank
  \input ward
  \blank
  \ifnum\recurselevel=5
\page
\input zapf
\input zapf
  \fi
\stopchapter
  }
  \stoptext
%%% EOF

[I am just using the mill picture on every facing page of chapter]
If the chapter ends on an even page then we can insert an empty page with 
\page[empty] with [aftersection=...] in \setuphead. The [before=...] is push, 
set background to mill on a new (empty) left page and then pop back (much like 
the example from wiki).

Sreeram


___
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
___


[NTG-context] help with facing page image

2022-03-06 Thread jbf via ntg-context
I wonder if someone can help me untangle the current little mess I seem 
to be creating!


Author wants an image on facing page to each of 10 chapters in the 
bodypart of the document. Assume that everything else is working 
properly for this document (double-sided etc.), but other than before 
chapter 1, I can't seem to get my facing page image to appear where it 
should!


A question along these lines (but not quite the same) was asked back in 
2019, so I started with what seemed to me to be the simplest response to 
this question. Here is what I have to get the image before Chapter 1 in 
bodymatter:


\startbodymatter

\definelayer[mylayer] % name of the layer

[x=0mm, y=0mm, % from upper left corner of paper

width=\paperwidth,height=\paperheight] % let the layer cover the full paper

\setlayer[mylayer]

[hoffset=2.5cm, voffset=3cm]

{\externalfigure[Chapter1.jpg][width=.9\textwidth]}

\doifoddpageelse

{}

{\pushbackground[page]

\setupbackgrounds[page]%[background=color,backgroundcolor=red]

[background=mylayer]

\page[empty]

\popbackground}

\startchapter[title={Prelude}] etc.

This correctly places the Chapter1.jpg on the facing page to Chapter 1. 
My problem comes with Chapter 2, since Chapter 1 finishes on an even 
page, and this means I would need a blank odd page to follow that so 
that Chapter2.jpg (a different image to the first) can be on the verso 
of that and the Chapter itself would then start on the odd page facing that.


I think the \doiffoddpageelse command above is only meant to work when a 
chapter ends on an odd, not an even page, but I do not know what 
alternative command to give.


Repeating the above set of commands prior to \startchapter for chapter 2 
places the image, naturally enough, behind the last page of text for 
Chapter 1, which is unacceptable, so I thought I could simply add a 
blank page or two after the chapter and it would all fall into place. I 
tried various ways of doing that (e.g. \page[+2], or using makeup 
pages), and while I can add pages that way, I can't get the image to 
appear.


No doubt the solution is simple enough. It might also lie in the 
\setuphead[chapter] arrangement too. I've tried page=yes there, but to 
no avail. I also tried \ startsetups[chapter:before] with the 
pushbackground etc command and added that in with 
before=\directsetup{chapter:before} as suggested in the wiki, but 
couldn't get that to work either. By that stage I was so tangled up in 
the problem I may not have been able to think straight :-). Somehow, 
though, I think most of the elements are there.


Any help would be appreciated.

Julian
___
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
___


[NTG-context] Regular online meet-up

2022-03-06 Thread Henning Hraban Ramm via ntg-context

You’re invited to join next *Wednesday*, March 9th, 15:00 CET (UTC+1)
(Beware, we changed the weekday!)

at https://lecture.senfcall.de/hen-rbr-rku-oke

ConTeXt users of all levels are welcome!

Hans will probably give a Q session again – please announce subjects 
you’d like to discuss ASAP, so that he can prepare.



(Same blurb as every time:)

[Howto]
* No special software installation required; most modern browsers should 
work (WebRTC required).

* Open the above URL, accept the privacy statement,
* enter your name,
* click "join" (or "start" if you’re the first),
* click "with microphone", allow your browser to access it, check the audio.
* Your microphone is muted if you join. Activate microphone and/or 
camera with the buttons at the bottom.

* Minimize the default presentation with the "screen" button, bottom right.

* If you’d like to share your screen or upload a file, you can make 
yourself the presenter: Click on your user name, change the setting, 
then you’ll see the "screen sharing" button beside the camera button; 
also there’s now "manage presentations" behind the "plus" button. Beware 
there is only one presenter, so don’t kill someone else’s presentation.


[Technical hints]
* Sound is usually better if you use a headset (less noise for everyone).

* Connection problems are mostly due to low bandwidth or high latency on 
your side, e.g. with mobile connections.

* If audio/video doesn’t work for you, you can still use the text chat.
* Screen sharing needs a lot of bandwidth.

* You can also join with a regular telephone (audio only, of course), 
call +49-6151-86275-22 (German landline); then you must enter a PIN that 
changes every time – if you need it, ask me for it via email. 
Mute/unmute your microphone with "0".


[Netiquette]
* Please use a name that we recognize from here. Some feel uncomfortable 
with anonymous lurkers.

* Mute your microphone while you’re not talking.
* It’s nice to show your face at least when you join.
* If there are connection problems, stop camera sharing.
* The room is set to “everyone’s a moderator“, I trust you...

See you, Hraban


___
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
___