Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \documentclass{article}
- \usepackage{luacode}
- \usepackage{amsmath}
- %------------------------
- \begin{luacode}
- local x = 0
- function add()
- x = x +1
- tex.print(x)
- end
- function sub()
- x = x - 1
- tex.print(x)
- end
- function reset()
- x = 0
- end
- \end{luacode}
- \newcommand\add[0]{ \directlua{add()}}%
- \newcommand\sub[0]{ \directlua{sub()}}%
- \newcommand\reset[0]{ \directlua{reset()}}%
- %-------------------
- \begin{document}
- \reset
- \add
- \add
- \sub
- \add
- \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement