Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change-directory doesn't seem to be working correctly #7

Closed
atticus-sullivan opened this issue Dec 10, 2021 · 4 comments
Closed

change-directory doesn't seem to be working correctly #7

atticus-sullivan opened this issue Dec 10, 2021 · 4 comments

Comments

@atticus-sullivan
Copy link
Contributor

Hi,
I've read that setting -output-directory for latex engines breaks many packages. So I thought of using cd instead of setting output-directory (in effect this should be similar to cd <dir> && <latex-engine> ... && cp <output-file> ../ instead of <latex-engine> -output-directory <dir> && cp <dir>/<output-file> ./).

Is this possible with the current set of options?

If not can one avoid that cluttex sets output-directory at all (so that cd etc can be handled by a Makefile on my own)?

@atticus-sullivan atticus-sullivan changed the title output-directory breaks things output-directory breaks some packages Dec 10, 2021
@atticus-sullivan
Copy link
Contributor Author

Hm after some testing, I noticed with using cd the use of input is broken (and since tikzexternalize uses input, this is broken too).

Still I see the use of output-directory a problem, but now I've got no easy solution anymore. Any Ideas welcome

@atticus-sullivan
Copy link
Contributor Author

atticus-sullivan commented Dec 12, 2021

See this tex.stackexchange post for a discussion on this topic. For me I'm using the there described solution1 for now (not quite sure how long it will work since the paths/prefix aren't designed for that use).

Nevertheless if it's true what is mentioned there

-output-directory just breaks a lot of packages.
Then cluttex has to handle these packages somehow.

(whether this issue should be closed or not is up to you, my specific problem has solved, but if this is a more general problem, this problem will come up again and has to be solved somehow)

@atticus-sullivan
Copy link
Contributor Author

atticus-sullivan commented Dec 12, 2021

Follow up: After some source code reading I think you already tackle this issue by --change-directory (adding the pwd to TEXINPUTS helps that the files are still found (which was a problem of mine when just using cd)). But as far as I see it when using this option output-directory shouldn't be set in the final lualatex (or what so ever) command as the working directory was already set to this directory.

After some testing I think there are some bugs regarding change-directory. See for example this session:

$ ll
drwx------ user group  4 B 2021-12-12 23:47:44  ./
drwx------ user group  9 B 2021-12-12 22:47:30  ../
.rw------- user group 69 B 2021-12-12 23:47:14  main.tex
drwx------ user group  2 B 2021-12-12 23:47:32  tex-aux/
$ ll tex-aux/
drwx------ user group 2 B 2021-12-12 23:47:32  ./
drwx------ user group 4 B 2021-12-12 23:47:44  ../
$ cat main.tex
───────┬───────────────────────────
       │ File: main.tex
───────┼───────────────────────────
   1   │ \documentclass{article}
   2   │
   3   │ \begin{document}
   4   │ Hello world
   5   │ \end{document}
───────┴───────────────────────────
$ cluttex --output-directory=tex-aux -e lualatex --change-directory -shell-escape main.tex
/usr/bin/cluttex:1181: tex-aux/main.cluttexinit.lua: No such file or directory
$ mkdir tex-aux/tex-aux
$ cluttex --output-directory=tex-aux -e lualatex --change-directory -shell-escape main.tex # now it worked

because if change-directory is set, all paths are relative to output-directory, cluttex tries to write to output-directory/output-directory which is strange.

Maybe it would be best to keep paths absolute to ensure that the destination will not change even if change-directory is used. Or is it possible to simply unset output-directory if change-directory is set (would only work if no other relative path was already derived from output-directory I think)?

@atticus-sullivan atticus-sullivan changed the title output-directory breaks some packages change-directory doesn't seem to be working correctly Dec 12, 2021
@atticus-sullivan
Copy link
Contributor Author

Fixed by PR #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant