I need to define absolute path of .tex file, and I already learned how to do it:


What I don't know is how to include lfs library to my LuaLaTeX preamble. I used LaTeX for the few years, but I don't have not TeX nor Lua programming experience.

In this answer, I saw the code like this:


  require "lfs"

I did not tried this code yet, but even it enough to run \edef\currfileabsdir{\directlua{tex.sprint(lfs.currentdir())}/} I need some comments about solution.


\documentclass[a4paper, twoside]{ltjsarticle}



    Path          = \currfileabsdir,
    UprightFont   = fonts/HGS_Mincho/HGRMB.ttc,
    BoldFont      = fonts/HGS_Mincho/HGRME.ttc


The lfs library is available out-of-the-box in LuaTeX. As such, you do not need to do anything special: it will 'just work'. A very minimal demo for both plain LuaTeX and LuaLaTeX:

\csname @@end\endcsname
  • Thank you for the answer! Accept and vote-up. – Gurebu Bokofu Mar 29 at 0:28

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.