unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: ferhun_caner@yahoo.com (Dr. F.C.Caner)
Subject: LaTeX PDF and Acrobat
Date: 20 Jun 2003 02:04:34 -0700	[thread overview]
Message-ID: <65fef11f.0306200104.479e1365@posting.google.com> (raw)

Hello all,

Here is the final version of Lisp code which 
(1) closes all the documents in the Acrobat window
(2) runs LaTeX Pdf
(3) opens the newly produced pdf file in the Acrobat window right
after LaTeX Pdf is done with compiling.

It is a very useful feature for those who use LaTeX Pdf on a Windows
system. It must be inserted into tex-site.el. Finally, TeX-run-LaTeX
that runs LaTeX Pdf in the TeX-command-list must be changed into
TeX-run-pdfLaTeX as shown below in the same file.

(defvar TeX-command-list
  (list
     ...
   (list "LaTeX PDF" "pdflatex '\\nonstopmode\\input{%t}'"
	 'TeX-run-pdfLaTeX nil t)
     ...))


Best,
FCC.

;;; This function is by von Jesper Harder:
(defun acrobat-close-all-docs ()
  "Close all open documents in Acrobat."
  (save-excursion
    (set-buffer (get-buffer-create " *ddeclient*"))
    (erase-buffer)
    (insert "[CloseAllDocs()]")
    (call-process-region (point-min) (point-max)
       "c:/EmacsPlugins/ddeclient/ddeclient" t t nil "acroview"
"control")
    (if (= 0 (string-to-int (buffer-string))) t nil)))

(defun acrobat-open-doc (process event)
  "Open file in Acrobat."
  (save-excursion
    (set-buffer (get-buffer-create " *ddeclient*"))
    (erase-buffer)
    (insert (concat "[FileOpenEx(\"" file1 ".pdf\")]"))
    (call-process-region (point-min) (point-max)
       "c:/EmacsPlugins/ddeclient/ddeclient" t t nil "acroview"
"control")
    (if (= 0 (string-to-int (buffer-string))) t nil)
    )
  )

(defvar file1 "")

(defun TeX-run-pdfLaTeX (name command file)
  "Create a process for NAME using COMMAND to format FILE with
pdfLaTeX."
  (setq file1 file)
  (acrobat-close-all-docs)
  (TeX-run-LaTeX name command file)
  (set-process-sentinel (get-process "LaTeX PDF") 'acrobat-open-doc)
)

                 reply	other threads:[~2003-06-20  9:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=65fef11f.0306200104.479e1365@posting.google.com \
    --to=ferhun_caner@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).