[Tex/LaTex] viewer command that will close only the current PDF document in TeXnicCenter


I currently compile .pdf files using TeXnicCenter with the following settings in Build -> Define Output Profiles -> Viewer -> Close document before running LaTeX:

Server: AcroViewR11  Command: [AppExit]  Topic: control

When TeXnicCenter compiles and views output, this closes all of the open instances of Adobe Reader (for example: two Acrobat windows open, each with a single PDF shown – one window contains the document being compiled, the other contains the reference document), compiles the new PDF, then opens the new file.

Although this works perfectly well for some jobs, it does close all instances of Adobe Reader including the other .pdf files open in the background. Many workflows involve composing a file using LaTeX whilst also referencing a separate .pdf file which should be kept open.

Can someone suggest a different command that would close only the instance of Adobe Reader that relates to the current document being compiled?

Best Answer

In your case I see two problems:

  1. Adobe Acrobat (Professional)
  2. AppExit

To 2:

I do not know the mentioned AppExit you call in TeXnicCenter, but are you sure it does, what you think? Perhaps this AppExit causes the closing of all open windows of Acrobat? Have you tried to call Acrobat without AppExit? Result?

To 1:

Adobe has changed the possibility for Acrobat Reader to be called by other programs in a (in my opinion) bad way: First version could be called without problems, higher versions are changed to make it harder to be used/included by other programs. For example: First versions had not to be closed while compiling, the newer versions had to be closed. If you compile for example file mwe.tex in TeXnicCenter, but you have opend an earlier compiled version of mwe.pdf outside of TeXnicCenter you get a 3 error message, because TeXnicCenter is not able to close a Acrobat window not opend in TeXnicCenter.

Knowing this, I think that your used App AppExit causes the problem you have. TeXnicCenter is not allowed (by programming of Adobe) to close windows not opend in TeXnicCenter (or Adobe has changed this behaviour of Acrobat).

Because Acrobat makes a lot of trouble the last years I personaly do not use Acrobat longer for viewing compiled LaTeX documents. TeXnicCenter works perfect with SumatraPDF including the inverse search.

PS: For the right configuration of TeXnicCenter calling Acrobat reader see this question!