* Using lua with the command line for "macros"
@ 2013-10-14 1:01 Kumar Appaiah
2013-10-14 1:17 ` luigi scarso
0 siblings, 1 reply; 6+ messages in thread
From: Kumar Appaiah @ 2013-10-14 1:01 UTC (permalink / raw)
To: ntg-context
Hi.
At the outset, I understand that this is a slight abuse of LuaTeX and
this can be done with plain TeX. Nevertheless, I'd like to see if a
solution exists for this approach.
I'm trying to use Lua with ConTeXt as a macro preprocessor. To be more
clear, I have files A.lua, B.lua which define some variables:
A.lua:
var1 = "something for a"
var2 = "something else for a"
B.lua:
var1 = "something for b"
var2 = "something else for b"
And, in my ConTeXt file, I would write:
…
I will get \directlua{tex.print(var1) and \directlua{tex.print(var2)}.
…
Now, with lualatex, I use the --lua command line option to pass the
initial lua file name. However, for context, I've not found a way to
do this. Could someone please advise me?
Thanks.
Kumar
--
Kumar Appaiah
___________________________________________________________________________________
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] 6+ messages in thread
* Re: Using lua with the command line for "macros"
2013-10-14 1:01 Using lua with the command line for "macros" Kumar Appaiah
@ 2013-10-14 1:17 ` luigi scarso
2013-10-14 1:31 ` Kumar Appaiah
0 siblings, 1 reply; 6+ messages in thread
From: luigi scarso @ 2013-10-14 1:17 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 981 bytes --]
On Mon, Oct 14, 2013 at 3:01 AM, Kumar Appaiah <a.kumar@alumni.iitm.ac.in>wrote:
> Hi.
>
> At the outset, I understand that this is a slight abuse of LuaTeX and
> this can be done with plain TeX. Nevertheless, I'd like to see if a
> solution exists for this approach.
>
> I'm trying to use Lua with ConTeXt as a macro preprocessor. To be more
> clear, I have files A.lua, B.lua which define some variables:
>
> A.lua:
> var1 = "something for a"
> var2 = "something else for a"
>
> B.lua:
> var1 = "something for b"
> var2 = "something else for b"
>
> And, in my ConTeXt file, I would write:
> …
> I will get \directlua{tex.print(var1) and \directlua{tex.print(var2)}.
> …
>
> Now, with lualatex, I use the --lua command line option to pass the
> initial lua file name. However, for context, I've not found a way to
> do this. Could someone please advise me?
>
Have you seen
http://www.pragma-ade.com/general/manuals/cld-mkiv.pdf
?
--
luigi
[-- Attachment #1.2: Type: text/html, Size: 1508 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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] 6+ messages in thread
* Re: Using lua with the command line for "macros"
2013-10-14 1:17 ` luigi scarso
@ 2013-10-14 1:31 ` Kumar Appaiah
2013-10-14 2:48 ` Kumar Appaiah
0 siblings, 1 reply; 6+ messages in thread
From: Kumar Appaiah @ 2013-10-14 1:31 UTC (permalink / raw)
To: ntg-context
On Mon, Oct 14, 2013 at 03:17:28AM +0200, luigi scarso wrote:
> On Mon, Oct 14, 2013 at 3:01 AM, Kumar Appaiah
> <[1]a.kumar@alumni.iitm.ac.in> wrote:
>
> Hi.
>
> At the outset, I understand that this is a slight abuse of LuaTeX and
> this can be done with plain TeX. Nevertheless, I'd like to see if a
> solution exists for this approach.
[snip]
>
> Have you seen
> [2]http://www.pragma-ade.com/general/manuals/cld-mkiv.pdf
No, I haven't seen it. I'll have a close look at it. Thanks for the
pointer.
Kumar
--
Kumar Appaiah
___________________________________________________________________________________
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] 6+ messages in thread
* Re: Using lua with the command line for "macros"
2013-10-14 1:31 ` Kumar Appaiah
@ 2013-10-14 2:48 ` Kumar Appaiah
2013-10-14 7:47 ` Hans Hagen
0 siblings, 1 reply; 6+ messages in thread
From: Kumar Appaiah @ 2013-10-14 2:48 UTC (permalink / raw)
To: ntg-context
On Sun, Oct 13, 2013 at 09:31:11PM -0400, Kumar Appaiah wrote:
> On Mon, Oct 14, 2013 at 03:17:28AM +0200, luigi scarso wrote:
> > Have you seen
> > [2]http://www.pragma-ade.com/general/manuals/cld-mkiv.pdf
>
> No, I haven't seen it. I'll have a close look at it. Thanks for the
> pointer.
Well, upon reading the document you suggested, I just realised that I
could work around my issue by creating A.tex and B.tex as follows:
A.tex:
\startluacode
-- define A's variables
\stopluacode
\input generic
And a similar b.tex. This is more flexible in terms of my
implementation constraints as well.
Thanks.
Kumar
--
Kumar Appaiah
___________________________________________________________________________________
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] 6+ messages in thread
* Re: Using lua with the command line for "macros"
2013-10-14 2:48 ` Kumar Appaiah
@ 2013-10-14 7:47 ` Hans Hagen
2013-10-14 11:45 ` Kumar Appaiah
0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2013-10-14 7:47 UTC (permalink / raw)
To: ntg-context
On 10/14/2013 4:48 AM, Kumar Appaiah wrote:
> On Sun, Oct 13, 2013 at 09:31:11PM -0400, Kumar Appaiah wrote:
>> On Mon, Oct 14, 2013 at 03:17:28AM +0200, luigi scarso wrote:
>>> Have you seen
>>> [2]http://www.pragma-ade.com/general/manuals/cld-mkiv.pdf
>>
>> No, I haven't seen it. I'll have a close look at it. Thanks for the
>> pointer.
>
> Well, upon reading the document you suggested, I just realised that I
> could work around my issue by creating A.tex and B.tex as follows:
>
> A.tex:
> \startluacode
> -- define A's variables
> \stopluacode
> \input generic
>
> And a similar b.tex. This is more flexible in terms of my
> implementation constraints as well.
if you make a file "whatever.cld" like:
local name = "ward.tex"
context.starttext()
context.title(name)
context.blank()
context.input(name)
context.stoptext()
you can directly runt it with the "context" command.
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 6+ messages in thread
* Re: Using lua with the command line for "macros"
2013-10-14 7:47 ` Hans Hagen
@ 2013-10-14 11:45 ` Kumar Appaiah
0 siblings, 0 replies; 6+ messages in thread
From: Kumar Appaiah @ 2013-10-14 11:45 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Mon, Oct 14, 2013 at 09:47:49AM +0200, Hans Hagen wrote:
> >Well, upon reading the document you suggested, I just realised that I
> >could work around my issue by creating A.tex and B.tex as follows:
> >
> >A.tex:
> >\startluacode
> > -- define A's variables
> >\stopluacode
> >\input generic
> >
> >And a similar b.tex. This is more flexible in terms of my
> >implementation constraints as well.
>
> if you make a file "whatever.cld" like:
>
> local name = "ward.tex"
>
> context.starttext()
> context.title(name)
> context.blank()
> context.input(name)
> context.stoptext()
>
> you can directly runt it with the "context" command.
Thanks Hans. This is a cleaner solution; I'll adopt it in the next
document I am writing today.
Kumar
--
Kumar Appaiah
___________________________________________________________________________________
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] 6+ messages in thread
end of thread, other threads:[~2013-10-14 11:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-14 1:01 Using lua with the command line for "macros" Kumar Appaiah
2013-10-14 1:17 ` luigi scarso
2013-10-14 1:31 ` Kumar Appaiah
2013-10-14 2:48 ` Kumar Appaiah
2013-10-14 7:47 ` Hans Hagen
2013-10-14 11:45 ` Kumar Appaiah
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).