remove “./” of “currfileabspath” when using lualatex












1















I have a small problem with the package currfile and the command currfileabspath. When compiling the file using (pdf|xe)latex I get the expected result, but if I use lualatex it adds ./ to the absolute path of the file.
I'm using TeXLive 2018 (updated) in Fedora 29, the working directory looks like this:



[pablo@fedora forum] $ pwd
/home/pablo/forum
[pablo@fedora forum] $ ls -lha
total 12K
drwxrwxr-x. 2 pablo pablo 4,0K feb 17 13:11 .
drwx------. 43 pablo pablo 4,0K feb 17 13:10 ..
-rw-rw-r--. 1 pablo pablo 187 feb 17 13:03 test.tex


My MWE (test.tex) is this:



documentclass{article}
usepackage[abspath]{currfile}
setlength{parindent}{0pt}
begin{document}
texttt{jobname.pdf} created from file texttt{currfileabspath}%
end{document}


I use the following line to compile it:



$ pdflatex -recorder test.tex


with which I obtain:



test.pdf created from file /home/pablo/forum/test.tex


which is correct, but if I change it to:



$ lualatex -recorder test.tex


I get



test.pdf created from file /home/pablo/forum/./test.tex


How can I solve this?
regards










share|improve this question




















  • 1





    It is easy to remove the ./ e.g. with a regex from expl3, but imho the best would be a feature request to the author of currfile.

    – Ulrike Fischer
    Feb 17 at 17:01











  • @UlrikeFischer In my mind I think it's a "bug", remove the . / is an option :) , I'll try something using l3regex, thanks.

    – Pablo González L
    Feb 17 at 17:16
















1















I have a small problem with the package currfile and the command currfileabspath. When compiling the file using (pdf|xe)latex I get the expected result, but if I use lualatex it adds ./ to the absolute path of the file.
I'm using TeXLive 2018 (updated) in Fedora 29, the working directory looks like this:



[pablo@fedora forum] $ pwd
/home/pablo/forum
[pablo@fedora forum] $ ls -lha
total 12K
drwxrwxr-x. 2 pablo pablo 4,0K feb 17 13:11 .
drwx------. 43 pablo pablo 4,0K feb 17 13:10 ..
-rw-rw-r--. 1 pablo pablo 187 feb 17 13:03 test.tex


My MWE (test.tex) is this:



documentclass{article}
usepackage[abspath]{currfile}
setlength{parindent}{0pt}
begin{document}
texttt{jobname.pdf} created from file texttt{currfileabspath}%
end{document}


I use the following line to compile it:



$ pdflatex -recorder test.tex


with which I obtain:



test.pdf created from file /home/pablo/forum/test.tex


which is correct, but if I change it to:



$ lualatex -recorder test.tex


I get



test.pdf created from file /home/pablo/forum/./test.tex


How can I solve this?
regards










share|improve this question




















  • 1





    It is easy to remove the ./ e.g. with a regex from expl3, but imho the best would be a feature request to the author of currfile.

    – Ulrike Fischer
    Feb 17 at 17:01











  • @UlrikeFischer In my mind I think it's a "bug", remove the . / is an option :) , I'll try something using l3regex, thanks.

    – Pablo González L
    Feb 17 at 17:16














1












1








1








I have a small problem with the package currfile and the command currfileabspath. When compiling the file using (pdf|xe)latex I get the expected result, but if I use lualatex it adds ./ to the absolute path of the file.
I'm using TeXLive 2018 (updated) in Fedora 29, the working directory looks like this:



[pablo@fedora forum] $ pwd
/home/pablo/forum
[pablo@fedora forum] $ ls -lha
total 12K
drwxrwxr-x. 2 pablo pablo 4,0K feb 17 13:11 .
drwx------. 43 pablo pablo 4,0K feb 17 13:10 ..
-rw-rw-r--. 1 pablo pablo 187 feb 17 13:03 test.tex


My MWE (test.tex) is this:



documentclass{article}
usepackage[abspath]{currfile}
setlength{parindent}{0pt}
begin{document}
texttt{jobname.pdf} created from file texttt{currfileabspath}%
end{document}


I use the following line to compile it:



$ pdflatex -recorder test.tex


with which I obtain:



test.pdf created from file /home/pablo/forum/test.tex


which is correct, but if I change it to:



$ lualatex -recorder test.tex


I get



test.pdf created from file /home/pablo/forum/./test.tex


How can I solve this?
regards










share|improve this question
















I have a small problem with the package currfile and the command currfileabspath. When compiling the file using (pdf|xe)latex I get the expected result, but if I use lualatex it adds ./ to the absolute path of the file.
I'm using TeXLive 2018 (updated) in Fedora 29, the working directory looks like this:



[pablo@fedora forum] $ pwd
/home/pablo/forum
[pablo@fedora forum] $ ls -lha
total 12K
drwxrwxr-x. 2 pablo pablo 4,0K feb 17 13:11 .
drwx------. 43 pablo pablo 4,0K feb 17 13:10 ..
-rw-rw-r--. 1 pablo pablo 187 feb 17 13:03 test.tex


My MWE (test.tex) is this:



documentclass{article}
usepackage[abspath]{currfile}
setlength{parindent}{0pt}
begin{document}
texttt{jobname.pdf} created from file texttt{currfileabspath}%
end{document}


I use the following line to compile it:



$ pdflatex -recorder test.tex


with which I obtain:



test.pdf created from file /home/pablo/forum/test.tex


which is correct, but if I change it to:



$ lualatex -recorder test.tex


I get



test.pdf created from file /home/pablo/forum/./test.tex


How can I solve this?
regards







luatex patching currfile






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 17 at 17:37







Pablo González L

















asked Feb 17 at 16:25









Pablo González LPablo González L

9791720




9791720








  • 1





    It is easy to remove the ./ e.g. with a regex from expl3, but imho the best would be a feature request to the author of currfile.

    – Ulrike Fischer
    Feb 17 at 17:01











  • @UlrikeFischer In my mind I think it's a "bug", remove the . / is an option :) , I'll try something using l3regex, thanks.

    – Pablo González L
    Feb 17 at 17:16














  • 1





    It is easy to remove the ./ e.g. with a regex from expl3, but imho the best would be a feature request to the author of currfile.

    – Ulrike Fischer
    Feb 17 at 17:01











  • @UlrikeFischer In my mind I think it's a "bug", remove the . / is an option :) , I'll try something using l3regex, thanks.

    – Pablo González L
    Feb 17 at 17:16








1




1





It is easy to remove the ./ e.g. with a regex from expl3, but imho the best would be a feature request to the author of currfile.

– Ulrike Fischer
Feb 17 at 17:01





It is easy to remove the ./ e.g. with a regex from expl3, but imho the best would be a feature request to the author of currfile.

– Ulrike Fischer
Feb 17 at 17:01













@UlrikeFischer In my mind I think it's a "bug", remove the . / is an option :) , I'll try something using l3regex, thanks.

– Pablo González L
Feb 17 at 17:16





@UlrikeFischer In my mind I think it's a "bug", remove the . / is an option :) , I'll try something using l3regex, thanks.

– Pablo González L
Feb 17 at 17:16










2 Answers
2






active

oldest

votes


















3














Removing the period is easy:



documentclass{article}
usepackage[abspath]{currfile}
usepackage{expl3}
ExplSyntaxOn
regex_replace_once:nnN{./}{}currfileabspath
ExplSyntaxOff
setlength{parindent}{0pt}
begin{document}
texttt{jobname.pdf} created from file
currfileabspath%
end{document}


But imho it would be better if currfile would do this, when lualatex is used, as the period and the slash is also in other commands.






share|improve this answer
























  • Thank you very much ... with this temporarily get out of step. It would definitely be ideal for the package to do this on its own.

    – Pablo González L
    Feb 17 at 17:28













  • Sure, so make a bug report ...

    – Ulrike Fischer
    Feb 17 at 17:29











  • Done, bitbucket.org/martin_scharrer/currfile/issues/6/…

    – Pablo González L
    Feb 17 at 17:41



















2














You can easily get the absolute path in LuaTeX using the FFI and a platform-dependent function. On POSIX-based systems you can use the realpath() function, on Windows you would use _fullpath (I think).



Because it uses the FFI you have to enable --shell-escape.



In tex.sprint I use the first argument -2 to switch to verbatim catcodes, in case the path contains any characters which are treated special by TeX, such as {}$%#.



documentclass{article}
directlua{


local ffi = assert(require"ffi")

ffi.cdef[[


char *realpath(const char *path, char *resolved_path);


]]

function realpath(path)
return ffi.string(ffi.C.realpath(path, ffi.NULL))
end




}

defcurrfileabspath{%
directlua{tex.sprint(-2, realpath(status.filename))}%
}

begin{document}
currfileabspath
end{document}





share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f475344%2fremove-of-currfileabspath-when-using-lualatex%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    Removing the period is easy:



    documentclass{article}
    usepackage[abspath]{currfile}
    usepackage{expl3}
    ExplSyntaxOn
    regex_replace_once:nnN{./}{}currfileabspath
    ExplSyntaxOff
    setlength{parindent}{0pt}
    begin{document}
    texttt{jobname.pdf} created from file
    currfileabspath%
    end{document}


    But imho it would be better if currfile would do this, when lualatex is used, as the period and the slash is also in other commands.






    share|improve this answer
























    • Thank you very much ... with this temporarily get out of step. It would definitely be ideal for the package to do this on its own.

      – Pablo González L
      Feb 17 at 17:28













    • Sure, so make a bug report ...

      – Ulrike Fischer
      Feb 17 at 17:29











    • Done, bitbucket.org/martin_scharrer/currfile/issues/6/…

      – Pablo González L
      Feb 17 at 17:41
















    3














    Removing the period is easy:



    documentclass{article}
    usepackage[abspath]{currfile}
    usepackage{expl3}
    ExplSyntaxOn
    regex_replace_once:nnN{./}{}currfileabspath
    ExplSyntaxOff
    setlength{parindent}{0pt}
    begin{document}
    texttt{jobname.pdf} created from file
    currfileabspath%
    end{document}


    But imho it would be better if currfile would do this, when lualatex is used, as the period and the slash is also in other commands.






    share|improve this answer
























    • Thank you very much ... with this temporarily get out of step. It would definitely be ideal for the package to do this on its own.

      – Pablo González L
      Feb 17 at 17:28













    • Sure, so make a bug report ...

      – Ulrike Fischer
      Feb 17 at 17:29











    • Done, bitbucket.org/martin_scharrer/currfile/issues/6/…

      – Pablo González L
      Feb 17 at 17:41














    3












    3








    3







    Removing the period is easy:



    documentclass{article}
    usepackage[abspath]{currfile}
    usepackage{expl3}
    ExplSyntaxOn
    regex_replace_once:nnN{./}{}currfileabspath
    ExplSyntaxOff
    setlength{parindent}{0pt}
    begin{document}
    texttt{jobname.pdf} created from file
    currfileabspath%
    end{document}


    But imho it would be better if currfile would do this, when lualatex is used, as the period and the slash is also in other commands.






    share|improve this answer













    Removing the period is easy:



    documentclass{article}
    usepackage[abspath]{currfile}
    usepackage{expl3}
    ExplSyntaxOn
    regex_replace_once:nnN{./}{}currfileabspath
    ExplSyntaxOff
    setlength{parindent}{0pt}
    begin{document}
    texttt{jobname.pdf} created from file
    currfileabspath%
    end{document}


    But imho it would be better if currfile would do this, when lualatex is used, as the period and the slash is also in other commands.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Feb 17 at 17:19









    Ulrike FischerUlrike Fischer

    193k8302684




    193k8302684













    • Thank you very much ... with this temporarily get out of step. It would definitely be ideal for the package to do this on its own.

      – Pablo González L
      Feb 17 at 17:28













    • Sure, so make a bug report ...

      – Ulrike Fischer
      Feb 17 at 17:29











    • Done, bitbucket.org/martin_scharrer/currfile/issues/6/…

      – Pablo González L
      Feb 17 at 17:41



















    • Thank you very much ... with this temporarily get out of step. It would definitely be ideal for the package to do this on its own.

      – Pablo González L
      Feb 17 at 17:28













    • Sure, so make a bug report ...

      – Ulrike Fischer
      Feb 17 at 17:29











    • Done, bitbucket.org/martin_scharrer/currfile/issues/6/…

      – Pablo González L
      Feb 17 at 17:41

















    Thank you very much ... with this temporarily get out of step. It would definitely be ideal for the package to do this on its own.

    – Pablo González L
    Feb 17 at 17:28







    Thank you very much ... with this temporarily get out of step. It would definitely be ideal for the package to do this on its own.

    – Pablo González L
    Feb 17 at 17:28















    Sure, so make a bug report ...

    – Ulrike Fischer
    Feb 17 at 17:29





    Sure, so make a bug report ...

    – Ulrike Fischer
    Feb 17 at 17:29













    Done, bitbucket.org/martin_scharrer/currfile/issues/6/…

    – Pablo González L
    Feb 17 at 17:41





    Done, bitbucket.org/martin_scharrer/currfile/issues/6/…

    – Pablo González L
    Feb 17 at 17:41











    2














    You can easily get the absolute path in LuaTeX using the FFI and a platform-dependent function. On POSIX-based systems you can use the realpath() function, on Windows you would use _fullpath (I think).



    Because it uses the FFI you have to enable --shell-escape.



    In tex.sprint I use the first argument -2 to switch to verbatim catcodes, in case the path contains any characters which are treated special by TeX, such as {}$%#.



    documentclass{article}
    directlua{


    local ffi = assert(require"ffi")

    ffi.cdef[[


    char *realpath(const char *path, char *resolved_path);


    ]]

    function realpath(path)
    return ffi.string(ffi.C.realpath(path, ffi.NULL))
    end




    }

    defcurrfileabspath{%
    directlua{tex.sprint(-2, realpath(status.filename))}%
    }

    begin{document}
    currfileabspath
    end{document}





    share|improve this answer






























      2














      You can easily get the absolute path in LuaTeX using the FFI and a platform-dependent function. On POSIX-based systems you can use the realpath() function, on Windows you would use _fullpath (I think).



      Because it uses the FFI you have to enable --shell-escape.



      In tex.sprint I use the first argument -2 to switch to verbatim catcodes, in case the path contains any characters which are treated special by TeX, such as {}$%#.



      documentclass{article}
      directlua{


      local ffi = assert(require"ffi")

      ffi.cdef[[


      char *realpath(const char *path, char *resolved_path);


      ]]

      function realpath(path)
      return ffi.string(ffi.C.realpath(path, ffi.NULL))
      end




      }

      defcurrfileabspath{%
      directlua{tex.sprint(-2, realpath(status.filename))}%
      }

      begin{document}
      currfileabspath
      end{document}





      share|improve this answer




























        2












        2








        2







        You can easily get the absolute path in LuaTeX using the FFI and a platform-dependent function. On POSIX-based systems you can use the realpath() function, on Windows you would use _fullpath (I think).



        Because it uses the FFI you have to enable --shell-escape.



        In tex.sprint I use the first argument -2 to switch to verbatim catcodes, in case the path contains any characters which are treated special by TeX, such as {}$%#.



        documentclass{article}
        directlua{


        local ffi = assert(require"ffi")

        ffi.cdef[[


        char *realpath(const char *path, char *resolved_path);


        ]]

        function realpath(path)
        return ffi.string(ffi.C.realpath(path, ffi.NULL))
        end




        }

        defcurrfileabspath{%
        directlua{tex.sprint(-2, realpath(status.filename))}%
        }

        begin{document}
        currfileabspath
        end{document}





        share|improve this answer















        You can easily get the absolute path in LuaTeX using the FFI and a platform-dependent function. On POSIX-based systems you can use the realpath() function, on Windows you would use _fullpath (I think).



        Because it uses the FFI you have to enable --shell-escape.



        In tex.sprint I use the first argument -2 to switch to verbatim catcodes, in case the path contains any characters which are treated special by TeX, such as {}$%#.



        documentclass{article}
        directlua{


        local ffi = assert(require"ffi")

        ffi.cdef[[


        char *realpath(const char *path, char *resolved_path);


        ]]

        function realpath(path)
        return ffi.string(ffi.C.realpath(path, ffi.NULL))
        end




        }

        defcurrfileabspath{%
        directlua{tex.sprint(-2, realpath(status.filename))}%
        }

        begin{document}
        currfileabspath
        end{document}






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Feb 17 at 20:39

























        answered Feb 17 at 20:30









        Henri MenkeHenri Menke

        75.4k8164276




        75.4k8164276






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f475344%2fremove-of-currfileabspath-when-using-lualatex%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to send String Array data to Server using php in android

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

            Is anime1.com a legal site for watching anime?