From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?S=C3=A9bastien_Vauban?= Subject: Re: export (as latex) a large number of org files in a directory Date: Wed, 02 Sep 2009 17:21:36 +0200 Message-ID: <8763c14bjz.fsf@mundaneum.com> References: <894242.15667.qm@web39706.mail.mud.yahoo.com> <31875.1251644646@gamaville.dokosmarshall.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org Hi Nick and the others, Nick Dokos wrote: > Stephen Tucker wrote: > >> Hi, I am trying to export a bunch of .org files stored in a directory as >> latex files. > > The following script (I call it org-to-latex) works fine on linux: > > #! /bin/bash > > orglib=3D$HOME/elisp/org-mode/lisp > emacs --batch \ > --load=3D$orglib/org.elc \ > --eval "(setq org-export-headline-levels 2)" \ > --visit=3D$1 --funcall org-export-as-latex-batch Another solution is a Makefile, such as this one: --8<---------------cut here---------------start------------->8--- ## Makefile for Web site (+ PDF equivalent) # Time-stamp: <2009-09-02 Wed 16:43 sva on mundaneum> # Defined rules for users: # # - (make called without parameter) # Generate all PDF # # - clean # Delete all temporary files # # - realclean # Do `make clean' plus remove all generated files # where to find a recent version of Org-mode ORGLIB =3D $(HOME)/Downloads/emacs/site-lisp/org-mode/lisp # publish HTML directory DISTDIR =3D ../public_html # platform-specific setup (to override ORGLIB and/or DISTDIR) -include Make.params PDFLATEX =3D pdflatex --interaction=3Dbatchmode RM =3D rm -f RMEXT =3D *.log *.aux *.toc *.lot *.lof *.out *.ilg *.idx *.ind *.blg *.= bbl \ *.glg *.glx *.glo *.gls *.tex RMOUT =3D *.pdf $(DISTDIR)/*.html # all source files ORG=3D$(wildcard *.org) # all exported PDF files PDF=3D$(patsubst %.org, %.pdf, $(ORG)) # all TEX files TEX=3D$(patsubst %.org, %.tex, $(ORG)) # all published HTML files HTML=3D$(patsubst %.org, $(DISTDIR)/%.html, $(ORG)) .PHONY: all html pdf clean realclean # avoid make to delete intermediate `%.tex' target .PRECIOUS: %.tex .DEFAULT_GOAL :=3D all all: html pdf html: $(HTML) pdf: $(PDF) clean tex: $(TEX) $(DISTDIR)/%.html: %.org @echo @emacs --batch \ --eval "(add-to-list 'load-path \"$(ORGLIB)\")" \ --load ./Org2HTML.el \ --visit=3D$^ \ --funcall org-publish-current-file %.pdf: %.tex # Runs LaTeX once, then reruns LaTeX as many times as necessary to get rid = of # the "Rerun to get cross-references right" warning message @echo @echo "* Running \`pdfLaTeX $^' *" @$(RM) *.log @$(PDFLATEX) $^ @while ( grep -e "Rerun .* cross-references" *.log > /dev/null ); \ do \ echo; \ echo "* Re-running \`pdfLaTeX $^' *"; \ $(RM) *.log; \ $(PDFLATEX) $^; \ done %.tex: %.org # Pay attention that `--batch' implies `-q', so `.emacs' is *not* loaded and # you don't get your `load-path' customizations. Hence, this loads the Emacs # built-in version of Org-mode. @echo @emacs --batch \ --eval "(add-to-list 'load-path \"$(ORGLIB)\")" \ --eval "(require 'org)" \ --eval "(require 'org-exp)" \ --eval "(setq org-export-headline-levels 2)" \ --load ./Org2LaTeX.el \ --visit=3D$^ \ --funcall org-export-as-latex-batch clean: -$(RM) $(RMEXT) realclean: clean -$(RM) $(RMOUT) ## Makefile ends here --8<---------------cut here---------------end--------------->8--- It has the advantage of running only the required compilation for the modif= ied files, and generates both HTML and PDF versions... A nice thing would be to be able to even merge all the PDF files into one -- but here come questions like in which order, with or without title page, and so on. Comments (more than) welcome! Seb --=20 S=C3=A9bastien Vauban _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode-mXXj517/zsQ@public.gmane.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode