[cstex] \csname a expandovani...

Zdenek Wagner zdenek.wagner at gmail.com
Sun Jun 26 11:50:51 CEST 2011


Dne 26. června 2011 10:29 Petr Tomasek <tomasek at etf.cuni.cz> napsal(a):
> On Sun, Jun 26, 2011 at 10:20:00AM +0200, Zdenek Wagner wrote:
>> Dne 26. června 2011 7:59 Petr Tomasek <tomasek at etf.cuni.cz> napsal(a):
>> >
>> > Zdravim!
>> >
>> > mam takovouto konstrukci:
>> >
>> > \fnstyls=0\loop%
>> > \edef\fnstyleid{\csname fontstyleid:\the\fnstyls \endcsname}%
>> > \expandafter\def\csname fontstyleset:\fnstyleid \endcsname{}%
>> > \advance \fnstyls by 1 \ifnum \fnstyls<\fncountstyles\repeat
>> >
>> > Idea je takova, ze v makru pojmenovanem "fontstyleid:0", "fonstyleid:1",
>> > "fontstyleid:2"... mam identifkator a potreboval bych nastavit
>> > makro "fontstyleset:<identifikator>" na {} (tj. na prazdy obsah).
>> >
>> U me se to expanduje, ale havaruje to na tom, ze \fontstyleid:0 neni
>> definovano. S jeho expanzi si tedy TeX neumi poradit a ohlasi, ze
>> chybi \endcsname.
>
> Ano, to je pochopitelne, neni to cely kod, ale jen jeho vysek.
>
> Dobra tedy, v priloze posilam cely soubor, ale je to trosku neprehledne.
> Hledejte "TODO NEFUNGUJE".
>
To je zvlastni. Zde je kus trasovani:

\loop #1\repeat ->\def \body {#1}\iterate
#1<-\edef \fnstyleid {\csname fontstyleid:\the \fnstyls \endcsname }\expandafte
r \def \csname fontstyleset:\fnstyleid \endcsname {}\advance \fnstyls by 1 \ifn
um \fnstyls <\fncountstyles
{\def}

\iterate ->\body \let \next \iterate \else \let \next \relax \fi \next

\body ->\edef \fnstyleid {\csname fontstyleid:\the \fnstyls \endcsname }\expand
after \def \csname fontstyleset:\fnstyleid \endcsname {}\advance \fnstyls by 1
\ifnum \fnstyls <\fncountstyles
{\edef}
{\csname}
{\the}

\fontstyleid:0 ->caps
{\expandafter}
{\csname}

\fnstyleid ->caps
{\def}
{\advance}
{\ifnum}
{true}
{\let}
{\else}

\next ->\body \let \next \iterate \else \let \next \relax \fi \next

\body ->\edef \fnstyleid {\csname fontstyleid:\the \fnstyls \endcsname }\expand
after \def \csname fontstyleset:\fnstyleid \endcsname {}\advance \fnstyls by 1
\ifnum \fnstyls <\fncountstyles
{\edef}
{\csname}
{\the}

\fontstyleid:1 ->sups
{\expandafter}
{\csname}

\fnstyleid ->sups
{\def}
{\advance}
{\ifnum}
{true}
{\let}
{\else}

Z toho se zda, ze vse se expanduje spravne. V mych pocitacich se
nenajde Linux Libertine, ale to je jiz jiny problem. Systemove fonty
umim pouzit jen v XeLaTeXu pomoci fontspec.

> Diky,
> P.T.
>
> --
> Petr Tomasek <http://www.etf.cuni.cz/~tomasek>
> Jabber: butrus at jabbim.cz
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> EA 355:001  DU DU DU DU
> EA 355:002  TU TU TU TU
> EA 355:003  NU NU NU NU NU NU NU
> EA 355:004  NA NA NA NA NA
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
> _______________________________________________
> csTeX mailing list
> csTeX at cs.felk.cvut.cz
> http://lists.felk.cvut.cz/mailman/listinfo/cstex
>
>



-- 
Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz




More information about the csTeX mailing list