ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Andreas Harder <aharder@uni-koblenz.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: \starbuffer in own macros
Date: Mon, 19 Oct 2009 16:13:28 +0200	[thread overview]
Message-ID: <A47B9952-7D8D-48F8-AED3-96ECEF91F08A@uni-koblenz.de> (raw)
In-Reply-To: <C649EFFF-3315-476E-8502-AE41000C9CD9@googlemail.com>


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

  reply	other threads:[~2009-10-19 14:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2009-10-19 15:53                     ` Wolfgang Schuster
2009-10-19 16:01                       ` Andreas Harder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A47B9952-7D8D-48F8-AED3-96ECEF91F08A@uni-koblenz.de \
    --to=aharder@uni-koblenz.de \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).