Debian Codegraph @

texmf-dist/doc/latex/datatool/datatool-user-examples/datatool-user-example004.tex

raw
1 % This file is embedded in datatool-user.pdf version 3.4.3 2025-12-04
2 % Example 4 Performing Calculations with LuaLaTeX
3 % Label: "ex:directlua"
4 % arara: lualatex
5 % arara: pdfcrop
6 \documentclass[12pt]{article}
7 \pagestyle{empty}
8 \newcommand{\myfunc}[3]{%
9 \directlua{tex.print(#1+0.5*math.sqrt(#2)/(#3))}%
10 }
11 \newcommand{\numA}{1023.5}
12 \newcommand{\numB}{54.75000}
13 \newcommand{\numC}{-20648.68}
14 \begin{document}
15 $ \numA+\frac{\sqrt{\numB}}{2\times\numC} = \myfunc{\numA}{\numB}{\numC} $
16 \end{document}