On Sat, 25 Jun 2016, Wolfgang Schuster wrote: >> Aditya Mahajan >> 24. Juni 2016 um 21:19 >> Hi, >> >> This is based on a question on tex.sx: >> http://tex.stackexchange.com/q/316504/323 >> >> In file-job.lua, we have: >> >> local processors = utilities.storage.allocate { >> ... >> [v_product] = { >> [v_text] = { "many", processfilemany }, >> [v_project] = { "once", processfileonce }, >> [v_environment] = { "once", processfileonce }, >> [v_product] = { "many", processfilemany }, >> [v_component] = { "many", processfilemany }, >> }, >> [v_component] = { >> [v_text] = { "many", processfilemany }, >> [v_project] = { "once", processfileonce }, >> [v_environment] = { "once", processfileonce }, >> [v_product] = { "none", processfilenone }, >> [v_component] = { "many", processfilemany }, >> } >> } >> >> Then, why is the product file processed multiple times? > The rules for a component files are applied *after* \startcomponent > which isn’t the case for the example where in the first iteration > the "text" rules are applied and in the following iteration the rules > for a product file. > > Moving \product … after \startcomponent prevents the loop but > the environment won’t be loaded anymore because the product > file isn’t loaded anymore. So, what's the recommended alternative? One could move the \environment to the components, but that can lead to a lot of repetitions (if there are many environments). Aditya