remove “./” of “currfileabspath” when using lualatex
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
add a comment |
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
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 usingl3regex, thanks.
– Pablo González L
Feb 17 at 17:16
add a comment |
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
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
luatex patching currfile
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 usingl3regex, thanks.
– Pablo González L
Feb 17 at 17:16
add a comment |
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 usingl3regex, 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
add a comment |
2 Answers
2
active
oldest
votes
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.
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
add a comment |
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}
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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}
add a comment |
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}
add a comment |
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}
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}
edited Feb 17 at 20:39
answered Feb 17 at 20:30
Henri MenkeHenri Menke
75.4k8164276
75.4k8164276
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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 usingl3regex, thanks.– Pablo González L
Feb 17 at 17:16