Re: [NTG-context] Placing a section ending depending on odd/even sectionnumber

2020-08-05 Thread Willi Egger
Wolfgang, thank you so much for your help!

Hm, when reading your explanation I start to understand my short cut in 
thinking about solving the problem.

I will build it into my project…

Thanks and kind regards
Willi

> On 4 Aug 2020, at 19:46, Wolfgang Schuster 
>  wrote:
> 
> Willi Egger schrieb am 04.08.2020 um 18:56:
>> Hi,
>> now I have another hurdle to be taken :-) — Depending on the odd or even 
>> number of the section I have to place an ornament at the end of the section.
>> I have sofar the following setup:
>> [...]
>> However the the evaluation of the sectionnumber results always in “false”, 
>> having therefore always odd as a sectionending.
> 
> You have two problem:
> 
> 1. To get the current value for \currentheadnumber you have use 
> \determineheadnumber[section] before you use it but the example below shows a 
> better method.
> 
> 2. What you do with \doifelse{...}{even} is to compare the numeric value of 
> the section with the string "even" which is always false. To check whether 
> the value is odd or even you have to use the \ifodd command.
> 
>> What to change in order to get the desired result?
> 
>  begin example
> \startsetups [section:odd]
> \vfill
> \bold {End of odd numbered section}
> \stopsetups
> 
> \startsetups [section:even]
> \vfill
> \bold {End of even numbered section}
> \stopsetups
> 
> \startsetups [section:end]
> \ifodd\namedheadnumber{section}
>  \directsetup{section:odd}
> \else
>  \directsetup{section:even}
> \fi
> \stopsetups
> 
> \setuphead
> [section]
> [aftersection=\directsetup{section:end}]
> 
> \starttext
> 
> \startsection[title=Ward]
> \input ward
> \stopsection
> 
> \page
> 
> \startsection[title=Knuth]
> \input knuth
> \stopsection
> 
> \stoptext
>  end example
> 
> 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://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
___


Re: [NTG-context] Placing a section ending depending on odd/even sectionnumber

2020-08-04 Thread Wolfgang Schuster

Willi Egger schrieb am 04.08.2020 um 18:56:

Hi,

now I have another hurdle to be taken :-) — Depending on the odd or even number 
of the section I have to place an ornament at the end of the section.

I have sofar the following setup:

[...]

However the the evaluation of the sectionnumber results always in “false”, 
having therefore always odd as a sectionending.


You have two problem:

1. To get the current value for \currentheadnumber you have use 
\determineheadnumber[section] before you use it but the example below 
shows a better method.


2. What you do with \doifelse{...}{even} is to compare the numeric value 
of the section with the string "even" which is always false. To check 
whether the value is odd or even you have to use the \ifodd command.



What to change in order to get the desired result?


 begin example
\startsetups [section:odd]
  \vfill
  \bold {End of odd numbered section}
\stopsetups

\startsetups [section:even]
  \vfill
  \bold {End of even numbered section}
\stopsetups

\startsetups [section:end]
  \ifodd\namedheadnumber{section}
\directsetup{section:odd}
  \else
\directsetup{section:even}
  \fi
\stopsetups

\setuphead
  [section]
  [aftersection=\directsetup{section:end}]

\starttext

\startsection[title=Ward]
\input ward
\stopsection

\page

\startsection[title=Knuth]
\input knuth
\stopsection

\stoptext
 end example

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Placing a section ending depending on odd/even sectionnumber

2020-08-04 Thread Willi Egger
Hi,

now I have another hurdle to be taken :-) — Depending on the odd or even number 
of the section I have to place an ornament at the end of the section.

I have sofar the following setup:

\define\stopmysection
  {\setups{endsection}}
 

\startsetups endsection
\doifelse
{\currentheadnumber} %{\headnumber[section][current]}{odd}
{even}
{\vfil
{\bf End of even numbered section}
\stopsection%
}
{\vfil
{\bf End of odd numbered section}
\stopsection%
}
\stopsetups

\starttext

\startsection[title=Ward]

\setuppagenumbering[conversion=romannumerals]

\input ward
\stopmysection

\startsection[title=Knuth]
\setuppagenumbering[conversion=numbers]

\input knuth

\stopmysection

\stoptext

However the the evaluation of the sectionnumber results always in “false”, 
having therefore always odd as a sectionending.

What to change in order to get the desired result?

Kind regards

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