Defining new commands from Lua
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
Latex provides several commands relating to creating new commands such as newcommand
. If I want to define new commands from a Lua script one way is use tex.print
to write this directly into the document.
It this really the best way though? The whole point of LuaTeX is to avoid programming with Tex macros, yet this approaches involves doing exactly that. How can I directly access, edit and create commands directly from Lua?
script.lua
tex.print("\newcommand\helloHello world")
document.tex
documentclassarticle
begindocument
directlua require("script")
hello
enddocument
luatex
add a comment |Â
up vote
3
down vote
favorite
Latex provides several commands relating to creating new commands such as newcommand
. If I want to define new commands from a Lua script one way is use tex.print
to write this directly into the document.
It this really the best way though? The whole point of LuaTeX is to avoid programming with Tex macros, yet this approaches involves doing exactly that. How can I directly access, edit and create commands directly from Lua?
script.lua
tex.print("\newcommand\helloHello world")
document.tex
documentclassarticle
begindocument
directlua require("script")
hello
enddocument
luatex
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
Latex provides several commands relating to creating new commands such as newcommand
. If I want to define new commands from a Lua script one way is use tex.print
to write this directly into the document.
It this really the best way though? The whole point of LuaTeX is to avoid programming with Tex macros, yet this approaches involves doing exactly that. How can I directly access, edit and create commands directly from Lua?
script.lua
tex.print("\newcommand\helloHello world")
document.tex
documentclassarticle
begindocument
directlua require("script")
hello
enddocument
luatex
Latex provides several commands relating to creating new commands such as newcommand
. If I want to define new commands from a Lua script one way is use tex.print
to write this directly into the document.
It this really the best way though? The whole point of LuaTeX is to avoid programming with Tex macros, yet this approaches involves doing exactly that. How can I directly access, edit and create commands directly from Lua?
script.lua
tex.print("\newcommand\helloHello world")
document.tex
documentclassarticle
begindocument
directlua require("script")
hello
enddocument
luatex
luatex
edited 36 mins ago
asked 59 mins ago
raiksey
214
214
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
5
down vote
accepted
documentclassarticle
begindocument
directluatoken.set_macro("hello","goodbye")
hello
enddocument
Accepted, thank you. Do you know of any good packages/classes on CTAN I could look at that are implemented in Lua and do this sort of thing? (To try to understand the common patterns a bit better. I'm looking at building a document class)
â raiksey
30 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
documentclassarticle
begindocument
directluatoken.set_macro("hello","goodbye")
hello
enddocument
Accepted, thank you. Do you know of any good packages/classes on CTAN I could look at that are implemented in Lua and do this sort of thing? (To try to understand the common patterns a bit better. I'm looking at building a document class)
â raiksey
30 mins ago
add a comment |Â
up vote
5
down vote
accepted
documentclassarticle
begindocument
directluatoken.set_macro("hello","goodbye")
hello
enddocument
Accepted, thank you. Do you know of any good packages/classes on CTAN I could look at that are implemented in Lua and do this sort of thing? (To try to understand the common patterns a bit better. I'm looking at building a document class)
â raiksey
30 mins ago
add a comment |Â
up vote
5
down vote
accepted
up vote
5
down vote
accepted
documentclassarticle
begindocument
directluatoken.set_macro("hello","goodbye")
hello
enddocument
documentclassarticle
begindocument
directluatoken.set_macro("hello","goodbye")
hello
enddocument
answered 55 mins ago
David Carlisle
467k3810941817
467k3810941817
Accepted, thank you. Do you know of any good packages/classes on CTAN I could look at that are implemented in Lua and do this sort of thing? (To try to understand the common patterns a bit better. I'm looking at building a document class)
â raiksey
30 mins ago
add a comment |Â
Accepted, thank you. Do you know of any good packages/classes on CTAN I could look at that are implemented in Lua and do this sort of thing? (To try to understand the common patterns a bit better. I'm looking at building a document class)
â raiksey
30 mins ago
Accepted, thank you. Do you know of any good packages/classes on CTAN I could look at that are implemented in Lua and do this sort of thing? (To try to understand the common patterns a bit better. I'm looking at building a document class)
â raiksey
30 mins ago
Accepted, thank you. Do you know of any good packages/classes on CTAN I could look at that are implemented in Lua and do this sort of thing? (To try to understand the common patterns a bit better. I'm looking at building a document class)
â raiksey
30 mins ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f450891%2fdefining-new-commands-from-lua%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password