Discussion:
running makeindex from a tex file (by shell scape)
Vafa Khalighi
2011-01-23 14:41:30 UTC
Permalink
Can you please tel me why this does not work with pdflatex --shell-escape
test

\documentclass{minimal}

\usepackage{makeidx}

\makeindex

\makeatletter

\renewcommand\printindex{%

\immediate\closeout\@indexfile

\immediate\write18{makeindex \jobname.idx}

\input{\jobname.ind}}

\makeatother

\begin{document}

This is a test.

\index{Test}\index{Exam}

\printindex

\end{document}
Paul Isambert
2011-01-23 15:05:00 UTC
Permalink
Post by Vafa Khalighi
Can you please tel me why this does not work with pdflatex
--shell-escape test
\documentclass{minimal}
\usepackage{makeidx}
\makeindex
\makeatletter
\renewcommand\printindex{%
\immediate\write18{makeindex \jobname.idx}
\input{\jobname.ind}}
\makeatother
\begin{document}
This is a test.
\index{Test}\index{Exam}
\printindex
\end{document}
What happens if you add \pdfshellescape=1 at the top of the file?

Paul
Vafa Khalighi
2011-01-23 15:10:43 UTC
Permalink
What happens if you add \pdfshellescape=1 at the top of the file?
Paul
! You can't use `\pdfshellescape' in vertical mode.
l.1 \pdfshellescape
=1
?
Uwe Lueck
2011-01-23 15:36:23 UTC
Permalink
Can you please tel me why this does not work with pdflatex --shell-escape test
\documentclass{minimal}
\usepackage{makeidx}
\makeindex
\makeatletter
\renewcommand\printindex{%
\immediate\write18{makeindex \jobname.idx}
\input{\jobname.ind}}
\makeatother
\begin{document}
This is a test.
\index{Test}\index{Exam}
\printindex
\end{document}
This may be a minimal example, but the posting still is of type "it doesn't work".
Why don't you say (precisely) what you experience with this code?

Anyway, I wonder whether you want to do what imakeidx does,

http://ctan.org/pkg/imakeidx

-- Uwe.
Vafa Khalighi
2011-01-23 15:39:15 UTC
Permalink
Post by Uwe Lueck
This may be a minimal example, but the posting still is of type "it doesn't work".
Why don't you say (precisely) what you experience with this code?
it makes .idx empty and so does not work as expected.
Heiko Oberdiek
2011-01-23 16:29:29 UTC
Permalink
Post by Vafa Khalighi
Can you please tel me why this does not work with pdflatex --shell-escape
test
\documentclass{minimal}
\usepackage{makeidx}
\makeindex
\makeatletter
\renewcommand\printindex{%
\immediate\write18{makeindex \jobname.idx}
\input{\jobname.ind}}
\makeatother
\begin{document}
This is a test.
\index{Test}\index{Exam}
\index needs the page number, therefore the write is delayed until
the page is shipped out.
Post by Vafa Khalighi
\printindex
The page with the \index commands isn't shipped out yet, but you
are already closing the .idx file. Therefore put a \newpage
at the beginning of \printindex.

Yours sincerely
Heiko Oberdiek
Vafa Khalighi
2011-01-23 16:39:27 UTC
Permalink
Post by Heiko Oberdiek
The page with the \index commands isn't shipped out yet, but you
are already closing the .idx file. Therefore put a \newpage
at the beginning of \printindex.
Thanks for the explanation. Even simpler putting

\immediate\write18{makeindex \jobname.idx}


before \documentclass, will do.
Reinhard Kotucha
2011-01-23 17:38:34 UTC
Permalink
Post by Vafa Khalighi
Post by Heiko Oberdiek
The page with the \index commands isn't shipped out yet, but you
are already closing the .idx file. Therefore put a \newpage
at the beginning of \printindex.
Thanks for the explanation. Even simpler putting
\immediate\write18{makeindex \jobname.idx}
before \documentclass, will do.
But this requires an extra run because you are using the .idx file
from the previous one. I thought that you want to create the index
immediately when the .idx file is complete.

Regards,
Reinhard
--
----------------------------------------------------------------------------
Reinhard Kotucha Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover mailto:***@web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------
Vafa Khalighi
2011-01-24 05:51:18 UTC
Permalink
Post by Reinhard Kotucha
But this requires an extra run because you are using the .idx file
from the previous one. I thought that you want to create the index
immediately when the .idx file is complete.
a single or double run of pdflatex makes no difference for me actually. The
main thing for me was calling xindy within a tex file.

Loading...