SumatraPDF integration in LaTeX-Emacs-make tool chain

 

SumatraPDF integration in LaTeX-Emacs-make tool chain

steps:

1.upgrade to the most recent SumatraPDF http://code.google.com/p/sumatrapdf/downloads/list

2.make sure sumatrapdf is in the search path

3.update make file for the make integration

MAIN=maintex

EPS=img/*.eps

TEX=tomo_spectra.tex 

BIB=da.bib 

REBUILDABLES =  \
*.log   \
*.blg   \
*.bbl   \
*.aux   \
*.lof   \
*.lot   \

LATEXOPTIONS = -src-specials -interaction=nonstopmode

PDFVIEWER = sumatrapdf -reuse-instance -inverse-search "c:\emacs\bin\emacsclientw.exe +%l \"%f\""

BIBDIR = "C:/H/Bib"

BIBOPTIONS = -include-directory=$(BIBDIR)

vpath %.bib /cygdrive/c/H/Bib

viewpdf : $(MAIN).pdf
    $(PDFVIEWER) $(MAIN).pdf &

dvi : $(MAIN).dvi
    yap -1  $(MAIN).dvi

$(MAIN).pdf : $(MAIN).dvi
    pdfclosem $(MAIN).pdf ; dvipdfm $(MAIN).dvi

$(MAIN).dvi : $(MAIN).bbl $(EPS)
    latex $(LATEXOPTIONS) $(MAIN)
        if ( grep 'Rerun' $(MAIN).log > /dev/null ) ; then\
            latex $(LATEXOPTIONS) $(MAIN) ; \
        else :; fi

$(MAIN).bbl : $(TEX)
    rm -f $(MAIN).aux *.bbl; latex $(LATEXOPTIONS) $(MAIN); bibtex $(BIBOPTIONS) $(MAIN) 

clean :
    rm -f $(REBUILDABLES)

4.update .emacs for AucTeX integration

(setq TeX-view-program-list
      '(("sumatra" "sumatrapdf -reuse-instance \"%f\"")
        ("Yap" ("yap -1" (mode-io-correlate " -s %n%b") " %o"))
        ("dvips and start" "dvips %d -o && start \"\" %f")
        ("start" "pdfviewm %o")))

(setq TeX-view-program-selection
      '(((output-dvi style-pstricks)
         "dvips and start")
        (output-dvi "Yap")
        (output-pdf "sumatra")
        (output-html "start")))

if I need inverse search, pub /usepackage{pdfsync} before \begin{document}, or use pdflatex instead of latex

why using sumatrapdf? it does not lock the pdf file, so when restarting the make process, I don’t need to close the pdf file manually.

Date: 2012-02-16

Author: Da Zhang

Org version 7.8.03 with Emacs version 24

Validate XHTML 1.0

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s