Update on 2008-01-24:
The “back” feature is no longer needed, at least on Windows Acrobat Reader 8. See: Edit->Preferences->Documents->Restore last view settings when reopening documents
Update on 2007-01-30:
I have patched the source and replaced the zip files so that pdfclose will be less likely to crash Adobe Reader 8. Thanks to this post. Also, apparently pdfopen cannot issue a “back” command to Adobe Reader and you need the full version for that feature.
If you are a Windows user and use Acrobat or Adobe Reader(*) to view PDF files, you may have experienced Acrobat locking your PDF file, making it impossible to overwrite. This is a serious problem when previewing your paper in the PDF format because every time before you generate a new PDF, you need to remember closing the old PDF in Acrobat.
Part of my solution to this problem is to open the PDF using pdfopen:
pdfopen --file foo.pdf
This will allow me to close foo.pdf by:
pdfclose --file foo.pdf
Integrating these two commands into your work-flow is left as an exercise to the reader.
But there is still an important usability problem that these two commands won’t solve. Every time you re-open a PDF, you will not be on the same page when you closed it. Instead, you will be on the first page. How would I to fix this? One solution would be to press Alt-Left after I re-opened the PDF file. This goes back in history and brings me to the last view I was at. But I’ve got something better.
I’ve modified the source code of pdfopen from TUG to include an extra option --back to do the obvious thing. So instead of the above, you should open a PDF file by:
pdfopen --file foo.pdf --back
Now the cycle is complete. Phew!
I have posted the exe files in a zip. The source files are available too.
For the record, you can obtain the original pdfopen and pdfclose at this URL:
http://www.tug.org/tex-archive/systems/win32/web2c/current/binary/bin-pdftools-win32.zip
BTW, I’ve read that recent versions of TeXnicCenter and WinEdt can both perform this Acrobat cycle too. But I am not sure if they can go back to the previous view. Heh, surely I know my Emacs can.
P.S. I am also aware that you can use gsview32 to preview PDFs and gsview32 does not lock PDF files. That’s one way to avoid this problem.
(*) Really, it’s called Adobe Reader. I don’t know since when they dropped the middle word.
BTW, I must add that I do know about DVI. Thanks!
The only reason why I sometimes prefer using PDF to preview instead of DVI is that I have color in my text and YAP is still not very good at that. Plus, there is no hyperlink support.
(I use dviout sometimes too. It’s a very mature DVI previewer on Windows.)
This is also true, but honestly, I never really like the user interface of GSView32 on Windows… If one day I get some time to hack (which, again, is highly unlikely), I want to give it a much better modern user interface.
Regarding the double click: everytime you do latex you have to use the option -src, i.e. the command line
latex -src filename
you can even configure .emacs to do this automatically whenever you hit the Latex button.
Then, in yap go to View, Options, Inverse Search and type into command line:
emacs +”%l”:31 “%f”
The problem with this configuration is that now whenever you double-click in yap, this will open a new emacs-window instead of going to the old window in which you were working in. This seems to be a major hassle but I don’t know how to get around it.
PS: Note that emacs and latex should be in the Windows path to make everything work out smoothly.
Please see
http://magic.aladdin.cs.cmu.edu/2006/06/07/latex-source-specials/
for a follow-up.
Though the back button in Adobe Reader is active, the –back option doesn’t seem to be working. I gives the error
Cannot execute command “[MenuitemExecute("GoBack")]” (error 16393)
I use Adobe Reader 7.0.8. I tried to figure out how pdfdde works, but I had no luck with it.
I’d like to note that I didn’t quit Acrobat Reader before trying to use pdfopen (I read the comment by moon). I closed the document with pdfclose. Actually the back button _is_ clickable after the document is reopened by pdfopen.
Szabolcs
It is my understanding that the command “[MenuitemExecute(”GoBack”)]” works only for the full Acrobat, not for Adobe Reader. (See the Wikipedia article on “Texniccenter”.) So the new version of “pdfopen” looks useless to Adobe Reader users. WinEdt supports this function (for Adobe Reader) by using some roundabout way.
What I really dislike about latex is the need to convert bitmap graphics into eps, which usually bloats them up tremendously. pdflatex supports .jpg and .png bitmap graphics, and .pdf for vector graphics.
Use sam2p to convert bitmapped images into eps. The resulting eps files are only marginally larger than the original jpg or png files.