Re: [NTG-context] \starbuffer in own macros

2009-10-19 Thread Andreas Harder
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 bufferappear 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 changedin a few parts (e.g. make \setuplines local) but it's what I can readfrom 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?

test-linenumbering6.tex
Description: Binary data
Again many thanks!	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
___


Re: [NTG-context] \starbuffer in own macros

2009-10-19 Thread 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.

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
___


Re: [NTG-context] \starbuffer in own macros

2009-10-19 Thread Andreas Harder


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
___


Re: [NTG-context] \starbuffer in own macros

2009-10-18 Thread 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}}

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
___


Re: [NTG-context] \starbuffer in own macros

2009-10-18 Thread 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.


\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
___


[NTG-context] \starbuffer in own macros

2009-10-17 Thread 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).


test-linenumbering4.tex
Description: Binary data



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




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