From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/86653 Path: news.gmane.org!not-for-mail From: Rik Newsgroups: gmane.comp.tex.context Subject: Movable code, was Re: starttexdefinition error in standalone, works in TL2013 Date: Wed, 12 Mar 2014 15:49:09 -0400 Message-ID: <5320BA35.2070702@panix.com> References: <530EBA58.3020703@rik.users.panix.com> <4FDA647E-AA4E-4619-88EE-65DE254BA093@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1337264076==" X-Trace: ger.gmane.org 1394653766 14027 80.91.229.3 (12 Mar 2014 19:49:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Mar 2014 19:49:26 +0000 (UTC) To: ntg-context@ntg.nl Original-X-From: ntg-context-bounces@ntg.nl Wed Mar 12 20:49:36 2014 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WNp9k-0001t4-1c for gctc-ntg-context-518@m.gmane.org; Wed, 12 Mar 2014 20:49:36 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id DA3FD101EC; Wed, 12 Mar 2014 20:49:34 +0100 (CET) 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 F09x5HGlg7fq; Wed, 12 Mar 2014 20:49:31 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 51385101E3; Wed, 12 Mar 2014 20:49:31 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 7A633101E3 for ; Wed, 12 Mar 2014 20:49:29 +0100 (CET) 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 77JyBx0EiKHH for ; Wed, 12 Mar 2014 20:49:28 +0100 (CET) Original-Received: from filter1-til.mf.surf.net (filter1-til.mf.surf.net [194.171.167.217]) by balder.ntg.nl (Postfix) with ESMTP id 33204101E1 for ; Wed, 12 Mar 2014 20:49:18 +0100 (CET) Original-Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by filter1-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id s2CJnA6J021608 for ; Wed, 12 Mar 2014 20:49:11 +0100 Original-Received: from [192.168.9.160] (pool-173-56-235-45.nycmny.fios.verizon.net [173.56.235.45]) by mailbackend.panix.com (Postfix) with ESMTP id B26C62E50B for ; Wed, 12 Mar 2014 15:49:09 -0400 (EDT) User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: <4FDA647E-AA4E-4619-88EE-65DE254BA093@gmail.com> X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=166.84.1.89; country=US; region=NY; city=Richmond Hill; postalcode=11418; latitude=40.7005; longitude=-73.8345; metrocode=501; areacode=718; http://maps.google.com/maps?q=40.7005,-73.8345&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0RLAHNazs - aa480f3e578a - 20140312 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.217 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:86653 Archived-At: This is a multi-part message in MIME format. --===============1337264076== Content-Type: multipart/alternative; boundary="------------080602080606090203030004" This is a multi-part message in MIME format. --------------080602080606090203030004 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 2014-03-01 07:32, Wolfgang Schuster wrote: > > \unexpanded\def\startTranslation > {\begingroup > \dosingleempty\dostartTranslation} > > \def\dostartTranslation[#1]% > {\iffirstargument > \getrawparameters[Translation][setups=,language=en,#1]% > \fi > \grabbufferdata[Translation][startTranslation][stopTranslation]} > > \def\stopTranslation > {\language[\Translationlanguage]% > \Translationsetups > (\,\getbufferdata[Translation]\removeunwantedspaces\,)% > \endgroup} > > \starttext > > \startTranslation[language=nl] > It betrays a slow-witted mentality to pursue the streams, but not to see the sources of things. > \stopTranslation > > \stoptext > > Wolfgang > Wolfgang (and list), The above code works fine with simple texts, but is not movable. Adding a footnote, as in the following, to the text section shows that: \starttext \startTranslation[language=en] It betrays a slow-witted mentality to pursue the streams, but not to see the sources of things.% \footnote{% \startTranslation[language=la] Tardi ingeni est rivulos consectari, fontes rerum non videre. \stopTranslation% } \stopTranslation \stoptext or even by: \starttext It betrays a slow-witted mentality to pursue the streams, but not to see the sources of things.% \footnote{% \startTranslation[language=la] Tardi ingeni est rivulos consectari, fontes rerum non videre. \stopTranslation% } \stoptext In LaTeX, this might be dealt with by a combination robust command definitions and \protected. When I wrote an endnotes routine in LaTeX, I used those and wrote the notes to a file which was then read back in at the appropriate time, but that does not help with pagenotes. I imagine that at the time the footnote is processed the Translationsetups and Translationlanguage macros are no longer defined, and I have no idea how one would reference the buffer contents, although it does look like they have stable names in the log file. Can this be made movable? Also, am I correct that the \iffirstargument test in the definition of dostarttranslation is redundant? My understanding is that \dosingleempty assures the presence of [#1]. -- Rik --------------080602080606090203030004 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable
On 2014-03-01 07:32, Wolfgang Schuster wrote:

\unexpanded\def\startTranslation
  {\begingroup
   \dosingleempty\dostartTranslation}

\def\dostartTranslation[#1]%
  {\iffirstargument
     \getrawparameters[Translation][setups=3D,language=3Den,#1]%
   \fi
   \grabbufferdata[Translation][startTranslation][stopTranslation]}

\def\stopTranslation
  {\language[\Translationlanguage]%
   \Translationsetups
   (\,\getbufferdata[Translation]\removeunwantedspaces\,)%
   \endgroup}

\starttext

\startTranslation[language=3Dnl]
It betrays a slow-witted mentality to pursue the streams, but not to see =
the sources of things.
\stopTranslation

\stoptext

Wolfgang


Wolfgang (and list),

The above code works fine with simple texts, but is not movable. Adding a footnote, as in the following, to the text section shows that:

\starttext
\startTranslation[language=3Den]
=A0 It betrays a slow-witted mentality to pursue the streams, but not to
=A0 see the sources of things.%
=A0 \footnote{%
=A0=A0=A0 \startTranslation[language=3Dla]
=A0=A0=A0=A0=A0 Tardi ingeni est rivulos consectari, fonte= s rerum non videre.
=A0=A0=A0 \stopTranslation%
=A0 }
\stopTranslation
\stoptext

or even by:

\starttext
=A0 It betrays a slow-witted mentality to pursue the streams, but not to
=A0 see the sources of things.%
=A0 \footnote{%
=A0=A0=A0 \startTranslation[language=3Dla]
=A0=A0=A0=A0=A0 Tardi ingeni est rivulos consectari, fontes rer= um non videre.
=A0=A0=A0 \stopTranslation%
=A0 }
\stoptext

In LaTeX, this might be dealt with by a combination robust command definitions and \protected. When I wrote an endnotes routine in LaTeX, I used those and wrote the notes to a file which was then read back in at the appropriate time, but that does not help with pagenotes.

I imagine that at the time the footnote is processed the Translationsetups and Translationlanguage macros are no longer defined, and I have no idea how one would reference the buffer contents, although it does look like they have stable names in the log file.

Can this be made movable?

Also, am I correct that the \iffirstargument test in the definition of dostarttranslation is redundant? My understanding is that \dosingleempty assures the presence of [#1].

--
Rik
--------------080602080606090203030004-- --===============1337264076== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============1337264076==--