On 13-10-2012 03:34, Andre Caldas wrote:
Hello, list!
A while ago, I raised a question about how to, in a tex, specify a file with a path relative to the currently being processed file. http://www.ntg.nl/pipermail/ntg-context/2012/069132.html http://www.ntg.nl/pipermail/ntg-context/2012/068902.html
Even though the issue did not get much attention, I do believe it is the right thing to do. I wrote a module to implement a macro I called "\pathrelativetome". My code is still a lot ugly. I don't know how to do many things in Lua, LuaTeX and ConTeXt. It can be found here: https://bitbucket.org/andrecaldas/math-video-classes/src/bade74046a6b/lib
It would be REALLY NICE if the functionality of "pathrelativetome" was provided by ConTeXt.
in file-job.lua add around the function 'process': local function toppath() local pathname = dirname(inputstack[#inputstack] or "") if pathname == "" then return "." else return pathname end end resolvers.toppath = topath resolvers.prefixes.toppath = function(str) local fullname = cleanpath(joinpath(toppath(),str)) return fullname end local function process(what,name) local depth = #typestack local process -- name = resolvers.resolve(name) -- ..... keep code ... and somewhere at the top: local joinpath = file.join local cleanpath = resolvers.cleanpath Then you can something: \starttext \component toppath:/subpath/somefile.tex \stoptext All given that the top of the inputstack is still ok. If needed I can push/pop some relative code to start/stopcomponent alike code, in which case we will use a different prefix (no clue what name to use) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------