From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/27952 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: How to preserve a TeX token list across passes (the ConTeXt way)? Date: Mon, 15 May 2006 10:52:58 +0200 Message-ID: <4468416A.9040002@wxs.nl> References: <7EB85204-2670-45AE-9F5D-3B7CFDFF70CD@kotikone.fi> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1147683221 30845 80.91.229.2 (15 May 2006 08:53:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 15 May 2006 08:53:41 +0000 (UTC) Cc: Taco Hoekwater Original-X-From: ntg-context-bounces@ntg.nl Mon May 15 10:53:38 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1FfYpK-0000Yx-FW for gctc-ntg-context-518@m.gmane.org; Mon, 15 May 2006 10:53:18 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id D4B33127C4; Mon, 15 May 2006 10:53:17 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 20740-09; Mon, 15 May 2006 10:53:07 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id B69AB127B0; Mon, 15 May 2006 10:53:07 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id ED49F127B0 for ; Mon, 15 May 2006 10:53:05 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 20475-09 for ; Mon, 15 May 2006 10:53:03 +0200 (CEST) Original-Received: from mail.pragma-ade.net (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by ronja.ntg.nl (Postfix) with SMTP id CF91A1276C for ; Mon, 15 May 2006 10:53:03 +0200 (CEST) Original-Received: from [10.100.1.102] (unverified [10.100.1.102]) by controller-1 (SurgeMail 3.5b3) with ESMTP id 17149 for multiple; Mon, 15 May 2006 12:52:58 +0400 User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) Original-To: mailing list for ConTeXt users In-Reply-To: <7EB85204-2670-45AE-9F5D-3B7CFDFF70CD@kotikone.fi> X-Server: High Performance Mail Server - http://surgemail.com r=-274017400 X-Authenticated-User: hagen@controller-1 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:27952 Archived-At: Jyrki Ruuskanen wrote: > Ok, the module is read in cont-sys.rme with \usemodule[jtex]. It > initializes the lists inside protect / unprotect pair with > \newtoks\usedAbbreviations and \newtoks\usedReferences along with > macro definitions. first of all, here is an alternative to setting your texts; instead of doing the check-next-char stuff yourself ... %%% handle multilingual texts (and uppercase) % usage: \setText[lang]{key}{value} \def\setText{\futurelet\testchar\maybeLangSetText} \def\maybeLangSetText% {\ifx[\testchar \let\next\langSetText \else \let\next\defaultSetText \fi \next} \def\langSetText[#1]#2#3{\def\name{#2@#1}\def\bigname{#2@#1@uppercase} \expandafter\def\csname \name \endcsname{#3} \expandafter\def\csname \bigname \endcsname{\uppercase{#3}}} \def\defaultSetText#1#2{\langSetText[\currentmainlanguage]{#1}{#2}} % usage: \getText{key} \def\langGetText[#1]#2{\def\name{#2@#1}% \expandafter\ifx\csname \name \endcsname\relax \name missing!\else\csname \name \endcsname\fi} \def\getText#1{\def\name{#1@\currentlanguage}% \expandafter\ifx\csname \name \endcsname\relax \langGetText[\currentmainlanguage]{#1} \else\langGetText[\currentlanguage]{#1}\fi} ... you can use the built in functionality: \let\dowithText\firstofoneargument \def\setText {\dosingleempty\dosetText} \def\dosetText[#1]#2#3% {\setvalue{\iffirstargument#1\else\currentmainlanguage\fi @TXT@#2}{\dowithText{#3}}} \def\getText {\let\dowithText\firstofoneargument \dosingleempty\dogetText} \def\dogetText[#1]#2% {\executeifdefined{\iffirstargument#1\else\currentlanguage\fi @TXT@#2}% {\executeifdefined{\iffirstargument#1\else\currentmainlanguage\fi @TXT@#2}% {missing #2}}} \def\getUppercaseText {\let\dowithText\WORD \dosingleempty\dogetText} \starttext \setText{oeps}{whatever} \setText[de]{oeps}{de-whatever} \getText{oeps} \getText[de]{oeps} \getUppercaseText{oeps} \getUppercaseText[de]{oeps} \stoptext but, when possible, use: \setuplabeltext[oeps=whatever] \setuplabeltext[de][oeps=de-whatever] {\labeltext{oeps} \mainlanguage[de] \labeltext{oeps} \LABELTEXT{oeps}} because that is kind of integrated Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------