5

The LuaTeX documentation mentions that several variables are accessible by setting a table called texconfig. In particular I want to reduce the output a bit by setting trace_file_names to false. Others have asked for a similar solution but it seems not so easy with other TeX engines. Now LuaTeX offers that choice but I am not sure where and how to set that parameter. The documentation only mentions the table but gives no further hints.

So how can I set or modify the values in the texconfig table in LuaTeX (running under MiKTeX 2.9)?

I tried with the following example but this does not help, maybe this has to be set earlier in the process.

\documentclass{article}

\usepackage{filecontents}

\begin{filecontents*}{word.tex}
hello
\end{filecontents*}

\begin{document}
\directlua{print(texconfig)}
% prints: "table: 02900A90"

\directlua{print(texconfig["trace_file_names"])}
% prints "nil", so value does not exist in table

\directlua{texconfig["trace_file_names"] = false}

\input{word.tex}
% LuaTeX outputs: "(C:/Users/alexander/test/word.tex)"
\end{document}
2

The boolean variable texconfig.trace_file_names is only in effect when you disable the kpathsea library with texconfig.kpse_init = false.

You can disable the kpathsea library in the ini file called with luatex --lua <inifile> .... See below.

A non working example (it is hard to replace kpathsea in a few lines of code) is like this. Call with lualatex --ini --lua foo.lua test.tex:

test.tex:

Hello
\end

foo.lua:

texconfig.kpse_init = false
texconfig.trace_file_names = false


function kpse.find_file(filename,what)
    return filename
end

local function reader( asked_name )
  local tab = { }
  tab.file = io.open(asked_name)
  tab.reader = function (t)
                  local f = t.file
                  return f:read('*l')
               end
  tab.close = function (t)
                  t.file:close()
              end
  return tab
end


local function find_xxx_file( asked_name )
  return asked_name
end
local function return_asked_name( asked_name )
  return asked_name
end
local function read_font_file( name )
  local f = io.open(name)
  local buf = f:read("*all")
  f:close()
  return true,buf,buf:len()
end
local function find_read_file( id_number,asked_name )
  local file = kpse.find_file(asked_name)
  return file
end
function find_write_file(id_number,asked_name)
  return asked_name
end
local function read_xxx_file(name)
  return nil,nil,0
end

callback.register('open_read_file',reader)

callback.register('find_opentype_file',return_asked_name)
callback.register('find_type1_file',   return_asked_name)
callback.register('find_output_file',  return_asked_name)

callback.register('read_opentype_file',read_font_file)
callback.register('read_type1_file',   read_font_file)

callback.register('find_write_file',find_write_file)

callback.register('find_read_file',find_read_file)

for _,t in ipairs({"find_font_file",'find_vf_file','find_format_file','find_map_file','find_enc_file','find_sfd_file','find_pk_file','find_data_file','find_image_file','find_truetype_file'}) do
  callback.register(t,find_xxx_file)
end
for _,t in ipairs({'read_vf_file','read_sdf_file','read_pk_file','read_data_file','read_font_file','read_map_file'}) do
  callback.register(t, read_xxx_file )
end

It could work if all files are in the local directory, but I haven't tried.

  • Thank you for this insight. I hoped that one could just disable the output without further side-effects. Do you know what the purpose of the flag trace_file_names is if using it means replacing a whole library? – Alexander Jul 11 '13 at 13:10
  • I have no idea about the reasoning. But thanks to your question I have now finally reduced the output of my software (tex.stackexchange.com/questions/120271/alternatives-to-latex/…) :) – topskip Jul 11 '13 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.