[cstex] \csname a expandovani...

Petr Tomasek tomasek at etf.cuni.cz
Sun Jun 26 10:47:09 CEST 2011


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.

Problem je az v tom druhem, tj. tam kde se snazim nadefinovat makro
"fontstyleset:<styleid>".

> > Ovsem to nejak nefunguje, tipuji, ze v konstrukci
> > "\csname fontstyleset:\fnstyleid \endcsname" se \fnstyleid neexpanduje
> > dostatecne brzo. Poradite, prosim, co s tim? Zkousel jsem jeste
> > pridat \expandafter, ale taky se nedarilo.

Tak uz se mi to podarilo vyresit a sice tak, ze jsem z
"\expandafter\def\csname fontstyleset:\fnstyleid \endcsname{}"
udelal jako samostatne makro, ve kterem se parametr "#1" zavcas
dokaze expandovat. Nicmene, pokud by nejaky z mistnich magu
vedel o lepsim/jednodussim reseni, rad se necham poucit ;-)

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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





More information about the csTeX mailing list