How to preserve a TeX token list across passes (the ConTeXt way)?
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. Abbreviations are introduced with \setAbbreviation[<key>]{<abbr>} {<meaning>}{<description>} which defines macros \<key> \<key>@meaning and \<key>@description. Each call to \<key> calls \writeutilitycommand {\addToList[\string\usedAbbreviations]{<key>}, so after the first run the .tui file has a number of "c \addToList[\usedAbbreviations] {something}" lines in it. Functionality is similar for the bibliography. The \cite command writes \addToList[\usedReferences]{<cite>} into .tui. So, the .tuo file should populate used* lists and I could typeset the list of used abbreviations in initialization order with \executeListIntersection[\abbreviations][\usedAbbreviations] {\printAbbreviation}. Same for used bib references. But well, lists remain empty. I'll attach the module and the .tui file. And excuse me, I have never ever used a mailing list. How am I supposed to answer to a certain message in the chain? Thanks guys. Jyrki
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. copy cont-sys.rme -> cont.sys.tex
and add the module loading there (cont-rme will be overwritten when you update)
Abbreviations are introduced with \setAbbreviation[<key>]{<abbr>}{<meaning>}{<description>} which defines macros \<key> \<key>@meaning and \<key>@description. Each call to \<key> calls \writeutilitycommand{\addToList[\string\usedAbbreviations]{<key>}, so after the first run the .tui file has a number of "c \addToList[\usedAbbreviations]{something}" lines in it.
Functionality is similar for the bibliography. The \cite command writes \addToList[\usedReferences]{<cite>} into .tui.
So, the .tuo file should populate used* lists and I could typeset the list of used abbreviations in initialization order with \executeListIntersection[\abbreviations][\usedAbbreviations]{\printAbbreviation}. Same for used bib references. But well, lists remain empty.
so how about using \definesynonyms (see end of core-syn.tex)
I'll attach the module and the .tui file.
And excuse me, I have never ever used a mailing list. How am I supposed to answer to a certain message in the chain? Thanks guys.
just hit the reply button in your mail agent 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 -----------------------------------------------------------------
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.
Abbreviations are introduced with \setAbbreviation[<key>]{<abbr>}{<meaning>}{<description>} which defines macros \<key> \<key>@meaning and \<key>@description. Each call to \<key> calls \writeutilitycommand{\addToList[\string\usedAbbreviations]{<key>}, so after the first run the .tui file has a number of "c \addToList[\usedAbbreviations]{something}" lines in it.
Functionality is similar for the bibliography. The \cite command writes \addToList[\usedReferences]{<cite>} into .tui.
So, the .tuo file should populate used* lists and I could typeset the list of used abbreviations in initialization order with \executeListIntersection[\abbreviations][\usedAbbreviations]{\printAbbreviation}. Same for used bib references. But well, lists remain empty.
I'll attach the module and the .tui file.
And excuse me, I have never ever used a mailing list. How am I supposed to answer to a certain message in the chain? Thanks guys. i'm away two days (ntg tex days) and will oook into it after that
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 -----------------------------------------------------------------
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.
Abbreviations are introduced with \setAbbreviation[<key>]{<abbr>}{<meaning>}{<description>} which defines macros \<key> \<key>@meaning and \<key>@description. Each call to \<key> calls \writeutilitycommand{\addToList[\string\usedAbbreviations]{<key>}, so after the first run the .tui file has a number of "c \addToList[\usedAbbreviations]{something}" lines in it.
Functionality is similar for the bibliography. The \cite command writes \addToList[\usedReferences]{<cite>} into .tui.
So, the .tuo file should populate used* lists and I could typeset the list of used abbreviations in initialization order with \executeListIntersection[\abbreviations][\usedAbbreviations]{\printAbbreviation}. Same for used bib references. But well, lists remain empty.
I'll attach the module and the .tui file. is there also a test file?
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 -----------------------------------------------------------------
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 -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Jyrki Ruuskanen