ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Inserting non-standard TeX macro parameters to Lua variables
@ 2010-08-19 22:49 Jaroslav Hajtmar
  2010-08-19 23:12 ` Aditya Mahajan
  0 siblings, 1 reply; 3+ messages in thread
From: Jaroslav Hajtmar @ 2010-08-19 22:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello all,

I'm looking for a way to insert any character (CSV separator) into a 
variable. Manually insert a double (or single) quote is not a problem, 
but how to use the universal way to not have to change the macro 
definitions?
Is there another possibility to insert a macro parameter into a Lua 
variable than the use double or single quote?

Any "universal" alternative is unfortunately impossible:
For example: \def\setseparatorC#1{\directlua{Sep=#1 }}  ???

Thanx Jaroslav

Here is my minimal example:


\def\setseparatorA#1{\directlua{Sep="#1"}}
\def\setseparatorB#1{\directlua{Sep='#1'}}

\starttext
\setseparatorA{'} % OK

\directlua{tex.sprint(Sep)}

\setseparatorB{"} % OK

\directlua{tex.sprint(Sep)}

% BUT
\setseparatorA{"} % Error
\setseparatorB{'} % Error

\stoptext
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Inserting non-standard TeX macro parameters to Lua variables
  2010-08-19 22:49 Inserting non-standard TeX macro parameters to Lua variables Jaroslav Hajtmar
@ 2010-08-19 23:12 ` Aditya Mahajan
  2010-08-19 23:25   ` Jaroslav Hajtmar
  0 siblings, 1 reply; 3+ messages in thread
From: Aditya Mahajan @ 2010-08-19 23:12 UTC (permalink / raw)
  To: hajtmar, mailing list for ConTeXt users

On Fri, 20 Aug 2010, Jaroslav Hajtmar wrote:

> Hello all,
>
> I'm looking for a way to insert any character (CSV separator) into a 
> variable. Manually insert a double (or single) quote is not a problem, but 
> how to use the universal way to not have to change the macro definitions?
> Is there another possibility to insert a macro parameter into a Lua variable 
> than the use double or single quote?
>
> Any "universal" alternative is unfortunately impossible:
> For example: \def\setseparatorC#1{\directlua{Sep=#1 }}  ???
>
> Thanx Jaroslav
>
> Here is my minimal example:
>
>
> \def\setseparatorA#1{\directlua{Sep="#1"}}
> \def\setseparatorB#1{\directlua{Sep='#1'}}

Untested. Try

\unprotect
\def\setseparator#1{\directlua{sep=\!!bs#1\!!es}}
\protect

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Inserting non-standard TeX macro parameters to Lua variables
  2010-08-19 23:12 ` Aditya Mahajan
@ 2010-08-19 23:25   ` Jaroslav Hajtmar
  0 siblings, 0 replies; 3+ messages in thread
From: Jaroslav Hajtmar @ 2010-08-19 23:25 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: mailing list for ConTeXt users

Hello Aditya,
I had no hope of solving the problem, but it works! Unbelievable!
Thanks very much for fixing the problem and the quickness too.

Jaroslav


Dne 20.8.2010 1:12, Aditya Mahajan napsal(a):
> On Fri, 20 Aug 2010, Jaroslav Hajtmar wrote:
>
>> Hello all,
>>
>> I'm looking for a way to insert any character (CSV separator) into a 
>> variable. Manually insert a double (or single) quote is not a 
>> problem, but how to use the universal way to not have to change the 
>> macro definitions?
>> Is there another possibility to insert a macro parameter into a Lua 
>> variable than the use double or single quote?
>>
>> Any "universal" alternative is unfortunately impossible:
>> For example: \def\setseparatorC#1{\directlua{Sep=#1 }}  ???
>>
>> Thanx Jaroslav
>>
>> Here is my minimal example:
>>
>>
>> \def\setseparatorA#1{\directlua{Sep="#1"}}
>> \def\setseparatorB#1{\directlua{Sep='#1'}}
>
> Untested. Try
>
> \unprotect
> \def\setseparator#1{\directlua{sep=\!!bs#1\!!es}}
> \protect
>
> 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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-19 23:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-19 22:49 Inserting non-standard TeX macro parameters to Lua variables Jaroslav Hajtmar
2010-08-19 23:12 ` Aditya Mahajan
2010-08-19 23:25   ` Jaroslav Hajtmar

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).