Tag Info

New answers tagged

4

Just following up on the great comments by @Aditya and @phg, I did the following: I created a test suite using the really cool lunatest framework. It is trivial to set up because one only needs to require('lunatest'), and there is a helpful set of examples in test.lua. Once I have created my own my_tests.lua I run it with: context my_tests.lua --purgeall ...


2

This is a snippet programmed in Lua run from LuaLaTeX, it can be run in ConTeXt easily after minor modification of the TeX structure. We get a number of elements in the table, then we randomly pick up one item and decide if it is a table type. If it is, we call that function again one level deeper, otherwise we print the selected item. In this example we ...


2

From the mailing list (courtesy of Wolfgang Schuster): % Superscript citation cross-references. \setupcite[num][ left=\raisebox{1ex}\hbox\bgroup\tfxx, right=\egroup, ]


4

May be you need this. My example included nested random printing, if the first random number is equal to 2. \getrandomnumber \randomnumber {1} {10} \ifcase\randomnumber \or print a \or \getrandomnumber \randomnumber {1} {2} \ifcase\randomnumber \or print ba \or print bb \fi \or print c \or print d \or ...


9

There are many ways to set the texts for the random value, the first is the low level \ifacse macro. \define\RandomText {\getrandomnumber\randomnumber{1}{4}% \ifcase\randomnumber % 0 \or First item.% 1 \or Second item.% 2 \or Third item.% 3 \else Another item.% 4+ \fi} \starttext \dorecurse{3}{\RandomText\par} ...



Top 50 recent answers are included