From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/31229 Path: news.gmane.org!not-for-mail From: "Wolfgang Schuster" Newsgroups: gmane.comp.tex.context Subject: Re: figurenumbering Date: Thu, 5 Oct 2006 12:35:11 +0200 Message-ID: <115224fb0610050335y7c8e55f3nfa1f5fc66c9a51e8@mail.gmail.com> References: <45217FDC.29825.E3688E@wwl.musensturm.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0214349026==" X-Trace: sea.gmane.org 1160044540 32532 80.91.229.2 (5 Oct 2006 10:35:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 5 Oct 2006 10:35:40 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Thu Oct 05 12:35:39 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1GVQZf-0003P1-RW for gctc-ntg-context-518@m.gmane.org; Thu, 05 Oct 2006 12:35:31 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 758FA1FEA8; Thu, 5 Oct 2006 12:35:31 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 14742-04-4; Thu, 5 Oct 2006 12:35:23 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 863E01FE98; Thu, 5 Oct 2006 12:35:23 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id BE8AF1FE98 for ; Thu, 5 Oct 2006 12:35:19 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 14742-04-3 for ; Thu, 5 Oct 2006 12:35:14 +0200 (CEST) Original-Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.179]) by ronja.ntg.nl (Postfix) with SMTP id C1C851FE93 for ; Thu, 5 Oct 2006 12:35:13 +0200 (CEST) Original-Received: by py-out-1112.google.com with SMTP id c39so592948pyd for ; Thu, 05 Oct 2006 03:35:12 -0700 (PDT) Original-Received: by 10.35.97.1 with SMTP id z1mr3275876pyl; Thu, 05 Oct 2006 03:35:11 -0700 (PDT) Original-Received: by 10.35.39.7 with HTTP; Thu, 5 Oct 2006 03:35:11 -0700 (PDT) Original-To: "mailing list for ConTeXt users" In-Reply-To: <45217FDC.29825.E3688E@wwl.musensturm.de> X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:31229 Archived-At: --===============0214349026== Content-Type: multipart/alternative; boundary="----=_Part_8588_10718067.1160044511621" ------=_Part_8588_10718067.1160044511621 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 2006/10/2, Wolfgang Werners-Lucchini : > > > This was your example (not exactly the same) you posted as your > > first example file and works now as expected. > > Ahh! I should implement my own testsuit. > > Wolfgang Hi Wolfgang you should not only make a testsuit. It is normaly better to work with highlevel macros in your document to easily replace the macrodefinition than replacing the macros in your document. I made a first step for your document. \unprotect % increment the floatnumber \def\incrementfloatnumber% {\dodoubleempty\doincrementfloatnumber} \def\doincrementfloatnumber[#1][#2]% {\ifsecondargument \dodoincrementfloatnumber[#1][#2]% \else\iffirstargument \dodoincrementfloatnumber[#1][1]% \fi\fi} \def\dodoincrementfloatnumber[#1][#2]% {\count1=0 \loop \ifnum\count1<#2 \advance\count1 by 1 \incrementnumber[#1] \repeat} % set the number \def\setfloatnumber% {\dodoubleempty\dosetfloatnumber} \def\dosetfloatnumber[#1][#2]% {\ifnum#2<\rawnumber[#1] \message{:::: Your number need to be higher than the current counter-value ::::} \else \count2=#2 \advance\count2 by -\rawnumber[#1] \incrementfloatnumber[#1][\count2] \fi} % Todo: % % \definefloatnumber[#1] % % example: % \definefloatnumber[figure] % o \incrementfigurenumber[#1] --> \incrementfloatnumber[figure][#1] % o \setfigurenumber[#1] --> \setfloatnumber[figure][#1] \protect \starttext \placefigure{}{\framed{Blub}} \placefigure{}{\framed{Bautz}} \placefigure{}{\framed{Bla}} This were \rawnumber[figure] figures by now! \setnumber[figure]{8} We want to count on with \rawnumber[figure]. \placefigure{}{\framed{Plong}} Figurenumber is incremented to \rawnumber[figure]. \placefigure{}{\framed{Plong}} \incrementnumber[figure] \placefigure{}{\framed{Plong}} \incrementfloatnumber[figure][2] \placefigure{}{\framed{Plong}} \setfloatnumber[figure][25] \placefigure{}{\framed{Plong}} \setfloatnumber[figure][12] \placefigure{}{\framed{Plong}} \stoptext Wolfgang ------=_Part_8588_10718067.1160044511621 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline

2006/10/2, Wolfgang Werners-Lucchini <wwl@musensturm.de>:
> This was your example (not exactly the same) you posted as your
> first example file and works now as expected.

Ahh! I should implement my own testsuit.

Wolfgang
 
Hi Wolfgang
 
you should not only make a testsuit.
 
It is normaly better to work with highlevel macros in your document to easily
replace the macrodefinition than replacing the macros in your document.
 
I made a first step for your document.
 
<example>
 
\unprotect

% increment the floatnumber

\def\incrementfloatnumber%
 {\dodoubleempty\doincrementfloatnumber}

\def\doincrementfloatnumber[#1][#2]%
 {\ifsecondargument
    \dodoincrementfloatnumber[#1][#2]%
  \else\iffirstargument
    \dodoincrementfloatnumber[#1][1]%
  \fi\fi}

\def\dodoincrementfloatnumber[#1][#2]%
  {\count1=0
   \loop
   \ifnum\count1<#2
     \advance\count1 by 1
     \incrementnumber[#1]
   \repeat}

% set the number

\def\setfloatnumber%
 {\dodoubleempty\dosetfloatnumber}

\def\dosetfloatnumber[#1][#2]%
  {\ifnum#2<\rawnumber[#1]
     \message{:::: Your number need to be higher than the current counter-value ::::}
   \else
     \count2=#2
     \advance\count2 by -\rawnumber[#1]
     \incrementfloatnumber[#1][\count2]
   \fi}

% Todo:
%
% \definefloatnumber[#1]
%
% example:
% \definefloatnumber[figure]
% o \incrementfigurenumber[#1] --> \incrementfloatnumber[figure][#1]
% o \setfigurenumber[#1]       --> \setfloatnumber[figure][#1]

\protect

\starttext

\placefigure{}{\framed{Blub}}
\placefigure{}{\framed{Bautz}}
\placefigure{}{\framed{Bla}}

This were \rawnumber[figure] figures by now!

\setnumber[figure]{8}
We want to count on with \rawnumber[figure].

\placefigure{}{\framed{Plong}}

Figurenumber is incremented to \rawnumber[figure].

\placefigure{}{\framed{Plong}}

\incrementnumber[figure]

\placefigure{}{\framed{Plong}}

\incrementfloatnumber[figure][2]

\placefigure{}{\framed{Plong}}

\setfloatnumber[figure][25]

\placefigure{}{\framed{Plong}}

\setfloatnumber[figure][12]

\placefigure{}{\framed{Plong}}

\stoptext

</example>

 

Wolfgang

 

------=_Part_8588_10718067.1160044511621-- --===============0214349026== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context --===============0214349026==--