I would like to define some variables in a tex document. For example, I write in .tex something similar as: Our tool succeeds to validate x samples out of all the y samples, thus its success ratio is z. Where z is defined as x/y, and x (resp. y) is instanced somewhere else by a number, eg., 30 (resp. 47). As a result, after the compilation the text turns out to be Our tool succeeds to validate 30 samples out of all the 47 samples, thus its success ratio is 63.8%.
The advantage of this, is that I just need to change the value of some variables, to change all the numbers in the text... The difficulty is that z holds a percentage number.
Does anyone know how to achieve this?



\directlua{tex.print(string.format("%.2f",2*(1234.56+9786.45)))}, but the compilation raised one errorUndefined control sequence... – SoftTimur May 06 '14 at 15:48\directluais a luatex primitive so you would be restricted to lualatex in that case. – David Carlisle May 06 '14 at 16:31