ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: Hans Hagen <pragma@wxs.nl>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Definition of lualetterbackslash
Date: Mon, 22 Aug 2011 04:49:01 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LNX.2.02.1108220441220.27470@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <4E520E0D.9070300@wxs.nl>

On Mon, 22 Aug 2011, Hans Hagen wrote:

> On 22-8-2011 09:15, Aditya Mahajan wrote:
>> Hi
>> 
>> Consider the following example:
>> 
>> \startluacode
>> print("lualetterbackslash:", [=[\\include]=])
>> \stopluacode
>> 
>> \def\lualetterbackslash{\letterbackslash}
>> \startluacode
>> print("letterbackslash:", [=[\\include]=])
>> \stopluacode
>> 
>> \bye
>> 
>> gives
>> 
>> lualetterbackslash: \\include
>> letterbackslash: \include
>> 
>> I find the second alternative better. Why is \lualetterbackslash defined
>> differently from \letterbackslash?
>
> to avoid problems with \n, \t and such

Ah, I see.

> btw, best use context.include then as it provides you better tracing

Well, \include is a lilypond command that must be written to an external 
file, something like this:

\startluacode
lilypond_preamble = [[
\\include "lilypond-book-preamble.py"
other settings that will be substituted at run-time
]]

buffers.assign("preamble", lilypond_preamble)
\stopluacode

\startbuffer[content]
content of lilypond file
\stopbuffer

\savebuffer[preamble,content][temp-file]

\bye

I'll probably just use

\appendtoks
   \def\/{\letterbackslash}
\to\everyluacode

and then \/include. Other than using the magic single letter commands, I 
don't see an easy way of getting a \ in a lua string inside luacode :(

- \noexpand\include fails unless I define \include
- \letterbackslash include gives "\ include"
- \letterbackslash{}include gives "\{}include"

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2011-08-22  8:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22  7:15 Aditya Mahajan
2011-08-22  8:06 ` Hans Hagen
2011-08-22  8:49   ` Aditya Mahajan [this message]
2011-08-22  9:13     ` Hans Hagen

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=alpine.LNX.2.02.1108220441220.27470@ybpnyubfg.ybpnyqbznva \
    --to=adityam@umich.edu \
    --cc=ntg-context@ntg.nl \
    --cc=pragma@wxs.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).