From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/71614 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: Counter for section heads Date: Fri, 7 Oct 2011 19:56:01 +0200 Message-ID: <16FFCD23-1FDD-4681-8E7D-121B7B4882DE@googlemail.com> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1318010184 13865 80.91.229.12 (7 Oct 2011 17:56:24 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 7 Oct 2011 17:56:24 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Oct 07 19:56:19 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RCEed-0003fN-EB for gctc-ntg-context-518@m.gmane.org; Fri, 07 Oct 2011 19:56:15 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id C4190CB003; Fri, 7 Oct 2011 19:56:14 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id DN2iCZTWYTmp; Fri, 7 Oct 2011 19:56:12 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id D49AECAFFC; Fri, 7 Oct 2011 19:56:11 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 87CC8CAFFC for ; Fri, 7 Oct 2011 19:56:09 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id DjAufdY-5D7o for ; Fri, 7 Oct 2011 19:56:07 +0200 (CEST) Original-Received: from filter5-til.mf.surf.net (filter5-til.mf.surf.net [194.171.167.221]) by balder.ntg.nl (Postfix) with ESMTP id 305C3CA680 for ; Fri, 7 Oct 2011 19:56:07 +0200 (CEST) Original-Received: from mail-yx0-f169.google.com (mail-yx0-f169.google.com [209.85.213.169]) by filter5-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p97Hu5MR003178 for ; Fri, 7 Oct 2011 19:56:06 +0200 Original-Received: by yxi19 with SMTP id 19so5130013yxi.14 for ; Fri, 07 Oct 2011 10:56:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=GZb3MAv9sRKXCy4XzWV8vVVGAQlP3xpLhzXihbLHAMg=; b=l0Jaovpnn57Z/gABxYlvDzzQ6aGLnkgba+M1yZq8TKtFdnAuwycYadpZJC0X9nG5FD IDIH915MaBzSOG13Jj2czAML2sZZR0eLl68VCTt/0zhpzWD40Bzlf3ZQ8aKQzotTo92C E5oEkrcnSTwgFZMA8oS40fh0t3c3IOMsA4PF4= Original-Received: by 10.223.88.148 with SMTP id a20mr12249649fam.28.1318010165181; Fri, 07 Oct 2011 10:56:05 -0700 (PDT) Original-Received: from [192.168.2.31] (p5482CF64.dip.t-dialin.net. [84.130.207.100]) by mx.google.com with ESMTPS id v17sm13803566fai.18.2011.10.07.10.56.03 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 07 Oct 2011 10:56:04 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.1244.3) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=209.85.213.169; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0xFFRU6w8 - a44f6846adb1 - 20111007 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.221 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 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 Xref: news.gmane.org gmane.comp.tex.context:71614 Archived-At: Am 07.10.2011 um 19:29 schrieb Aditya Mahajan: > On Fri, 7 Oct 2011, Wolfgang Schuster wrote: > >> >> Am 07.10.2011 um 06:27 schrieb Aditya Mahajan: >> >>> I want to obtain the total number of sections at a particular depth, and thought that I could get that using \laststructurecounter{....}. But, I cannot find the name of the counter associated with sections. >>> >>> Is there a macro or a lua function that returns the name of a counter for the current section (that can then be used by \laststructurecounter)? >>> >>> Is there any other way to find the number of sections at the current depth. For example, this document >>> >>> ~~~ >>> \section {one} >>> >>> \subsection{1} \subsection{2} \subsection{3} >>> ~~~ >>> >>> has one section at depth 1 and three sectons at depth 2. >> >> \definestructureconversionset[default][n,n,A,I][n] >> >> \starttext >> >> \section {one} >> >> \subsection{1} \subsection{2} \subsection{3} >> >> Raw number: >> \namedheadnumber{section} >> \namedheadnumber{subsection} >> >> Converted number: >> \headnumber[section] >> \headnumber[subsection] >> >> \stoptext > > This gives the value of the number. Is there a way to get the structurecounter associated with it? I am interested in also finding the total number of sections at the current level (equivalent to \laststructurecounter[...]). \setuphead[section][textstyle=\tt,page=yes] \starttext \dorecurse{2} {\section{[[#1]]} \dorecurse{\numexpr#1+2\relax} {\subsection{[[#1-##1]]} \starttabulate \NC First \EQ \somenamedheadnumber{subsection}{first} \NC\NR \NC Current \EQ \somenamedheadnumber{subsection}{current} \NC\NR \NC Last \EQ \somenamedheadnumber{subsection}{last} \NC\NR \stoptabulate}} \stoptext See also: - http://wiki.contextgarden.net/Thumb_index - http://wiki.contextgarden.net/Last_Head_Number 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 ___________________________________________________________________________________