1

I have a .tex file named MY_FILE.tex and a .pdf file named MY_FILE.pdf. Now I want to produce a slightly modified version of MY_FILE.pdf file using a temp file called TEMP.tex.

The only difference between MY_FILE.tex and TEMP.tex is that a small region is wrapped with \color{red} text \color{black}, so that a small portion of text in the new version of MY_FILE.pdf is highlighted.

I generate the new versions (a temp version) of the file MY_FILE.pdf with the command:

pdflatex -synctex=1 --jobname=MY_FILE "\input{/tmp/TEMP.tex}"

but in this way I loose the synchronization between MY_FILE.tex and MY_FILE.pdf (forward- and reverse-search).

The command generates a MY_FILE.synctex.gz file but the in the second line of the file MY_FILE.synctex I read:

Input:1:/tmp/TEMP.tex

Is it possible to obtain a synchronization between MY_FILE.tex and MY_FILE.pdf using the technique described above?

Gabriele
  • 1,815
  • What's the requirement exactly? If you are not limited to do it in TeX you can simply cp MY_FILE.tex MY_FILE_BACKUP.tex && cp TEMP.tex MY_FILE.tex && pdflatex MY_FILE.tex && cp MY_FILE_BACKUP.tex MY_FILE.tex (bash pseudocode, but might actually be runnable) There are more complex options, see my question https://tex.stackexchange.com/questions/631887/how-can-i-capture-and-rescan-tex-source-code-while-preserving-synctex-data?noredirect=1&lq=1 and the linked once (in particular since this is pdflatex, editing the generated synctex file might be the only option) – user202729 Jun 16 '22 at 00:58
  • @user202729, indeed I solved editing the generated synctex file. Thanks for the suggestions. If you like you could write your comment as an answer so I can accept it as the solution. – Gabriele Jun 16 '22 at 14:06

0 Answers0