[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Making an index in latex export --- surprisingly difficult
From: |
Eric S Fraga |
Subject: |
Re: [O] Making an index in latex export --- surprisingly difficult |
Date: |
Thu, 28 Apr 2011 12:52:00 +0100 |
User-agent: |
Gnus/5.110016 (No Gnus v0.16) Emacs/24.0.50 (gnu/linux) |
Robert Goldman <address@hidden> writes:
[...]
>> If the file is indeed in the /current/ directory, then a simple fix may
>> be to use %b for the file argument to makeindex? I have no problems
>> with bibtex using
>>
>> ,----
>> | org-latex-to-pdf-process is a variable defined in `org-latex.el'.
>> | Its value is ("pdflatex %f" "bibtex %b" "pdflatex %f" "pdflatex %f")
>> `----
>>
>> Note the use of %b instead of %o or %f. I've never used makeindex so
>> cannot be sure this would work.
>>
>
> No, actually this does not work, since the expansion of %b is still an
> absolute pathname, rather than a relative pathname. The only difference
> is that the file extension is removed. Here's a snippet from my
> *trace-output* buffer when I trace the shell-command function:
Okay, you are correct! I have sometimes used the following shell script
in lieu of the sequence of commands:
--8<---------------cut here---------------start------------->8---
#!/bin/sh -f
# first argument should be base latex file name but may be absolute
F=$1
B=$(basename $F)
echo 'Original file: ' $F
echo 'Base file: ' $B
echo 'Invoked in dir: ' $PWD
echo '--------------------------------- running pdflatex first
---------------------------------------------------'
pdflatex $F
echo '--------------------------------- running bibtex next
-------------------------------------------------------'
bibtex $B
echo '--------------------------------- running pdflatex again (and again)
----------------------------------------'
pdflatex $F
pdflatex $F
--8<---------------cut here---------------end--------------->8---
which is =/home/ucecesf/s/bin/org2pdf.sh= (for me). I then define
#+begin_src emacs-lisp
(setq org-latex-to-pdf-process '("/home/ucecesf/s/bin/org2pdf.sh %b"))
#+end_src
You could add a line of the form:
makeindex -o ${B}.ind ${B}.idx
to this script, probably before the bibtex line?
Of course, this doesn't some any of the other problems, as you note
below:
[...]
> The only "solution" I know (aside from disabling the texmf.cnf security
> setting) would be to have org ensure that its CWD is the document
> directory when running these programs and use relative pathnames. I
> don't know that this solution is compatible with correct use of
> EXPORT_FILE_NAME, however....
Yes, the same applies to my simple script above: it assumes that the
current directory *is* the one in which the files are.
> This seems like a very crippling security setting -- it would break many
> plausible uses of the tex suite when they are run under program control
> (I could easily imagine scenarios with make that would result in the use
> of absolute pathnames, too); I'm surprised it was made.
It does seem like a silly restriction.
--
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.209.g1a687)