Re: [NTG-context] Grey background for pages belonging to last section of every chapter

2015-02-02 Thread Wolfgang Schuster

 Am 30.01.2015 um 21:43 schrieb Rob Heusdens robh...@xs4all.nl:
 
 Correction, I added offset=none,frameoffset=0pt, to the parameters for
 the textbackground frame.
 
 Code again with correction:
 
 % test background
 \setupwhitespace[none]
 \setupindenting[yes, small, next]
 \setuppagenumbering[alternative=doublesided]
 
 \definetextbackground
  [SummaryBackground]
  [frame=off,offset=none,frameoffset=0pt,
   background=color,
   backgroundcolor=gray,
   backgroundoffset=2ex]
 
 \definehead[summary][section]
 
 \setuphead
  [summary]
  [number=no,
   style=bold,
   before=,
   beforesection={\noindentation\page\starttextbackground[SummaryBackground]},
   aftersection={\stoptextbackground\blank}]
 
 \setuphead[section][number=no,style=bold]
 
 
 \definecombinedlist[content][section,summary]
 \setupcombinedlist[content][level=4, alternative=c]
 
 \starttext
 \completecontent
 \page
 \dorecurse{9}{
 \startsection[title={Knuth -- \recurselevel}]
 
 \input{knuth}
 
 \stopsection
 }
 
 \startsummary[title=Samenvatting]
 
 \input{zapf}
 
 \stopsummary
 
 \stoptext
 
 
 
 Still the summary title is a bit lower on the page then other text.


You have to add „location=paragraph” to the textbackground setup.

\definetextbackground
  [ChapterFrame]
  [frame=off,
   background=color,
   backgroundcolor=green,
   backgroundoffset=1ex,
   location=paragraph] % default: location=text

\definehead [Framed][chapter]
\definehead [Frameless] [chapter]

\setuphead
  [Frameless]
  [before={\blank[2*line]}]

\setuphead
  [Framed]
  [page=no,
   before=,
   beforesection={\page\blank[2*line]\starttextbackground[ChapterFrame]},
   aftersection=\stoptextbackground]

\starttext

\startnamedsection[Frameless][title=Chapter without frame]

\input knuth

\stopnamedsection

\startnamedsection[Framed][title=Chapter with frame]

\input knuth

\stopnamedsection

\stoptext

Wolfgang
___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

[NTG-context] Grey background for pages belonging to last section of every chapter

2015-01-30 Thread Rob Heusdens
Hello list,

For the last section of every chapter I want a grey background for the
text, which otherwise should look the same as every other section, except
that it starts on a new page (I can set that by defining my own section
command).

The last section summarizes the chapter.

My current implementation is using a frame:


\defineframed[achtergrond]
[frame=off,
background=color,
backgroundcolor=gray,
width=fit,
height=fit,
offset=2ex,
align={flushleft,nothyphenated,verytolerant}]

And use it as:

\achtergrond{
\section{Last section}

\startitemize[n]
\item ...
\stopitemize
}

But this does not accomodate sections longer then a page. And I can't
place \page command in the middle of an itemize, and using \stopitemize,
\startitemize[continue] makes the pages vary in sizes.

Is there some way to achieve the desired effect (grey background behind
the text, and otherwise page layour identical to other sections) without
the problem that text exceeds the page size?

Greetings,

Rob

PS. The defined frame is also used elsewhere, but the last section should
in fact not have normal alignment like the other sections.


___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Grey background for pages belonging to last section of every chapter

2015-01-30 Thread Rob Heusdens
 Hello list,

 For the last section of every chapter I want a grey background for the
 text, which otherwise should look the same as every other section, except
 that it starts on a new page (I can set that by defining my own section
 command).

 The last section summarizes the chapter.

 My current implementation is using a frame:


 \defineframed[achtergrond]
 [frame=off,
 background=color,
 backgroundcolor=gray,
 width=fit,
 height=fit,
 offset=2ex,
 align={flushleft,nothyphenated,verytolerant}]

 And use it as:

 \achtergrond{
 \section{Last section}

 \startitemize[n]
 \item ...
 \stopitemize
 }

 But this does not accomodate sections longer then a page. And I can't
 place \page command in the middle of an itemize, and using \stopitemize,
 \startitemize[continue] makes the pages vary in sizes.

 Is there some way to achieve the desired effect (grey background behind
 the text, and otherwise page layour identical to other sections) without
 the problem that text exceeds the page size?

 Greetings,

 Rob

 PS. The defined frame is also used elsewhere, but the last section should
 in fact not have normal alignment like the other sections.




What perhaps fixes this problem is defining my own section command like this:

\definehead[summary][section]

\setuphead[summary]
 [
 number=no,
 style=bold,
 before={\page\setupbackgrounds[text][text][state=start]
   [background=color,backgroundcolor=gray]},
 after={\setupbackgrounds[text][text][state=stop]}
 ]

According to the wiki
(http://wiki.contextgarden.net/Command/setupbackgrounds) that should work,
but Context doesn't seem to understand the syntax and prints the part:
[background=color,backgroundcolor=gray] before the section title.

What did I do wrong?

Greetings,

Rob



___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Grey background for pages belonging to last section of every chapter

2015-01-30 Thread Wolfgang Schuster

 Am 30.01.2015 um 17:18 schrieb Rob Heusdens robh...@xs4all.nl:
 
 Hello list,
 
 For the last section of every chapter I want a grey background for the
 text, which otherwise should look the same as every other section, except
 that it starts on a new page (I can set that by defining my own section
 command).
 
 The last section summarizes the chapter.
 
 My current implementation is using a frame:
 
 
 \defineframed[achtergrond]
[frame=off,
background=color,
backgroundcolor=gray,
width=fit,
height=fit,
offset=2ex,
align={flushleft,nothyphenated,verytolerant}]
 
 And use it as:
 
 \achtergrond{
 \section{Last section}
 
 \startitemize[n]
 \item ...
 \stopitemize
 }
 
 But this does not accomodate sections longer then a page. And I can't
 place \page command in the middle of an itemize, and using \stopitemize,
 \startitemize[continue] makes the pages vary in sizes.
 
 Is there some way to achieve the desired effect (grey background behind
 the text, and otherwise page layour identical to other sections) without
 the problem that text exceeds the page size?
 
 Greetings,
 
 Rob
 
 PS. The defined frame is also used elsewhere, but the last section should
 in fact not have normal alignment like the other sections.
 
 
 
 
 What perhaps fixes this problem is defining my own section command like this:
 
 \definehead[summary][section]
 
 \setuphead[summary]
 [
 number=no,
 style=bold,
 before={\page\setupbackgrounds[text][text][state=start]
   [background=color,backgroundcolor=gray]},
 after={\setupbackgrounds[text][text][state=stop]}
 ]
 
 According to the wiki
 (http://wiki.contextgarden.net/Command/setupbackgrounds 
 http://wiki.contextgarden.net/Command/setupbackgrounds) that should work,
 but Context doesn't seem to understand the syntax and prints the part:
 [background=color,backgroundcolor=gray] before the section title.
 
 What did I do wrong?

1. Put both assignments in the same argument, i.e. change


\setupbackgrounds[text][text][state=start][background=color,backgroundcolor=gray]

to


\setupbackgrounds[text][text][state=start,background=color,backgroundcolor=gray]

2. You have to finish the page before you disable the coloured background.

  after={\page\setupbackgrounds[…]}

Wolfgang___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Grey background for pages belonging to last section of every chapter

2015-01-30 Thread Wolfgang Schuster

 Am 30.01.2015 um 18:17 schrieb Rob Heusdens robh...@xs4all.nl:
 
 Problem is however resetting the background. In the after option of
 \setuphead will not work, the \page is ejected directly after the section
 title. I want to reset to normal background after the section itself
 finishes. After this special section (summary) always a new chapter begins
 (except perhaps the last summary).
 
 Should I add that manually as the last command of every summary (where
 also the chapter ends), or is there some way to perform a command after
 the summary itself (at the location where one would place \stopsummary if
 using the \startsummary syntax) ends?
 
 The background should only be displayed behind the text itself, not the
 whole text area (so if a section ends halfway of the page, the bottom part
 should have no background) with some extra space surrounding it
 (above,below,left,right) using the offset or perhaps backgroundoffset
 options of \setupframed).

Use text backgrounds.

\definetextbackground
  [SummaryBackground]
  [frame=off,
   background=color,
   backgroundcolor=gray]

\definehead[summary][section]

\setuphead
  [summary]
  [before=,
   beforesection={\blank\starttextbackground[SummaryBackground]},
   aftersection={\stoptextbackground\blank}]

\starttext

\startsection[title=Knuth]

\input{knuth}

\stopsection

\startsummary[title=Zapf]

\input{zapf}

\stopsummary

\stoptext

Wolfgang___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Grey background for pages belonging to last section of every chapter

2015-01-30 Thread Rob Heusdens

 Am 30.01.2015 um 17:18 schrieb Rob Heusdens robh...@xs4all.nl:

 Hello list,

 For the last section of every chapter I want a grey background for the
 text, which otherwise should look the same as every other section,
 except
 that it starts on a new page (I can set that by defining my own section
 command).

 The last section summarizes the chapter.

 My current implementation is using a frame:


 \defineframed[achtergrond]
[frame=off,
background=color,
backgroundcolor=gray,
width=fit,
height=fit,
offset=2ex,
align={flushleft,nothyphenated,verytolerant}]

 And use it as:

 \achtergrond{
 \section{Last section}

 \startitemize[n]
 \item ...
 \stopitemize
 }

 But this does not accomodate sections longer then a page. And I can't
 place \page command in the middle of an itemize, and using
 \stopitemize,
 \startitemize[continue] makes the pages vary in sizes.

 Is there some way to achieve the desired effect (grey background behind
 the text, and otherwise page layour identical to other sections)
 without
 the problem that text exceeds the page size?

 Greetings,

 Rob

 PS. The defined frame is also used elsewhere, but the last section
 should
 in fact not have normal alignment like the other sections.




 What perhaps fixes this problem is defining my own section command like
 this:

 \definehead[summary][section]

 \setuphead[summary]
 [
 number=no,
 style=bold,
 before={\page\setupbackgrounds[text][text][state=start]
   [background=color,backgroundcolor=gray]},
 after={\setupbackgrounds[text][text][state=stop]}
 ]

 According to the wiki
 (http://wiki.contextgarden.net/Command/setupbackgrounds
 http://wiki.contextgarden.net/Command/setupbackgrounds) that should
 work,
 but Context doesn't seem to understand the syntax and prints the part:
 [background=color,backgroundcolor=gray] before the section title.

 What did I do wrong?

 1. Put both assignments in the same argument, i.e. change

 
 \setupbackgrounds[text][text][state=start][background=color,backgroundcolor=gray]

 to

 
 \setupbackgrounds[text][text][state=start,background=color,backgroundcolor=gray]

 2. You have to finish the page before you disable the coloured background.

   after={\page\setupbackgrounds[…]}

 Wolfgang

Hello Wolfgang,

Yes, of course! I misinterpreted it, but now I see there is in fact only 3
options, not 4. I was misdirected by the 4 lines displayed below the
command explaining the syntax.

Problem is however resetting the background. In the after option of
\setuphead will not work, the \page is ejected directly after the section
title. I want to reset to normal background after the section itself
finishes. After this special section (summary) always a new chapter begins
(except perhaps the last summary).

Should I add that manually as the last command of every summary (where
also the chapter ends), or is there some way to perform a command after
the summary itself (at the location where one would place \stopsummary if
using the \startsummary syntax) ends?

The background should only be displayed behind the text itself, not the
whole text area (so if a section ends halfway of the page, the bottom part
should have no background) with some extra space surrounding it
(above,below,left,right) using the offset or perhaps backgroundoffset
options of \setupframed).


Greetings,

Rob

___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Grey background for pages belonging to last section of every chapter

2015-01-30 Thread Wolfgang Schuster

 Am 30.01.2015 um 19:28 schrieb Rob Heusdens robh...@xs4all.nl:
 
 Use text backgrounds.
 
 \definetextbackground
  [SummaryBackground]
  [frame=off,
   background=color,
   backgroundcolor=gray]
 
 \definehead[summary][section]
 
 \setuphead
  [summary]
  [before=,
   beforesection={\blank\starttextbackground[SummaryBackground]},
   aftersection={\stoptextbackground\blank}]
 
 \starttext
 
 \startsection[title=Knuth]
 
 \input{knuth}
 
 \stopsection
 
 \startsummary[title=Zapf]
 
 \input{zapf}
 
 \stopsummary
 
 \stoptext
 
 Wolfgang
 
 Hello Wolfgang,
 
 Your example works. After adjusting the \summary to using \startsummary,
 \stopsummary, and using your code, with only minor additions, as below:
 
 \definetextbackground
  [SummaryBackground]
  [frame=off,
   background=color,
   backgroundcolor=gray,
   backgroundoffset=2ex] % - added
 
 \definehead[summary][section]
 
 \setuphead[summary]
[number=no, % - added
style=bold, % - added
before=,
beforesection={\page\starttextbackground[SummaryBackground]}, % -
 changed \blank to \page
aftersection={\stoptextbackground\page}] % - changed \blank to \page
 
 I get some unwanted result. See the picture.
 
 The bold does not show up, and a small portion of the topleft corner of
 the background frame is missing
 
 Changing bold to italic also has no effect.
 
 Something strange
 
 Also trying with \blank instead of \page, the background then starts right
 after the previous section, and it seems the indentation causes the
 missing background on the first line.
 
 So I placed \noindentation\page into beforesection (replacing \blank)
 and get the background result I want, but still the bold is missing in the
 summary title, and too much whitespace appears before the section title.
 
 The title should be placed in the same position as normal text would
 appear (and as a side note: in fact I am copying a style that was used in
 a printed book that I typeset, in which each section title - except for
 the summary - is just a normal sentence (or 2) typeset bold, with the rest
 of the text appearing after the section title just as after a normal
 sentence, so no vertical space between title and first sentence of the
 section. Since it appears in the content also, I had to use section
 commands, but is this behaviour duplicatable using setuphead for section?)
 
 
 How can I adjust that?

Make a working minimal example which shows the problem because I’cant
reproduce the problems you mention.

Wolfgang___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Grey background for pages belonging to last section of every chapter

2015-01-30 Thread Rob Heusdens
 Make a working minimal example which shows the problem because I’cant
 reproduce the problems you mention.

 Wolfgang

Hello Wofgang,

So far I am unable of re-producing the missing bold description for
summary section titles (and all of  sudden, the summary titles no longer
show up in the TOC either even though 'summary' is included in the
definedcombinedlist , although the page still shows with empty title).

This example does however show that the alignment to the section title of
summary sections does not line up properly with normal section text. It's
a bit too low. How to fix that?

And another thing, the background sometimes extends to a new page even
though there is no text, which looks silly. Deleting the \blank in the
\setupheads entry for the option after does not help.

Below is the code.

Greetings,

Rob

% test background
\setupwhitespace[none]
\setupindenting[yes, small, next]
\setuppagenumbering[alternative=doublesided]

\definetextbackground
  [SummaryBackground]
  [frame=off,
   background=color,
   backgroundcolor=gray,
   backgroundoffset=2ex]

\definehead[summary][section]

\setuphead
  [summary]
  [number=no,
   style=bold,
   before=,
   beforesection={\noindentation\page\starttextbackground[SummaryBackground]},
   aftersection={\stoptextbackground\blank}]

\setuphead[section][number=no,style=bold]


\definecombinedlist[content][section,summary]
\setupcombinedlist[content][level=4, alternative=c]

\starttext
\completecontent
\page
\dorecurse{9}{
\startsection[title={Knuth -- \recurselevel}]

\input{knuth}

\stopsection
}

\startsummary[title=Samenvatting]

\input{zapf}

\stopsummary

\stoptext


___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Grey background for pages belonging to last section of every chapter

2015-01-30 Thread Rob Heusdens
Correction, I added offset=none,frameoffset=0pt, to the parameters for
the textbackground frame.

Code again with correction:

% test background
\setupwhitespace[none]
\setupindenting[yes, small, next]
\setuppagenumbering[alternative=doublesided]

\definetextbackground
  [SummaryBackground]
  [frame=off,offset=none,frameoffset=0pt,
   background=color,
   backgroundcolor=gray,
   backgroundoffset=2ex]

\definehead[summary][section]

\setuphead
  [summary]
  [number=no,
   style=bold,
   before=,
   beforesection={\noindentation\page\starttextbackground[SummaryBackground]},
   aftersection={\stoptextbackground\blank}]

\setuphead[section][number=no,style=bold]


\definecombinedlist[content][section,summary]
\setupcombinedlist[content][level=4, alternative=c]

\starttext
\completecontent
\page
\dorecurse{9}{
\startsection[title={Knuth -- \recurselevel}]

\input{knuth}

\stopsection
}

\startsummary[title=Samenvatting]

\input{zapf}

\stopsummary

\stoptext



Still the summary title is a bit lower on the page then other text.


___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___

Re: [NTG-context] Grey background for pages belonging to last section of every chapter

2015-01-30 Thread Rob Heusdens
 Use text backgrounds.

 \definetextbackground
   [SummaryBackground]
   [frame=off,
background=color,
backgroundcolor=gray]

 \definehead[summary][section]

 \setuphead
   [summary]
   [before=,
beforesection={\blank\starttextbackground[SummaryBackground]},
aftersection={\stoptextbackground\blank}]

 \starttext

 \startsection[title=Knuth]

 \input{knuth}

 \stopsection

 \startsummary[title=Zapf]

 \input{zapf}

 \stopsummary

 \stoptext

 Wolfgang

Hello Wolfgang,

Your example works. After adjusting the \summary to using \startsummary,
\stopsummary, and using your code, with only minor additions, as below:

\definetextbackground
  [SummaryBackground]
  [frame=off,
   background=color,
   backgroundcolor=gray,
   backgroundoffset=2ex] % - added

\definehead[summary][section]

\setuphead[summary]
[number=no, % - added
style=bold, % - added
before=,
beforesection={\page\starttextbackground[SummaryBackground]}, % -
changed \blank to \page
aftersection={\stoptextbackground\page}] % - changed \blank to \page

I get some unwanted result. See the picture.

The bold does not show up, and a small portion of the topleft corner of
the background frame is missing

Changing bold to italic also has no effect.

Something strange

Also trying with \blank instead of \page, the background then starts right
after the previous section, and it seems the indentation causes the
missing background on the first line.

So I placed \noindentation\page into beforesection (replacing \blank)
and get the background result I want, but still the bold is missing in the
summary title, and too much whitespace appears before the section title.

The title should be placed in the same position as normal text would
appear (and as a side note: in fact I am copying a style that was used in
a printed book that I typeset, in which each section title - except for
the summary - is just a normal sentence (or 2) typeset bold, with the rest
of the text appearing after the section title just as after a normal
sentence, so no vertical space between title and first sentence of the
section. Since it appears in the content also, I had to use section
commands, but is this behaviour duplicatable using setuphead for section?)


How can I adjust that?

Greetings,

Rob

(my context version is  2014.12.03 18:26)___
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___