* Expansion problem in natural table
@ 2003-02-08 20:52 Simon Pepping
2003-02-09 18:39 ` Simon Pepping
2003-02-09 20:26 ` Hans Hagen
0 siblings, 2 replies; 5+ messages in thread
From: Simon Pepping @ 2003-02-08 20:52 UTC (permalink / raw)
I have an expansion problem in natural tables. I need to have this:
\bTD\XMLDBcontinuepartrue\ignorespaces\XMLflush{revremark}\eTD
but \XMLflush{revremark} must be expanded. When I do that using
\expanded,
\expanded{\bTD\noexpand\XMLDBcontinuepartrue\ignorespaces\XMLflush{#1}}\eTD
I get errors when I have compound characters:
\XMLDBcontinuepartrue\ignorespaces
Kleine \dobuildtextaccent\char 127 A{}nderung
It should be
\dobuildtextaccent{\char 127} A
for it to be valid. Or it should be
\buildtextaccent\textdiaeresis A
In other words, \XMLflush{#1} should be expanded, but not all the way
down. How do I get that?
This is my hack, but it is awful because it relies on an exact number
of expansions:
\expandafter\expandafter\expandafter\def
\expandafter\expandafter\expandafter\!!stringa
\expandafter\expandafter\expandafter{\csname XML:dat:#1\endcsname}
\@EA\bTD\@EA\XMLDBcontinuepartrue\@EA\ignorespaces\!!stringa\eTD}
Error log:
\XMLDBshowElementTD #1->\expanded {\bTD \noexpand \XMLDBcontinuepartrue \ignore
spaces \XMLflush {#1}}\eTD
#1<-revremark
\expanded #1->\long \edef \@@expanded {\noexpand #1}\@@expanded
#1<-\bTD \noexpand \XMLDBcontinuepartrue \ignorespaces \XMLflush {revremark}
{\long}
{\noexpand}
{\noexpand}
\XMLflush #1->\csname \@@XMLdata :#1\endcsname
#1<-revremark
{\csname}
\@@XMLdata ->\@@XML dat
\@@XML ->XML:
\XML:dat:revremark ->Kleine Änderung
Ä->\Adiaeresis {}
\Adiaeresis ->\dohandlecharacter {Adiaeresis}
\dohandlecharacter #1->\csname \ifcsname \characterencoding #1\endcsname \chara
cterencoding \else \nocharacterencoding \fi #1\endcsname
#1<-Adiaeresis
{\csname}
{\ifcsname}
\characterencoding ->@default@
{true}
\characterencoding ->@default@
{\else}
\@default@Adiaeresis ->\buildtextaccent \textdiaeresis A
\buildtextaccent ->\ifignoreaccent \expandafter \nobuildtextaccent \else \expan
dafter \dobuildtextaccent \fi
{\iffalse}
{false}
{\expandafter}
{\fi}
\textdiaeresis ->\dohandlecharacter {textdiaeresis}
\dohandlecharacter #1->\csname \ifcsname \characterencoding #1\endcsname \chara
cterencoding \else \nocharacterencoding \fi #1\endcsname
#1<-textdiaeresis
{\csname}
{\ifcsname}
\characterencoding ->@default@
{true}
\characterencoding ->@default@
{\else}
\@default@textdiaeresis ->\char 127
\@@expanded ->\bTD \XMLDBcontinuepartrue \ignorespaces Kleine \dobuildtextaccen
t \char 127 A{}nderung
\bTD ->\dodoubleempty \parseTD
... snip ...
\parseTD [#1][#2]#3\eTD ->\getparameters [\@@tbl ][\c!ny =\tblnr ,\c!nx =\tblnc
,nc=1,nr=1,#1]\doloop {\increment \currentcol \doifnottbltag \maximumrow \curr
entcol \exitloop }\let \row \maximumrow \let \col \currentcol \dorecurse {\tbln
y } {\let \col \currentcol \settblcol \row \col \tblnx \ifnum \tblnx >\maximumr
owspan \relax \let \maximumrowspan \tblnx \fi \dorecurse {\tblnx } {\settbltag
\row \col \tblnone \increment \col }\increment \row }\decrement \col \ifnum \co
l >\maximumcol \relax \let \maximumcol \col \fi \settbltag \maximumrow \current
col \tblcell \settblcol \maximumrow \currentcol \tblnx \settblrow \maximumrow \
currentcol \tblny \edef \celltag {{\maximumrow }{\currentcol }}\@EA \settbltxt
\@EA \maximumrow \@EA \currentcol \@EA {\@EA \handleTBLcell \celltag [#1]{#3}}
#1<-
#2<-
#3<-\XMLDBcontinuepartrue \ignorespaces Kleine \dobuildtextaccent \char 127 A{}
nderung
... snip ...
\dobuildtextaccent #1#2->{\let \char \normalaccent #1\let \char \normalchar #2}
#1<-\char
#2<-1
{begin-group character {}
{\let}
{\accent}
! Missing number, treated as zero.
<to be read again>
\let
\dobuildtextaccent ... \char \normalaccent #1\let
\char \normalchar #2}
<argument> ...es Kleine \dobuildtextaccent \char 1
27 A{}nderung
--
Simon Pepping
email: spepping@scaprea.hobby.nl
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Expansion problem in natural table
2003-02-08 20:52 Expansion problem in natural table Simon Pepping
@ 2003-02-09 18:39 ` Simon Pepping
2003-02-09 20:43 ` Hans Hagen
2003-02-09 20:26 ` Hans Hagen
1 sibling, 1 reply; 5+ messages in thread
From: Simon Pepping @ 2003-02-09 18:39 UTC (permalink / raw)
Even this goes wrong:
\edef\mychar{Ä}\mychar
The real reason is that \dobuildtextaccent and \nobuildtextaccent are
protected macros.
Error log:
{\edef}
Ä->\Adiaeresis
\Adiaeresis ->\dohandlecharacter {Adiaeresis}
\dohandlecharacter #1->\csname \ifcsname \characterencoding #1\endcsname \chara
cterencoding \else \nocharacterencoding \fi #1\endcsname
#1<-Adiaeresis
{\csname}
{\ifcsname}
\characterencoding ->@default@
{true}
\characterencoding ->@default@
{\else}
\@default@Adiaeresis ->\buildtextaccent \textdiaeresis A
\buildtextaccent ->\ifignoreaccent \expandafter \nobuildtextaccent \else \expan
dafter \dobuildtextaccent \fi
{\iffalse}
{false}
{\expandafter}
{\fi}
<========= \dobuildtextaccent ( protected )
is not expanded after \fi
\textdiaeresis ->\dohandlecharacter {textdiaeresis}
\dohandlecharacter #1->\csname \ifcsname \characterencoding #1\endcsname \chara
cterencoding \else \nocharacterencoding \fi #1\endcsname
#1<-textdiaeresis
{\csname}
{\ifcsname}
\characterencoding ->@default@
{true}
\characterencoding ->@default@
{\else}
\@default@textdiaeresis ->\char 127
\mychar ->\dobuildtextaccent \char 127 A
\dobuildtextaccent #1#2->{\let \char \normalaccent #1\let \char \normalchar #2}
#1<-\char
#2<-1
{begin-group character {}
{\let}
{\accent}
! Missing number, treated as zero.
<to be read again>
\let
\dobuildtextaccent ... \char \normalaccent #1\let
\char \normalchar #2}
\mychar ->\dobuildtextaccent \char 1
27 A
l.21 \edef\mychar{Ä}\mychar
? x
Simon
On Sat, Feb 08, 2003 at 09:52:54PM +0100, Simon Pepping wrote:
> I have an expansion problem in natural tables. I need to have this:
>
> \bTD\XMLDBcontinuepartrue\ignorespaces\XMLflush{revremark}\eTD
>
> but \XMLflush{revremark} must be expanded. When I do that using
> \expanded,
>
> \expanded{\bTD\noexpand\XMLDBcontinuepartrue\ignorespaces\XMLflush{#1}}\eTD
>
> I get errors when I have compound characters:
>
> \XMLDBcontinuepartrue\ignorespaces
> Kleine \dobuildtextaccent\char 127 A{}nderung
>
> It should be
>
> \dobuildtextaccent{\char 127} A
>
> for it to be valid. Or it should be
>
> \buildtextaccent\textdiaeresis A
--
Simon Pepping
email: spepping@scaprea.hobby.nl
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Expansion problem in natural table
2003-02-08 20:52 Expansion problem in natural table Simon Pepping
2003-02-09 18:39 ` Simon Pepping
@ 2003-02-09 20:26 ` Hans Hagen
2003-02-18 20:11 ` Simon Pepping
1 sibling, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2003-02-09 20:26 UTC (permalink / raw)
At 09:52 PM 2/8/2003 +0100, Simon Pepping wrote:
>This is my hack, but it is awful because it relies on an exact number
>of expansions:
>
>\expandafter\expandafter\expandafter\def
>\expandafter\expandafter\expandafter\!!stringa
>\expandafter\expandafter\expandafter{\csname XML:dat:#1\endcsname}
>\@EA\bTD\@EA\XMLDBcontinuepartrue\@EA\ignorespaces\!!stringa\eTD}
ah, the umlauts ...
even if it would work out ok, it looks to ugly, so how about:
\def\somethingsimon{blabla}
\bTABLE
\bTR\safeexpanded{\bTD\Aumlaut}\eTD\eTR
\bTR\safeexpanded{\bTD\noexpand\somethingsimon\Aumlaut}\eTD\eTR
\eTABLE
with in enco-ini:
\appendtoks
\keepencodedtokens
\to \everysafeexpanded
and in syst-gen:
\newtoks\everysafeexpanded
\long\def\safeexpanded#1%
{\begingroup
\the\everysafeexpanded\long\xdef\@@expanded{\noexpand#1}%
\endgroup
\@@expanded}
A more contexy alternative -)
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
information: http://www.pragma-ade.com/roadmap.pdf
documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re: Expansion problem in natural table
2003-02-09 18:39 ` Simon Pepping
@ 2003-02-09 20:43 ` Hans Hagen
0 siblings, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2003-02-09 20:43 UTC (permalink / raw)
At 07:39 PM 2/9/2003 +0100, you wrote:
>Even this goes wrong:
>
>\edef\mychar{Ä}\mychar
\edef'ing is always a bit tricky, especially for some low level tex
for a solution, see previous post (or in addition to that:)
\def\safeedef#1#2%
{\begingroup
\the\everysafeexpanded\long\xdef\@@expanded{\noexpand#2}%
\endgroup
\let#1\@@expanded}
\def\safexdef#1#2%
{\begingroup
\the\everysafeexpanded\long\xdef\@@expanded{\noexpand#2}%
\endgroup
\global\let#1\@@expanded}
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
information: http://www.pragma-ade.com/roadmap.pdf
documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Expansion problem in natural table
2003-02-09 20:26 ` Hans Hagen
@ 2003-02-18 20:11 ` Simon Pepping
0 siblings, 0 replies; 5+ messages in thread
From: Simon Pepping @ 2003-02-18 20:11 UTC (permalink / raw)
On Sun, Feb 09, 2003 at 09:26:27PM +0100, Hans Hagen wrote:
> At 09:52 PM 2/8/2003 +0100, Simon Pepping wrote:
>
> ah, the umlauts ...
>
> even if it would work out ok, it looks to ugly, so how about:
>
> \def\somethingsimon{blabla}
>
> \bTABLE
> \bTR\safeexpanded{\bTD\Aumlaut}\eTD\eTR
> \bTR\safeexpanded{\bTD\noexpand\somethingsimon\Aumlaut}\eTD\eTR
> \eTABLE
>
> with in enco-ini:
>
> \appendtoks
> \keepencodedtokens
> \to \everysafeexpanded
>
> and in syst-gen:
>
> \newtoks\everysafeexpanded
>
> \long\def\safeexpanded#1%
> {\begingroup
> \the\everysafeexpanded\long\xdef\@@expanded{\noexpand#1}%
> \endgroup
> \@@expanded}
>
> A more contexy alternative -)
This works fine, provided \keepencodedtokens exists, which is only in
more recent context versions.
Regards, Simon
--
Simon Pepping
email: spepping@scaprea.hobby.nl
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-02-18 20:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-08 20:52 Expansion problem in natural table Simon Pepping
2003-02-09 18:39 ` Simon Pepping
2003-02-09 20:43 ` Hans Hagen
2003-02-09 20:26 ` Hans Hagen
2003-02-18 20:11 ` Simon Pepping
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).