0

I currently try to write my own buildscript as perl is at the moment not an option (so no makeglossaries) to build multiple glossaries. When I try to pack everything in a single batch file, it seems that makeindex is not called (no gls files are created).

not working tex.bat:

@echo off

set document=%~n1
set miktexpath=C:/bin/programme/miktex/miktex/bin

start /wait %miktexpath%/pdflatex %document%.tex ^
&& ^
%miktexpath%/makeindex -s %document%.ist -t %document%.glg -o %document%.gls %document%.glo ^
&& ^
%miktexpath%/makeindex -s %document%.ist -t %document%.idx.glg -o %document%.idx.gls %document%.idx.glo ^
&& ^
%miktexpath%/pdflatex %document%.tex ^
&& ^
%miktexpath%/pdflatex %document%.tex ^
&& ^
%miktexpath%/SumatraPDF -reuse-instance %document%.pdf

If I put every makeindex-call into a several batch file, it works. But this is more ugly than it already is.

working tex.bat:

@echo off

set document=%~n1
set miktexpath=C:/bin/programme/miktex/miktex/bin

start /wait %miktexpath%/pdflatex %document%.tex ^
&& ^
call ./gls.bat %document% ^
&& ^
call ./gls_idx.bat %document% ^
&& ^
%miktexpath%/pdflatex %document%.tex ^
&& ^
%miktexpath%/pdflatex %document%.tex ^
&& ^
%miktexpath%/SumatraPDF -reuse-instance %document%.pdf

gls.bat:

@echo off

set document=%~n1
set miktexpath=C:/bin/programme/miktex/miktex/bin

%miktexpath%/makeindex -s %document%.ist -t %document%.glg -o %document%.gls %document%.glo

gls_idx.bat:

@echo off

set document=%~n1
set miktexpath=C:/bin/programme/miktex/miktex/bin

%miktexpath%/makeindex -s %document%.ist -t %document%.idx.glg -o %document%.idx.gls %document%.idx.glo

Why is that so and how do I write a single buildscript?

Another thing: makeindex also refuses to build files when I use file extensions other than .gls/.glo etc.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
Buni
  • 125
  • This really looks like a batch file question. That said, why are your trying to chain everything together into one enormous line? I'd normally do something like 1) run pdfTeX, 2) check the ERRORLEVEL, 3) assuming it's OK, run MakeIndex, 4) add loops as required. – Joseph Wright Sep 22 '14 at 12:08
  • 1
    I was just about to answer :-) I have a small working batch script if you want one (perhaps pop into the chat room for it?). – Joseph Wright Sep 22 '14 at 12:27
  • I've read your comment and with errorlevel I was able to do it within one single file. Thank you for editing – Buni Sep 22 '14 at 12:37
  • Perhaps a self-answer then? – Joseph Wright Sep 22 '14 at 12:38
  • 1
    In case it's of any interest, with newer versions of glossaries you can use the automake package option. If the shell escape is enabled, this will execute the required makeindex commands during the LaTeX run (without the need for the makeglossaries Perl script). – Nicola Talbot Sep 24 '14 at 07:39

1 Answers1

1

Joseph Wright showed me here his method, that works as it should:

@echo off

set document=%~n1
set miktexpath=C:/bin/programme/miktex/miktex/bin

%miktexpath%/pdflatex -draftmode -interaction=batchmode %document%.tex
if errorlevel 1 (
    echo ! Compilation failed
) else (
    %miktexpath%/makeindex -s %document%.ist -t %document%.glg -o %document%.gls %document%.glo
    %miktexpath%/makeindex -s %document%.ist -t %document%.idx.glg -o %document%.idx.gls %document%.idx.glo
    %miktexpath%/pdflatex -draftmode -interaction=batchmode %document%.tex
    %miktexpath%/pdflatex -draftmode -interaction=batchmode %document%.tex
    %miktexpath%/SumatraPDF -reuse-instance %document%.pdf
)
Buni
  • 125