ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Willi Egger <context@boede.nl>
Subject: Re: Placing a section ending depending on odd/even sectionnumber
Date: Tue, 4 Aug 2020 19:46:36 +0200	[thread overview]
Message-ID: <c2a9140c-4089-f6a7-13ff-106909ed5608@gmail.com> (raw)
In-Reply-To: <13BAC8B4-9DBB-4678-B966-70FE35117076@boede.nl>

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
___________________________________________________________________________________

  reply	other threads:[~2020-08-04 17:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04 16:56 Willi Egger
2020-08-04 17:46 ` Wolfgang Schuster [this message]
2020-08-05 11:39   ` Willi Egger

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=c2a9140c-4089-f6a7-13ff-106909ed5608@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=context@boede.nl \
    --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).