From: "Sébastien Vauban" <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: Re: export (as latex) a large number of org files in a directory
Date: Wed, 02 Sep 2009 17:21:36 +0200 [thread overview]
Message-ID: <8763c14bjz.fsf@mundaneum.com> (raw)
In-Reply-To: 31875.1251644646@gamaville.dokosmarshall.org
Hi Nick and the others,
Nick Dokos wrote:
> Stephen Tucker <brown_emu-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> 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=$HOME/elisp/org-mode/lisp
> emacs --batch \
> --load=$orglib/org.elc \
> --eval "(setq org-export-headline-levels 2)" \
> --visit=$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 = $(HOME)/Downloads/emacs/site-lisp/org-mode/lisp
# publish HTML directory
DISTDIR = ../public_html
# platform-specific setup (to override ORGLIB and/or DISTDIR)
-include Make.params
PDFLATEX = pdflatex --interaction=batchmode
RM = rm -f
RMEXT = *.log *.aux *.toc *.lot *.lof *.out *.ilg *.idx *.ind *.blg *.bbl \
*.glg *.glx *.glo *.gls *.tex
RMOUT = *.pdf $(DISTDIR)/*.html
# all source files
ORG=$(wildcard *.org)
# all exported PDF files
PDF=$(patsubst %.org, %.pdf, $(ORG))
# all TEX files
TEX=$(patsubst %.org, %.tex, $(ORG))
# all published HTML files
HTML=$(patsubst %.org, $(DISTDIR)/%.html, $(ORG))
.PHONY: all html pdf clean realclean
# avoid make to delete intermediate `%.tex' target
.PRECIOUS: %.tex
.DEFAULT_GOAL := 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=$^ \
--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=$^ \
--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 modified
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
--
Sébastien 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
prev parent reply other threads:[~2009-09-02 15:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-30 14:11 export (as latex) a large number of org files in a directory Stephen Tucker
2009-08-30 15:04 ` Nick Dokos
2009-08-30 19:11 ` Stephen Tucker
2009-08-31 2:27 ` Nick Dokos
2009-08-31 4:38 ` Nick Dokos
2009-08-31 5:58 ` Stephen Tucker
2009-09-02 15:21 ` Sébastien Vauban [this message]
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.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8763c14bjz.fsf@mundaneum.com \
--to=wxhgmqzgwmuf-genee64ty+gs+fvcfc7uqw@public.gmane.org \
--cc=emacs-orgmode-mXXj517/zsQ@public.gmane.org \
/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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).