0

The file main.tex is in the current path (./main.tex). Its content is shown below.

Another file named da.tex is located in the subdirectory ddd(./ddd/da.tex). The content of da.tex is da.tex under ./ddd.

Running "main.tex" typesets da.tex under ./ddd []||.

My question is: why does \getabspath not find the file ./ddd/da.tex?

PS: win7 + MikTex + Xelatex -recorder

main.tex:

\documentclass{article}
\usepackage[abspath]{currfile}
\begin{document}
\input{ddd/da.tex}
\getabspath{ddd/da.tex} [\theabspath]|\theabsdir|.
\end{document}
user202729
  • 7,143
lyl
  • 2,727
  • It does work properly for me. Maybe try running again (with -recorder flag)? – user202729 Jul 18 '22 at 05:19
  • Also maybe delete any unused .fls file, and ensure that after running it the fls file does get generated – user202729 Jul 18 '22 at 05:20
  • I tried both, and the typeset is still the same. INPUT ddd\da.tex INPUT .\ddd\da.tex INPUT ddd\da.tex This is part of my .fls file. Does that mean \getabspath can not work with miktex? – lyl Jul 18 '22 at 05:30
  • The fls looks correct. Are you using custom output directory? – user202729 Jul 18 '22 at 05:31
  • Maybe you need to pass a backslash into getabspath function? (you do know how to pass a backslash of catcode other to the function, right?) – user202729 Jul 18 '22 at 05:33
  • I put all temp files that generated during compilation into a directory ./tmp. – lyl Jul 18 '22 at 05:33
  • Okay, then try not specifying output directory and see if it works. – user202729 Jul 18 '22 at 05:33
  • pass a backslash into getabspath function How to do that? – lyl Jul 18 '22 at 05:35
  • 1
    Either \ExplSyntaxOn \exp_args:Nx \getabspath {ddd \cs_to_str:N \\ da.tex}, or use (my) package (needs installation however) \usepackage{precattl} then \precattlExec{\getabspath{\ddd\cO\\da.tex}} – user202729 Jul 18 '22 at 05:37
  • \ExplSyntaxOn \exp_args:Nx \getabspath {ddd \cs_to_str:N \\ da.tex} does work!! \theabspath typeset .\ddd\da.tex. Is it a bug under Windows sys? And why abspath just begin at the current path, not from the root, like /D/.../.../da.tex? – lyl Jul 18 '22 at 05:47
  • Hm, you can tell the author of the currfile about that and see if they determine it's a bug or not. (to fix this one you need to replace backslash with slash, but only on Windows. On Linux backslash is a legal character in file name) – user202729 Jul 18 '22 at 05:49
  • try \getabspath{./ddd/da.tex}. If you get a period to much, check https://tex.stackexchange.com/a/475356/2388 – Ulrike Fischer Jul 18 '22 at 07:29
  • @Ulrike Fischer I tried with \getabspath{./ddd/da.tex}, The typeset is the same with \getabspath{ddd/da.tex}. – lyl Jul 18 '22 at 09:47
  • 1
    a sorry, mixed up texlive and miktex. Try with \getabspath{.\string\testinput\string\aa.tex} – Ulrike Fischer Jul 18 '22 at 15:43
  • Is there any general method in Tex/Latex to change path format from linux to windows? I mean a macro, any input of linux path lead to output of windows path. – lyl Jul 19 '22 at 00:27
  • 1
    Yes there is (replace any slash with backslash. Learn some expl3 (str_replace_all) or Lua (this one is not difficult). Although it's unrelated to this question...? – user202729 Jul 19 '22 at 15:39
  • @user2027729 According to the above, I think the crucial point of my question is that \getabspath does not work well with windows system. The path format has to be changed from linux to windows so thant \getabspath is able to identify the file and give the correct result. – lyl Jul 20 '22 at 00:06

0 Answers0