ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* currentheadnumber / doif.. problem
@ 2007-09-09 23:21 Peter Schorsch
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Schorsch @ 2007-09-09 23:21 UTC (permalink / raw)
  To: ntg-context

Hi,

I tried to get the full present heading-number. If I am using currentnumber
I am getting back only the last part of the heading-number. So I tried do
implement a function like this:

\def\presentheadnumber%
        {\doifelse{\headnumber[section]}{}%
                {\headnumber[chapter]}%
                {\headnumber[section]}%
        }

but always the else-part is executed. I also tried to use doifemptyelse,
doifnumber etc.. but as soon i am using headnumber[...] only the else-part
will be executed. Can anyone help me with this problem? Or am I going a
complete wrong way?

Thanks

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: currentheadnumber / doif.. problem
  2007-10-15 22:01       ` Peter Schorsch
@ 2007-10-18 19:46         ` Peter Schorsch
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Schorsch @ 2007-10-18 19:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

ok,

I found the solution. In the documentation (cont-eni.pdf) at page 172 
following is written:

For example:
\currentheadnumber   : 8.3
\headnumber[chapter] : 8
\headnumber[section] : 8.3

but that is partly wrong. There should be standing (change example from 8.3 to 
8.3.2):

For example:
\finalsectionnumber : 8.3.2
\currentheadnumber   : 2
\headnumber[chapter] : 8
\headnumber[section] : 8.3

Or are \finalsectionnumber and \currentheadnumber interchanged in the code and 
the documentation is as it should be? But that is a question I cannot answer.

Ciao, P.
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: currentheadnumber / doif.. problem
  2007-09-26  0:09     ` Aditya Mahajan
@ 2007-10-15 22:01       ` Peter Schorsch
  2007-10-18 19:46         ` Peter Schorsch
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Schorsch @ 2007-10-15 22:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 588 bytes --]

Aditya wrote:
> Can you create a minimum example to play with?

I attached the module t-pararef.tex and the example pararef-test.tex. The ref1 
is still wrong. 

When I replace \currentheadnumber in \paragraphMark with the before defined 
\presentheadnumber  context is saying that a «Missing control sequence 
inserted» - but I don't see any mistake there (but there must be)...

But finally I only want that the ref1 in the example is also working (see at 
the end of example file).

A second questions: why is the paragraph of ref3 in the example indented?

Thanks, P.

[-- Attachment #2: pararef-test.tex --]
[-- Type: text/x-tex, Size: 1692 bytes --]

\usemodule[pararef]

\starttext

\chapter{first heading}

\section{hamha}

\startparagraph\paragraphMark[ref1]\paragraphHeading{tztzttzt}
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla 
\stopparagraph

\startparagraph
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla 
\stopparagraph

\section[ref2]{dumdidim}

\startparagraph
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla 
\stopparagraph

\chapter{first heading}

\startparagraph
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla 
\stopparagraph

\startparagraph\paragraphHeading{heuho}
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla 
\stopparagraph

\startparagraph\paragraphMark[ref3]
blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla 
\stopparagraph


ref1 should be: para. 1.1/2 and is: \crossref{para.}[ref1]

ref2 should be: sec. 1.2 and is: \crossref{sec.}[ref2]

ref3 should be: para. 2/3 and is: \crossref{para.}[ref3]

\stoptext

[-- Attachment #3: t-pararef.tex --]
[-- Type: text/x-tex, Size: 1348 bytes --]

\startmodule[pararef]

\unprotect

% variable and functions
%
% paragraphNumber		running number starts at every heading with 1
%
% paragraphMark[]		Marks the paragraph to make references to it 
% tmpparagraphMark{}[]		replaces temporary paragraphMark until 
%				presentheadnumber is working
% getParagraphNumber		Writes paragraphNumber (for itmize-enviorement
% startParagraph		Starts and stops a paragraph
% 	stopParagraph
% paragraphHeading{}		Defines the margin-heading of that paragraph
% crossref{}[]			common command for internal references

\definenumber[paragraphNumber]

\setuphead[chapter,section,subsection,subsubsection][after={\resetnumber[paragraphNumber]}]


\def\presentheadnumber
	{\doifelse{\headnumber[section]}{0}%
		{\headnumber[chapter]}%
		{\headnumber[section]}%
	}

\def\paragraphMark[#1]
	{\expanded{\textreference[#1]{\presentheadnumber/\getnumber[paragraphNumber]}}}

\define\getParagraphNumber
	{\incrementnumber[paragraphNumber]%
	\inothermargin{\color[grey]%
	{\tfx\getnumber[paragraphNumber]~}}
	}

\definestartstop[paragraph]
  [before=
	{\blank[medium]\incrementnumber[paragraphNumber]%
	\inothermargin{\color[grey]%
	{\tfx\getnumber[paragraphNumber]~}}},
   after={\blank[medium]}]

\def\paragraphHeading#1%
	{\inmargin{#1}%
	}

\def\crossref#1[#2]%
	{\color[grey]{#1 \in[#2]}%
	}

\protect
\stopmodule
\endinput

[-- Attachment #4: Type: text/plain, Size: 487 bytes --]

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: currentheadnumber / doif.. problem
  2007-09-25 19:42   ` Peter Schorsch
@ 2007-09-26  0:09     ` Aditya Mahajan
  2007-10-15 22:01       ` Peter Schorsch
  0 siblings, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2007-09-26  0:09 UTC (permalink / raw)
  To: tralalas, mailing list for ConTeXt users

On Tue, 25 Sep 2007, Peter Schorsch wrote:

> hm.. it still executes always the else-part of the doifelse-function....

Can you create a minimum example to play with?

Aditya
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: currentheadnumber / doif.. problem
  2007-09-12 13:25 ` Aditya Mahajan
@ 2007-09-25 19:42   ` Peter Schorsch
  2007-09-26  0:09     ` Aditya Mahajan
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Schorsch @ 2007-09-25 19:42 UTC (permalink / raw)
  To: ntg-context

hm.. it still executes always the else-part of the doifelse-function.... 

>
> (Untested)
>
> > \def\presentheadnumber%
> >        {\doifelse{\headnumber[section]}{0}%
>
>                                          ^^^^^^
>
> >                {\headnumber[chapter]}%
> >                {\headnumber[section]}%
> >        }
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: currentheadnumber / doif.. problem
  2007-09-10 11:09 Peter Schorsch
@ 2007-09-12 13:25 ` Aditya Mahajan
  2007-09-25 19:42   ` Peter Schorsch
  0 siblings, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2007-09-12 13:25 UTC (permalink / raw)
  To: tralalas, mailing list for ConTeXt users

On Mon, 10 Sep 2007, Peter Schorsch wrote:

> Hi,
>
> I tried to get the full present heading-number. If I am using currentnumber
> the result is only the last part of the heading-number. So I tried do
> implement a function like this:

(Untested)

> \def\presentheadnumber%
>        {\doifelse{\headnumber[section]}{0}%
                                         ^^^^^^
>                {\headnumber[chapter]}%
>                {\headnumber[section]}%
>        }
>

Aditya
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: currentheadnumber / doif.. problem
       [not found] <mailman.1.1189504801.15983.ntg-context@ntg.nl>
@ 2007-09-12  8:09 ` Duncan Hothersall
  0 siblings, 0 replies; 8+ messages in thread
From: Duncan Hothersall @ 2007-09-12  8:09 UTC (permalink / raw)
  To: ntg-context

Hi Peter
> Date: Mon, 10 Sep 2007 01:21:26 +0200
> From: Peter Schorsch <tralalas@freenet.de>
> Subject: [NTG-context] currentheadnumber / doif.. problem
> To: ntg-context@ntg.nl
>
> Hi,
>
> I tried to get the full present heading-number. If I am using currentnumber
> I am getting back only the last part of the heading-number. So I tried do
> implement a function like this:
>
> ...
I don't have much time to investigate properly but there should be a 
\complexheadnumber defined in core-sec which gives you what you need. 
This should be tied to \headnumber though, so if that doesn't work it 
may be to do with where or how you are using the command. Do you have a 
complete minimal example document?

Duncan
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

* currentheadnumber / doif.. problem
@ 2007-09-10 11:09 Peter Schorsch
  2007-09-12 13:25 ` Aditya Mahajan
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Schorsch @ 2007-09-10 11:09 UTC (permalink / raw)
  To: ntg-context

Hi,

I tried to get the full present heading-number. If I am using currentnumber
the result is only the last part of the heading-number. So I tried do
implement a function like this:

\def\presentheadnumber%
        {\doifelse{\headnumber[section]}{}%
                {\headnumber[chapter]}%
                {\headnumber[section]}%
        }

but always the else-part is executed. I also tried to use doifemptyelse,
doifnumber etc.. but as soon i am using headnumber[...] only the else-part
will be executed. Can anyone help me with this problem? Or am I going a
complete wrong way?

Thanks
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-10-18 19:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-09 23:21 currentheadnumber / doif.. problem Peter Schorsch
2007-09-10 11:09 Peter Schorsch
2007-09-12 13:25 ` Aditya Mahajan
2007-09-25 19:42   ` Peter Schorsch
2007-09-26  0:09     ` Aditya Mahajan
2007-10-15 22:01       ` Peter Schorsch
2007-10-18 19:46         ` Peter Schorsch
     [not found] <mailman.1.1189504801.15983.ntg-context@ntg.nl>
2007-09-12  8:09 ` Duncan Hothersall

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).