emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tom Dye <tsd@tsdye.com>
To: emacs-orgmode@gnu.org
Subject: Re: Making an index in latex export --- surprisingly difficult
Date: Sun, 8 May 2011 20:08:26 -1000	[thread overview]
Message-ID: <iq80cp$7jv$1@dough.gmane.org> (raw)
In-Reply-To: 12644.1303886106@alphaville.dokosmarshall.org

On 2011-04-26 20:35:06 -1000, Nick Dokos <nicholas.dokos@hp.com> said:

> Robert Goldman <rpgoldman@sift.info> 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 ;-)

Aloha all,

I've found it convenient to add paths to system-wide bibliographic 
databases to BIBINPUTS in .profile, as Nick suggests, and then use a sh 
source code block for project-specific databases, like this for a 
project in /org/tsdye/:

#+source: bibinputs
#+begin_src sh
  BIBINPUTS=/org/tsdye/:$BIBINPUTS
  export BIBINPUTS
#+end_src

If I remember to execute this before I start editing, then I can add 
references to my work from either the system-wide or project-specific 
databases and LaTeX export produces an error-free pdf file full of 
references.

Tom

-- 
Tom Dye
T. S. Dye & Colleagues, Archaeologists, Inc.
Honolulu, Hawai`i

      parent reply	other threads:[~2011-05-09  6:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-26 21:09 Making an index in latex export --- surprisingly difficult Robert Goldman
2011-04-26 21:26 ` Suvayu Ali
2011-04-26 21:44   ` Robert Goldman
2011-04-28  9:28     ` Eric S Fraga
2011-04-28 11:04       ` Robert Goldman
2011-04-28 11:52         ` Eric S Fraga
2011-04-26 21:52 ` Nick Dokos
2011-04-26 21:58   ` Robert Goldman
2011-04-26 23:14     ` Nick Dokos
2011-04-27  1:32       ` Robert Goldman
2011-04-27  6:35     ` Nick Dokos
2011-04-27  7:38       ` Thomas S. Dye
2011-05-09  6:08       ` Tom Dye [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='iq80cp$7jv$1@dough.gmane.org' \
    --to=tsd@tsdye.com \
    --cc=emacs-orgmode@gnu.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).