ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henning Hraban Ramm <hraban@fiee.net>
Subject: Re: programming: doifdefined & friends
Date: Thu, 5 Oct 2006 02:56:43 +0200	[thread overview]
Message-ID: <2BF20575-AAB1-4E75-8F03-31DB6E89F663@fiee.net> (raw)
In-Reply-To: <A6B13FFF-B2C2-4BD5-9996-025BA13344A8@fiee.net>

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)

  reply	other threads:[~2006-10-05  0:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-05  0:42 Henning Hraban Ramm
2006-10-05  0:56 ` Henning Hraban Ramm [this message]
2006-10-05  1:15   ` Henning Hraban Ramm
2006-10-05  4:04 ` Aditya Mahajan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2BF20575-AAB1-4E75-8F03-31DB6E89F663@fiee.net \
    --to=hraban@fiee.net \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).