[NTG-context] programming: doifdefined & friends
Henning Hraban Ramm
hraban at fiee.net
Thu Oct 5 02:56:43 CEST 2006
Am 2006-10-05 um 02:42 schrieb Henning Hraban Ramm:
> -----
> \starttext
>
> \def\myvar{JAJAJA}
>
> \input tufte
> \doifdefined{\myvar}{\par bla \myvar blub\par}
> \input tufte
>
> \stoptext
> -----
Sorry for bothering you, I found it myself: I must leave out the
backslash in the condition.
But so I'm still stuck with this snippet from the LilyPond module,
where Christopher used a lot of catcode trickery:
-----
/doifdefined{lily!fontname}/bgroup
\layout {/string^^J
\override Staff.TimeSignature #'font-name = #/lily!fontname/string^^J
\override Staff.MultiMeasureRestText #'font-name = #/lily!fontname/
string^^J
\override Score.LyricText #'font-name = #/lily!fontname/string^^J
\override ChordNames.ChordName #'font-name = #/lily!fontname/string^^J
}/string^^J
/egroup
-----
gives:
! Undefined control sequence.
\lily!prefix ...ure #'font-name = #\lily!fontname
\string
\override Staff....
<argument> ...nd-\the \lily!figures ]\lily!prefix
\lily!hash (set-
global-sta...
\expanded ...\long \xdef \@@expanded {\noexpand #1
}\@@expanded
\dodostartlilypond ...e \lily!fragmentsuffix \fi }
\endbuffer \par
\def \LP {...
l.43 \stoplilypond
-----
I'm trying to introduce a "fontname" setting in \setuplilypond that
should generate the \layout{...} block in the LilyPond file if used
and nothing if not.
I know how to do that with numbers and yes/no settings, because there
are some samples in the module, but unfortunately no string settings
- and I don't understand the samples that I found in the ConTeXt
sources either.
Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net/texnique/
http://contextgarden.net
http://www.cacert.org (I'm an assurer)
More information about the ntg-context
mailing list