ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Section setup
@ 2009-10-13 17:05 Martin Scholz
  2009-10-16 19:06 ` Mojca Miklavec
  0 siblings, 1 reply; 16+ messages in thread
From: Martin Scholz @ 2009-10-13 17:05 UTC (permalink / raw)
  To: ntg-context

Hi List,

I'm trying to setup a new document in Context, and a newbee, so I now 
want to setup the section head as following

§ Secnum - Sectitle

Where the § Secnum part is set up in the margin and the Sectitle over the 
Text is there any solution how to get it done?

Greetings

Martin

___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Section setup
  2009-10-13 17:05 Section setup Martin Scholz
@ 2009-10-16 19:06 ` Mojca Miklavec
  2009-10-16 23:22   ` Martin Scholz
  0 siblings, 1 reply; 16+ messages in thread
From: Mojca Miklavec @ 2009-10-16 19:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, Oct 13, 2009 at 19:05, Martin Scholz wrote:
> Hi List,
>
> I'm trying to setup a new document in Context, and a newbee, so I now
> want to setup the section head as following
>
> § Secnum - Sectitle
>
> Where the § Secnum part is set up in the margin and the Sectitle over the
> Text is there any solution how to get it done?

Not to be taken too seriously: you need to ask a more complex
(challenging) questions to get a better chance for an answer :) :) :)

It's best to study chapter 8 of cont-eni.pdf from pragma-ade.com to
get the idea of how to handle section modifications.

Here's one possible solution:

\def\mynumbercommand#1{§ #1 --}
\setuphead
	[section]
	[numbercommand=\mynumbercommand,
	 alternative=inmargin]

You may get a bit too big distance, but you can do one of the following tricks:
a) shorten the distance between margin and text
b) instead of just "--" you can use something like
    \hbox to 0.2mm{--\hss}
to fake negative spacing or add explicit negative kerning.

Mojca
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Section setup
  2009-10-16 19:06 ` Mojca Miklavec
@ 2009-10-16 23:22   ` Martin Scholz
  2009-10-17  7:38     ` Mojca Miklavec
  2009-10-17 14:58     ` Janneman
  0 siblings, 2 replies; 16+ messages in thread
From: Martin Scholz @ 2009-10-16 23:22 UTC (permalink / raw)
  To: ntg-context

Am Fri, 16 Oct 2009 21:06:01 +0200 schrieb Mojca Miklavec:

> On Tue, Oct 13, 2009 at 19:05, Martin Scholz wrote:
>> Hi List,
>>
>> I'm trying to setup a new document in Context, and a newbee, so I now
>> want to setup the section head as following
>>
>> § Secnum - Sectitle
>>
>> Where the § Secnum part is set up in the margin and the Sectitle over
>> the Text is there any solution how to get it done?
> 
> Not to be taken too seriously: you need to ask a more complex
> (challenging) questions to get a better chance for an answer :) :) :)
> 
> It's best to study chapter 8 of cont-eni.pdf from pragma-ade.com to get
> the idea of how to handle section modifications.
> 
> Here's one possible solution:
> 
> \def\mynumbercommand#1{§ #1 --}
> \setuphead
> 	[section]
> 	[numbercommand=\mynumbercommand,
> 	 alternative=inmargin]
> 
> You may get a bit too big distance, but you can do one of the following
> tricks: a) shorten the distance between margin and text b) instead of
> just "--" you can use something like
>     \hbox to 0.2mm{--\hss}
> to fake negative spacing or add explicit negative kerning.
> 
> Mojca
> 
Hi Mojca,

I'm a type of learner by reading the sourcecode, so it is easier for me 
if I see examples in the code then reading manuals... thanks for you 
help, will try your example later that day...

Thanks and greetings

Martin

___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Section setup
  2009-10-16 23:22   ` Martin Scholz
@ 2009-10-17  7:38     ` Mojca Miklavec
  2009-10-17 14:58     ` Janneman
  1 sibling, 0 replies; 16+ messages in thread
From: Mojca Miklavec @ 2009-10-17  7:38 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> Hi Mojca,
>
> I'm a type of learner by reading the sourcecode

That's perfect! In ConTeXt that's pretty important. The starting point is here:
    http://source.contextgarden.net/tex/context/base

Mojca

PS: I guess you had other kind of sourcecode in mind, but the
statement above is still true. Anyway: there are quite some examples
in the manual. You could also start browsing manual sources.
(http://context.aanhet.net/svn/manuals/)
___________________________________________________________________________________
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
___________________________________________________________________________________


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

* Re: Section setup
  2009-10-16 23:22   ` Martin Scholz
  2009-10-17  7:38     ` Mojca Miklavec
@ 2009-10-17 14:58     ` Janneman
  2009-10-17 15:40       ` Wolfgang Schuster
  2009-10-17 15:46       ` Janneman
  1 sibling, 2 replies; 16+ messages in thread
From: Janneman @ 2009-10-17 14:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Martin Scholz skrev:
> Am Fri, 16 Oct 2009 21:06:01 +0200 schrieb Mojca Miklavec:
>
>   
>> On Tue, Oct 13, 2009 at 19:05, Martin Scholz wrote:
>>     
>>> Hi List,
>>>
>>> I'm trying to setup a new document in Context, and a newbee, so I now
>>> want to setup the section head as following
>>>
>>> § Secnum - Sectitle
>>>
>>> Where the § Secnum part is set up in the margin and the Sectitle over
>>> the Text is there any solution how to get it done?
>>>       
>> Not to be taken too seriously: you need to ask a more complex
>> (challenging) questions to get a better chance for an answer :) :) :)
>>
>> It's best to study chapter 8 of cont-eni.pdf from pragma-ade.com to get
>> the idea of how to handle section modifications.
>>
>> Here's one possible solution:
>>
>> \def\mynumbercommand#1{§ #1 --}
>> \setuphead
>> 	[section]
>> 	[numbercommand=\mynumbercommand,
>> 	 alternative=inmargin]
>>
>> You may get a bit too big distance, but you can do one of the following
>> tricks: a) shorten the distance between margin and text b) instead of
>> just "--" you can use something like
>>     \hbox to 0.2mm{--\hss}
>> to fake negative spacing or add explicit negative kerning.
>>
>> Mojca
>>
>>     
> Hi Mojca,
>
> I'm a type of learner by reading the sourcecode, so it is easier for me 
> if I see examples in the code then reading manuals... thanks for you 
> help, will try your example later that day...
>
> Thanks and greetings
>
> Martin
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>   
Maybe a more simplified solution

\definehead[paragraf][section]
\setuphead[paragraf][before= {\crlf \S},after=,style=bold]
% or style=something else

\starttext

\paragraf[ref]{Paragraf title}

\input tufte

\stoptext


Cheers

Janneman
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Section setup
  2009-10-17 14:58     ` Janneman
@ 2009-10-17 15:40       ` Wolfgang Schuster
  2009-10-17 15:46       ` Janneman
  1 sibling, 0 replies; 16+ messages in thread
From: Wolfgang Schuster @ 2009-10-17 15:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 17.10.2009 um 16:58 schrieb Janneman:

> Maybe a more simplified solution
>
> \definehead[paragraf][section]
> \setuphead[paragraf][before= {\crlf \S},after=,style=bold]

don't do this, before and after are meant for vertical material like  
\blank or \thinrule etc.

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
___________________________________________________________________________________


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

* Re: Section setup
  2009-10-17 14:58     ` Janneman
  2009-10-17 15:40       ` Wolfgang Schuster
@ 2009-10-17 15:46       ` Janneman
  2009-10-17 15:54         ` Wolfgang Schuster
  2009-10-17 16:12         ` Aditya Mahajan
  1 sibling, 2 replies; 16+ messages in thread
From: Janneman @ 2009-10-17 15:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Janneman skrev:
> Martin Scholz skrev:
>> Am Fri, 16 Oct 2009 21:06:01 +0200 schrieb Mojca Miklavec:
>>
>>  
>>> On Tue, Oct 13, 2009 at 19:05, Martin Scholz wrote:
>>>    
>>>> Hi List,
>>>>
>>>> I'm trying to setup a new document in Context, and a newbee, so I now
>>>> want to setup the section head as following
>>>>
>>>> § Secnum - Sectitle
>>>>
>>>> Where the § Secnum part is set up in the margin and the Sectitle over
>>>> the Text is there any solution how to get it done?
>>>>       
>>> Not to be taken too seriously: you need to ask a more complex
>>> (challenging) questions to get a better chance for an answer :) :) :)
>>>
>>> It's best to study chapter 8 of cont-eni.pdf from pragma-ade.com to get
>>> the idea of how to handle section modifications.
>>>
>>> Here's one possible solution:
>>>
>>> \def\mynumbercommand#1{§ #1 --}
>>> \setuphead
>>>     [section]
>>>     [numbercommand=\mynumbercommand,
>>>      alternative=inmargin]
>>>
>>> You may get a bit too big distance, but you can do one of the following
>>> tricks: a) shorten the distance between margin and text b) instead of
>>> just "--" you can use something like
>>>     \hbox to 0.2mm{--\hss}
>>> to fake negative spacing or add explicit negative kerning.
>>>
>>> Mojca
>>>
>>>     
>> Hi Mojca,
>>
>> I'm a type of learner by reading the sourcecode, so it is easier for 
>> me if I see examples in the code then reading manuals... thanks for 
>> you help, will try your example later that day...
>>
>> Thanks and greetings
>>
>> Martin
>>
>> ___________________________________________________________________________________ 
>>
>> 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
>> ___________________________________________________________________________________ 
>>
>>   
> Maybe a more simplified solution
>
> \definehead[paragraf][section]
> \setuphead[paragraf][before= {\crlf \S},after=,style=bold]
> % or style=something else
>
> \starttext
>
> \paragraf[ref]{Paragraf title}
>
> \input tufte
>
> \stoptext
>
>
> Cheers
>
> Janneman
> ___________________________________________________________________________________ 
>
> 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
> ___________________________________________________________________________________ 
>
Understood! ;-)

\definehead[paragraf][section]
\def\mynumbercommand#1{\bf{\S} #1 --}
\setuphead[paragraf][numbercommand=\mynumbercommand,alternative=inmargin]

\starttext

\paragraf[ref]{TEST}

\input tufte


\stoptext
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Section setup
  2009-10-17 15:46       ` Janneman
@ 2009-10-17 15:54         ` Wolfgang Schuster
  2009-10-17 16:12         ` Aditya Mahajan
  1 sibling, 0 replies; 16+ messages in thread
From: Wolfgang Schuster @ 2009-10-17 15:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 17.10.2009 um 17:46 schrieb Janneman:

> Understood! ;-)
>
> \definehead[paragraf][section]
> \def\mynumbercommand#1{\bf{\S} #1 --}

\define[1]\MyNumberCommand{§ #1 –} % let's use the right signs when  
possible :)

> \setuphead[paragraf][numbercommand= 
> \mynumbercommand,alternative=inmargin]

\setuphead[paragraf][numbercommand= 
\MyNumberCommand,numberstyle=bold,alternative=inmargin]

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
___________________________________________________________________________________


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

* Re: Section setup
  2009-10-17 15:46       ` Janneman
  2009-10-17 15:54         ` Wolfgang Schuster
@ 2009-10-17 16:12         ` Aditya Mahajan
  2009-10-17 20:29           ` \starbuffer in own macros Andreas Harder
  1 sibling, 1 reply; 16+ messages in thread
From: Aditya Mahajan @ 2009-10-17 16:12 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 517 bytes --]

On Sat, 17 Oct 2009, Janneman wrote:

> \definehead[paragraf][section]
> \def\mynumbercommand#1{\bf{\S} #1 --}
> \setuphead[paragraf][numbercommand=\mynumbercommand,alternative=inmargin]
>
> \starttext
>
> \paragraf[ref]{TEST}
>
> \input tufte
>
>
> \stoptext

Another option:

\definehead[paragraph][section]
\setuphead[paragraph][alternative=inmargin]

\setuplabeltext[paragraph={{§ },{ –}}]

\starttext

\dorecurse{5}
{\paragraph{A repeated quote}
\input knuth \endgraf}

\stoptext

[-- Attachment #2: Type: text/plain, Size: 486 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* \starbuffer in own macros
  2009-10-17 16:12         ` Aditya Mahajan
@ 2009-10-17 20:29           ` Andreas Harder
  2009-10-18  9:14             ` Wolfgang Schuster
  0 siblings, 1 reply; 16+ messages in thread
From: Andreas Harder @ 2009-10-17 20:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

Hi all,

now that \inline[ref] etc. work—whereas in the case of \someline[ref]  
\inline[ref] always jumps to the else-branch of its definition and  
outputs the same line twice—I tried, obviously naive, to realize the  
following functionality (attachment).

[-- Attachment #2: test-linenumbering4.tex --]
[-- Type: application/octet-stream, Size: 1736 bytes --]


\def\startMyCite#1{\startbuffer[#1]\startlines[#1]}
\def\stopMyCite#1{\stoplines[#1]\stopbuffer}

\def\getMyCite#1{%
  \startlinenumbering[{\in[lr:b:#1]}] % the result of \in[lr:b:#1]
    \getbuffer[#1]
  \stoplinenumbering}

\starttext
\startlinenumbering
  \someline[lin:a] We thrive in information--thick worlds because of
  our marvelous and everyday ca- pacity to select, edit, single out,
  structure, highlight, group, pair, merge, harmo- nize, synthesize,
  focus,
  % \startline[test]
  \startMyCite{test}
    organize, condense, reduce, boil down, choose, categorize,
    catalog, classify, list, abstract, scan, look into, idealize,
    isolate, discriminate, dis- tinguish, screen, pigeonhole, pick
    over, sort, integrate, blend, inspect, filter, lump, skip, smooth,
    chunk, average, approximate, cluster, aggregate, outline,
    summarize, itemize, review, dip into, flip through, browse, glance
    into, leaf through,
  \stopMyCite{test}
  % \stopline[test]
  skim, re- fine, enumerate, glean, synopsize, winnow the wheat from
  the chaff and separate the sheep from the goats.
\stoplinenumbering

\inline[lin:a] % 1--1 instead of 1
% \inline[test]

\getMyCite{test} should output

\startlinenumbering[3]
  organize, condense, reduce, boil down, choose, categorize, catalog,
  classify, list, abstract, scan, look into, idealize, isolate,
  discriminate, dis- tinguish, screen, pigeonhole, pick over, sort,
  integrate, blend, inspect, filter, lump, skip, smooth, chunk,
  average, approximate, cluster, aggregate, outline, summarize,
  itemize, review, dip into, flip through, browse, glance into, leaf
  through,
\stoplinenumbering

\stoptext

%%% Local Variables: 
%%% mode: context
%%% TeX-master: t
%%% End: 

[-- Attachment #3: Type: text/plain, Size: 200 bytes --]



It seems that the (wrong?) use of \starbuffer in a macro is the cause  
of the error: ! File ended while scanning use of \dododowithbuffer.

Can someone provide a correction?


Regards
	Andreas





[-- Attachment #4: Type: text/plain, Size: 486 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: \starbuffer in own macros
  2009-10-17 20:29           ` \starbuffer in own macros Andreas Harder
@ 2009-10-18  9:14             ` Wolfgang Schuster
  2009-10-18 10:02               ` Andreas Harder
  0 siblings, 1 reply; 16+ messages in thread
From: Wolfgang Schuster @ 2009-10-18  9:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 17.10.2009 um 22:29 schrieb Andreas Harder:

> Hi all,
>
> now that \inline[ref] etc. work—whereas in the case of \someline 
> [ref] \inline[ref] always jumps to the else-branch of its definition  
> and outputs the same line twice—I tried, obviously naive, to realize  
> the following functionality (attachment).
>
> It seems that the (wrong?) use of \starbuffer in a macro is the  
> cause of the error: ! File ended while scanning use of  
> \dododowithbuffer.
>
> Can someone provide a correction?

1. This \doifelsesamelinereference macro in page-lin.mkiv should be  
changed to:

\def\doifelsesamelinereference#1#2#3%
   {\doifreferencefoundelse{lr:b:#1}
      {\edef\fline{\currentreferencedefault}% was \currentreferencetext
       \doifreferencefoundelse{lr:e:#1}
         {\edef\tline{\currentreferencedefault}% was  
\currentreferencetext
          \ifx\fline\tline#2\else#3\fi}
         {\unknownreference{#1}#2}}
      {\unknownreference{#1}#2}}

2. You can't hide start/stopbuffer.

Before I help you provide us with more information, e.g. should the  
text in the buffer
appear also in the complete text or do you it only in the snippet?

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
___________________________________________________________________________________


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

* Re: \starbuffer in own macros
  2009-10-18  9:14             ` Wolfgang Schuster
@ 2009-10-18 10:02               ` Andreas Harder
  2009-10-18 22:50                 ` Wolfgang Schuster
  0 siblings, 1 reply; 16+ messages in thread
From: Andreas Harder @ 2009-10-18 10:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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


Am 18.10.2009 um 11:14 schrieb Wolfgang Schuster:

>
> Am 17.10.2009 um 22:29 schrieb Andreas Harder:
>
>> Hi all,
>>
>> now that \inline[ref] etc. work—whereas in the case of \someline 
>> [ref] \inline[ref] always jumps to the else-branch of its  
>> definition and outputs the same line twice—I tried, obviously  
>> naive, to realize the following functionality (attachment).
>>
>> It seems that the (wrong?) use of \starbuffer in a macro is the  
>> cause of the error: ! File ended while scanning use of  
>> \dododowithbuffer.
>>
>> Can someone provide a correction?
>
> 1. This \doifelsesamelinereference macro in page-lin.mkiv should be  
> changed to:
>
> \def\doifelsesamelinereference#1#2#3%
>  {\doifreferencefoundelse{lr:b:#1}
>     {\edef\fline{\currentreferencedefault}% was \currentreferencetext
>      \doifreferencefoundelse{lr:e:#1}
>        {\edef\tline{\currentreferencedefault}% was  
> \currentreferencetext
>         \ifx\fline\tline#2\else#3\fi}
>        {\unknownreference{#1}#2}}
>     {\unknownreference{#1}#2}}
>
Hello Wolfgang!

Thanks a lot!

> 2. You can't hide start/stopbuffer.
>
> Before I help you provide us with more information, e.g. should the  
> text in the buffer
> appear also in the complete text or do you it only in the snippet?


Sorry, that I did not make myself clear. The real setup is: I've a lot  
of line numbered text in the appendix of the document. In the body I'd  
like to cite out of it (with the same line numbers as in the source/ 
appendix). The appendix should stay unchanged. I've made a new test  
file:

[-- Attachment #2: test-linenumbering5.tex --]
[-- Type: application/octet-stream, Size: 1576 bytes --]


\def\startMyCite#1{\startbuffer[#1]\startlines[#1]}
\def\stopMyCite#1{\stoplines[#1]\stopbuffer}

\def\getMyCite#1{%
  \startlinenumbering[{\in[lr:b:#1]}] % the result of \in[lr:b:#1]
    \getbuffer[#1]
  \stoplinenumbering}


\starttext

\startbodymatter
  test text test text test text test text test text test text test
  text test text test text test text test text test text test text

  she told: \getMyCite{test} % perhaps better \getMyCite[test]
  
  test text test text test text test text test text test text test
  text test text test text test text test text test text test text
\stopbodymatter


\startappendices
  \startlinenumbering
    We thrive in information--thick worlds because of our marvelous
    and everyday ca- pacity to select, edit, single out, structure,
    highlight, group, pair, merge, harmo- nize, synthesize, focus,
    \startMyCite{test}
      organize, condense, reduce, boil down, choose, categorize,
      catalog, classify, list, abstract, scan, look into, idealize,
      isolate, discriminate, dis- tinguish, screen, pigeonhole, pick
      over, sort, integrate, blend, inspect, filter, lump, skip,
      smooth, chunk, average, approximate, cluster, aggregate,
      outline, summarize, itemize, review, dip into, flip through,
      browse, glance into, leaf through,
    \stopMyCite{test}
    skim, re- fine, enumerate, glean, synopsize, winnow the wheat from
    the chaff and separate the sheep from the goats.
  \stoplinenumbering
\stopappendices

\stoptext

%%% Local Variables: 
%%% mode: context
%%% TeX-master: t
%%% End: 

[-- Attachment #3: Type: text/plain, Size: 35 bytes --]




Thanks for your effort

	Andreas

[-- Attachment #4: Type: text/plain, Size: 486 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: \starbuffer in own macros
  2009-10-18 10:02               ` Andreas Harder
@ 2009-10-18 22:50                 ` Wolfgang Schuster
  2009-10-19 14:13                   ` Andreas Harder
  0 siblings, 1 reply; 16+ messages in thread
From: Wolfgang Schuster @ 2009-10-18 22:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 18.10.2009 um 12:02 schrieb Andreas Harder:

>> Before I help you provide us with more information, e.g. should the  
>> text in the buffer
>> appear also in the complete text or do you it only in the snippet?
>
> Sorry, that I did not make myself clear. The real setup is: I've a  
> lot of line numbered text in the appendix of the document. In the  
> body I'd like to cite out of it (with the same line numbers as in  
> the source/appendix). The appendix should stay unchanged.

For the beginning you can play with this code, it has to be changed
in a few parts (e.g. make \setuplines local) but it's what I can read
from your description above and the code you showed in the previous  
message.

\def\doifelsesamelinereference#1#2#3%
   {\doifreferencefoundelse{lr:b:#1}
      {\edef\fline{\currentreferencedefault}% was \currentreferencetext
       \doifreferencefoundelse{lr:e:#1}
         {\edef\tline{\currentreferencedefault}% was  
\currentreferencetext
          \ifx\fline\tline#2\else#3\fi}
         {\unknownreference{#1}#2}}
      {\unknownreference{#1}#2}}

\def\startMyCite[#1]%
   {\def\stopMyCite
      {\setuplines[before=,after=]%
       \startlines\startline[#1]\getbuffer[#1]\stopline[#1]\stoplines
       \savebuffer[#1]}%
    \dostartbuffer[#1][startMyCite][stopMyCite]}

\def\getMyCite[#1]%
   {\doifreferencefoundelse{lr:b:#1}
      {\startlinenumbering[\currentreferencedefault]}
       \startlinenumbering
    \startlines\readfile{\jobname-#1.tmp}{}{}\stoplines
    \stoplinenumbering}

\starttext

\startbodymatter
   test text test text test text test text test text test text test
   text test text test text test text test text test text test text

   she told: \getMyCite[test] % perhaps better \getMyCite[test]

   test text test text test text test text test text test text test
   text test text test text test text test text test text test text
\stopbodymatter


\startappendices
   \startlinenumbering
     We thrive in information--thick worlds because of our marvelous
     and everyday ca- pacity to select, edit, single out, structure,
     highlight, group, pair, merge, harmo- nize, synthesize, focus,
     \startMyCite[test]
       organize, condense, reduce, boil down, choose, categorize,
       catalog, classify, list, abstract, scan, look into, idealize,
       isolate, discriminate, dis- tinguish, screen, pigeonhole, pick
       over, sort, integrate, blend, inspect, filter, lump, skip,
       smooth, chunk, average, approximate, cluster, aggregate,
       outline, summarize, itemize, review, dip into, flip through,
       browse, glance into, leaf through,
     \stopMyCite
     skim, re- fine, enumerate, glean, synopsize, winnow the wheat from
     the chaff and separate the sheep from the goats.
   \stoplinenumbering
\stopappendices

\stoptext

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
___________________________________________________________________________________


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

* Re: \starbuffer in own macros
  2009-10-18 22:50                 ` Wolfgang Schuster
@ 2009-10-19 14:13                   ` Andreas Harder
  2009-10-19 15:53                     ` Wolfgang Schuster
  0 siblings, 1 reply; 16+ messages in thread
From: Andreas Harder @ 2009-10-19 14:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1083 bytes --]


Am 19.10.2009 um 00:50 schrieb Wolfgang Schuster:

>
> Am 18.10.2009 um 12:02 schrieb Andreas Harder:
>
>>> Before I help you provide us with more information, e.g. should  
>>> the text in the buffer
>>> appear also in the complete text or do you it only in the snippet?
>>
>> Sorry, that I did not make myself clear. The real setup is: I've a  
>> lot of line numbered text in the appendix of the document. In the  
>> body I'd like to cite out of it (with the same line numbers as in  
>> the source/appendix). The appendix should stay unchanged.
>
> For the beginning you can play with this code, it has to be changed
> in a few parts (e.g. make \setuplines local) but it's what I can read
> from your description above and the code you showed in the previous  
> message.

Thank you very much for your help!

I adapted your solution and it works as intended.

There is an inherent "problem" as one can see in the attachment, but  
since mostly I cite a whole paragraph it's not a real problem. I think  
therefore you used the lines-environment?



Again many thanks!

	Andreas

[-- Attachment #1.2.1: Type: text/html, Size: 1706 bytes --]

[-- Attachment #1.2.2: test-linenumbering6.tex --]
[-- Type: application/octet-stream, Size: 4438 bytes --]


% \def\doifelsesamelinereference#1#2#3%
%  {\doifreferencefoundelse{lr:b:#1}
%     {\edef\fline{\currentreferencedefault}% was \currentreferencetext
%      \doifreferencefoundelse{lr:e:#1}
%        {\edef\tline{\currentreferencedefault}% was \currentreferencetext
%         \ifx\fline\tline#2\else#3\fi}
%        {\unknownreference{#1}#2}}
%     {\unknownreference{#1}#2}}

% \def\startMyCite[#1]%
%  {\def\stopMyCite
%     {\setuplines[before=,after=]%
%      \startlines\startline[#1]\getbuffer[#1]\stopline[#1]\stoplines
%      \savebuffer[#1]}%
%   \dostartbuffer[#1][startMyCite][stopMyCite]}

% \def\getMyCite[#1]%
%  {\doifreferencefoundelse{lr:b:#1}
%     {\startlinenumbering[\currentreferencedefault]}
%      \startlinenumbering
%   \startlines\readfile{\jobname-#1.tmp}{}{}\stoplines
%   \stoplinenumbering}

% \setuplayout[width=middle,backspace=5cm]

\def\startMyCite[#1]%
 {\def\stopMyCite
   {\startline[#1]\getbuffer[#1]\stopline[#1]\savebuffer[#1]}%
   \dostartbuffer[#1][startMyCite][stopMyCite]}


\def\getMyCite[#1]{%
  \doifreferencefoundelse{lr:b:#1} 
    {\startlinenumbering[\currentreferencedefault]}
    \startlinenumbering
      \readfile{\jobname-#1.tmp}{}{}
    \stoplinenumbering}


\setupwhitespace[big]
% \setupalign[right,nothyphenated]

\starttext

\startbodymatter
 test text test text test text test text test text test text test
 text test text test text test text test text test text test text

 she told:\crlf
 \getMyCite[test-1] % lines 3--6 but 3--7 in the appendix

 test text test text test text test text test text test text test
 text test text test text test text test text test text test text

 and he answered:\crlf
 \getMyCite[test-2]

 test text test text test text test text test text test text test
 text test text test text test text test text test text test text

 she replied:\crlf
 \getMyCite[test-3]
\stopbodymatter


\startappendices
 \startlinenumbering
   We thrive in information--thick worlds because of our marvelous and
   everyday ca- pacity to select, edit, single out, structure,
   highlight, group, pair, merge, harmo- nize, synthesize, focus,
   organize, condense, reduce, boil down, choose,
   \startMyCite[test-1]
     {\red categorize}, catalog, classify, list, abstract, scan, look
     into, idealize, isolate, discriminate, dis- tinguish, screen,
     pigeonhole, pick over, sort, integrate, blend, inspect, filter,
     lump, skip, smooth, chunk, average, approximate, cluster,
     aggregate, outline, summarize, {\red itemize,}
   \stopMyCite
   review, dip into, flip through, browse, glance into, leaf through,
   skim, re- fine, enumerate, glean, synopsize, winnow the wheat from
   the chaff and separate the sheep from the goats.

   We thrive in information--thick worlds because of our marvelous and
   everyday ca- pacity to select, edit, single out, structure,
   highlight, group, pair, merge, harmo- nize, synthesize, focus,
   organize, condense, reduce, boil down, choose,
   \startMyCite[test-2]
     {\red categorize}, catalog, classify, list, abstract, scan, look
     into, idealize, isolate, discriminate, dis- tinguish, screen,
     pigeonhole, pick over, sort, integrate, blend, inspect, filter,
     lump, skip, smooth, chunk, average, approximate, cluster,
     aggregate, outline, summarize, {\red itemize,}
   \stopMyCite
   review, dip into, flip through, browse, glance into, leaf through,
   skim, re- fine, enumerate, glean, synopsize, winnow the wheat from
   the chaff and separate the sheep from the goats.

   \startMyCite[test-3]
     We thrive in information--thick worlds because of our marvelous
     and everyday ca- pacity to select, edit, single out, structure,
     highlight, group, pair, merge, harmo- nize, synthesize, focus,
     organize, condense, reduce, boil down, choose, categorize,
     catalog, classify, list, abstract, scan, look into, idealize,
     isolate, discriminate, dis- tinguish, screen, pigeonhole, pick
     over, sort, integrate, blend, inspect, filter, lump, skip,
     smooth, chunk, average, approximate, cluster, aggregate, outline,
     summarize, itemize, review, dip into, flip through, browse,
     glance into, leaf through, skim, re- fine, enumerate, glean,
     synopsize, winnow the wheat from the chaff and separate the sheep
     from the goats.
   \stopMyCite
 \stoplinenumbering
\stopappendices

\stoptext

%%% Local Variables: 
%%% mode: context
%%% TeX-master: t
%%% End: 

[-- Attachment #1.2.3: Type: text/html, Size: 285 bytes --]

[-- Attachment #2: Type: text/plain, Size: 486 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: \starbuffer in own macros
  2009-10-19 14:13                   ` Andreas Harder
@ 2009-10-19 15:53                     ` Wolfgang Schuster
  2009-10-19 16:01                       ` Andreas Harder
  0 siblings, 1 reply; 16+ messages in thread
From: Wolfgang Schuster @ 2009-10-19 15:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 19.10.2009 um 16:13 schrieb Andreas Harder:

> There is an inherent "problem" as one can see in the attachment, but  
> since mostly I cite a whole paragraph it's not a real problem.

This happens when you start in the middle of a paragraph/line which  
results in different line breaking.

> I think therefore you used the lines-environment?

I used \start/\stoplines because it was in your code.

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
___________________________________________________________________________________


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

* Re: \starbuffer in own macros
  2009-10-19 15:53                     ` Wolfgang Schuster
@ 2009-10-19 16:01                       ` Andreas Harder
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas Harder @ 2009-10-19 16:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 19.10.2009 um 17:53 schrieb Wolfgang Schuster:

>
> Am 19.10.2009 um 16:13 schrieb Andreas Harder:
>
>> There is an inherent "problem" as one can see in the attachment,  
>> but since mostly I cite a whole paragraph it's not a real problem.
>
> This happens when you start in the middle of a paragraph/line which  
> results in different line breaking.
>
>> I think therefore you used the lines-environment?
>
> I used \start/\stoplines because it was in your code.


Oh, I see, the s was too much …

Andreas
___________________________________________________________________________________
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
___________________________________________________________________________________


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

end of thread, other threads:[~2009-10-19 16:01 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-13 17:05 Section setup Martin Scholz
2009-10-16 19:06 ` Mojca Miklavec
2009-10-16 23:22   ` Martin Scholz
2009-10-17  7:38     ` Mojca Miklavec
2009-10-17 14:58     ` Janneman
2009-10-17 15:40       ` Wolfgang Schuster
2009-10-17 15:46       ` Janneman
2009-10-17 15:54         ` Wolfgang Schuster
2009-10-17 16:12         ` Aditya Mahajan
2009-10-17 20:29           ` \starbuffer in own macros Andreas Harder
2009-10-18  9:14             ` Wolfgang Schuster
2009-10-18 10:02               ` Andreas Harder
2009-10-18 22:50                 ` Wolfgang Schuster
2009-10-19 14:13                   ` Andreas Harder
2009-10-19 15:53                     ` Wolfgang Schuster
2009-10-19 16:01                       ` Andreas Harder

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