If one follows the advice in
https://github.com/texstudio-org/texstudio/wiki/Tips-And-Tricks#using-a-separate-directory-for-auxiliary-files
and sets up an output directory and configures additional search paths for the log and PDF file, then the regular "Build & view" command works, but the preview tooltip stops working (this is the preview that is activated when you hover the mouse over a math equation).
This happens because TexStudio creates a temporary .tex file for the preview image, then builds the .tex file and creates the PDF file in the custom output directory, but then tries to load the custom PDF from the temporary directory.
Below I am providing two Linux strace outputs. The first output is when TexStudio works without a custom output directory. In this case the temporary preview PDF is created in /tmp and then is loaded correctly. As you can see all the temporary files are unlinked correctly.
linkat(AT_FDCWD, "/proc/self/fd/21", AT_FDCWD, "/tmp/uMhfmc.tex", AT_SYMLINK_FOLLOW) = 0
access("/tmp/uMhfmc.pdf", F_OK) = 0
openat(AT_FDCWD, "/tmp/uMhfmc.pdf", O_RDONLY) = 20
unlink("/tmp/uMhfmc.aux") = 0
unlink("/tmp/uMhfmc.log") = 0
unlink("/tmp/uMhfmc.pdf") = 0
unlink("/tmp/uMhfmc.synctex.gz") = 0
unlink("/tmp/uMhfmc.tex") = 0
The second output is when the output directory for pdflatex is set to /root/texout. In this case it creates the .tex file as /tmp/PxoYtO.tex. After that the output PDF is created as /root/texout/PxoYtO.tex but TexStudio tries to load it from /tmp/PxoYtO.pdf which obviously fails. Additionally none of the temporary files except /tmp/uMhfmc.tex are deleted, because all the output files are in the custom output directory /root/texout
linkat(AT_FDCWD, "/proc/self/fd/21", AT_FDCWD, "/tmp/PxoYtO.tex", AT_SYMLINK_FOLLOW) = 0
access("/tmp/PxoYtO.pdf", F_OK) = -1 ENOENT (No such file or directory)
unlink("/tmp/PxoYtO.tex") = 0
As a result the inline preview does not work, that is hovering the mouse over an equation does not show the preview tooltip.
Anonymous