Using lua with the command line for "macros"
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
On Mon, Oct 14, 2013 at 3:01 AM, Kumar Appaiah
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
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
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
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 -----------------------------------------------------------------
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
participants (3)
-
Hans Hagen
-
Kumar Appaiah
-
luigi scarso