From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Making an index in latex export --- surprisingly difficult Date: Wed, 27 Apr 2011 02:35:06 -0400 Message-ID: <12644.1303886106@alphaville.dokosmarshall.org> References: <4DB73482.5010608@sift.info> <6174.1303854727@alphaville.americas.hpqcorp.net> <4DB74011.2020600@sift.info> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:46857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEyLJ-0000xq-Be for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 02:35:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QEyLE-0001C5-QA for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 02:35:21 -0400 Received: from vms173013pub.verizon.net ([206.46.173.13]:47934) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEyLE-0001BY-HM for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 02:35:16 -0400 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173013.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LKA00KMGSYJME30@vms173013.mailsrvcs.net> for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 01:35:10 -0500 (CDT) In-reply-to: Message from Robert Goldman of "Tue, 26 Apr 2011 16:58:41 CDT." <4DB74011.2020600@sift.info> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: rpgoldman@sift.info Cc: nicholas.dokos@hp.com, Org Mode Robert Goldman wrote: > >> 4. Modify the org-latex-to-pdf-process to > >> > >> ("pdflatex -interaction nonstopmode -output-directory %o %f" "makeindex > >> -o %b.ind %b.idx" "pdflatex -interaction nonstopmode -output-directory > >> %o %f" "pdflatex -interaction nonstopmode -output-directory %o %f") > >> > >> [This was /somewhat/ of a big deal. Suggest we add support for indexing > >> as a built-in option, like bibtex...] > >> > > > > Maybe you can try the texi2dvi option (I think it runs makeindex), but > > texi2dvi did have a bug that has caused problems here in the past: > > that's the reason it's not the default setting for > > org-latex-to-pdf-process. If you run into the bug but still want to try > > texi2dvi anyway, see > > > > http://lists.gnu.org/archive/html/bug-texinfo/2010-03/msg00032.html > > > > for the fix Karl Berry applied to the development sources. > > Once one has makeindex hacked in there (oh, and you've broken the > security!), it works fine, thanks. > > > >> an absolute pathname. But org-mode will only pass absolute pathnames to > >> makeindex (AFAICT). Question: it seems like bibtex should suffer from > >> this same restriction. Has anyone had that problem with it? > >> > > > > I haven't had the problem, primarily because I haven't used bibtex > > through org yet :-) But bibtex should exhibit the same problem: the > > bibtex change predated the makeindex one. Maybe bibtex is only called > > with a relative path (if that's the case, then the same method should > > cure makeindex as well). BTW, ".." is not allowed in the relative path: > > you can only use subdirectories of the current directory. > > Here's a step-by-step that uses texi2dvi[fn:1]: o Download a bibliography file: cd /home/nick/lib/bibtex wget -nd http://ftp.math.utah.edu/pub//tex/bib/linux.html mv linux.html linux.bib o Set the BIBINPUTS environment variable in .profile (or similar): BIBINPUTS=/home/nick/lib/bibtex:$BIBINPUTS export BIBINPUTS o Set org-latex-to-pdf-process in .emacs (or similar): (setq org-latex-to-pdf-process '("texi2dvi --pdf --tidy --batch %f")) The --tidy keeps all the intermediate files tucked away in a subdirectory. You can use --clean instead if you want automatic cleanup of intermediate files. That's all for one-time setup. There is no problem with bibtex/makeindex security because all the output files end up in a subdirectory and (I guess) texi2dvi uses relative pathnames. Here's an org file with an index and a bibliography that is properly exported to PDF with the above setup: --8<---------------cut here---------------start------------->8--- #+LATEX_HEADER: \usepackage{makeidx} #+LATEX_HEADER: \makeindex #+LaTeX: \bibliographystyle{plain} * this #+LaTeX: \index{foo} is a test of foo \cite{Torvalds:1999:LE} #+LaTeX: \bibliography{linux} #+LaTeX: \printindex --8<---------------cut here---------------end--------------->8--- Nick Footnotes: [fn:1] My egrep does not choke on the suspect [A-z] pattern that texi2dvi uses, so I don't need Karl Berry's patch - if your egrep does choke, the patch just changes the pattern to [A-Za-z] which although not exactly the same, since it omits a few punctuation chars that come between Z and a in ASCII[fn:2], is good enough. [fn:2] The pattern tries to recognize legal drive names on DOS/Windoze, and these characters are *legal drive names*!! We have Novell to thank for that though, not M$. OTOH, if you are on Windoze and have a drive named `[', watch out ;-)