I was using TexStudio and everything was fine (each time I compiled, the preview appeared at the right side). Then, I need to change the file of the pdf generated from the tex code. So, I used this solution. However, everytime I compiled, the content in the preview is not updated anymore. Any way to make it work with %& -job-name=mypdf.pdf at the top?

  • AFAIK TeXstudio always expects that the log and the pdf file have the same basename like the root TeX file. Can't you use a tex file mypdf.tex as root, that just uses one \input <originaltexfile>.tex?
    – cabohah
    Dec 8, 2023 at 15:17

1 Answer 1


You can add | txs:///view-pdf "mypdf.pdf" to your magic comment to specify which file should be shown in the pdf viewer:

% !TeX program = pdflatex -jobname=mypdf  % | txs:///view-pdf "mypdf.pdf"




You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .