My question is similar to the one here, however it has a little different focus. I am working under Windows using MikTeX 2.9.

I do have several latex projects which are part of a tool documentation. Each project may create multiple glossaries files depending of the number of sub-glossaries used in each document.


Instead of calling makeindex individually on each glossaries file with

makeindex -s %maintexname%.ist -t %maintexname%.alg -o %maintexname%.acr %maintexname%.acn
makeindex -s %maintexname%.ist -t %maintexname%.glg -o %maintexname%.gls %maintexname%.glo
makeindex -s %maintexname%.ist -t %maintexname%.slg1 -o %maintexname%.syi1 %maintexname%.syg1
makeindex -s %maintexname%.ist -t %maintexname%.slg2 -o %maintexname%.syi2 %maintexname%.syg2

I wrote a batch script create_glossaries.cmd that applies makeindex to all acn, glo and sygi files in the main folder of the latex project, for acronyms, glossaries and symbols respectively. Thus, I don't really have to know which glossaries files are created explicitely and I can use the same batch script for all my documents.

Now I want to switch to build automation with arara. I basically got it working to use pdflatex and biber to compile my document. But I am struggeling to include the creation of the glossaries. I could of course input the individual makeindex commands for each glossaries file with

% arara: makeindex: { style: %maintexname%.ist }

However, this lacks the generality of the approach and I would have to specify each glossaries file for each project. If possible, I'd like to work around that.

So my first solution approach would be to call the batch script from within arara. However, I did not really get how to call a batch script, here called create_glossaries.cmd from a arara rule. How is that possible?

To be platform independent and use the same approach on all operating system supported by arara my second question is: How can I extend a rule that does the same as my script, so find each base glossaries file and translate it to the proper output using makeindex?

And a question related: How can I deliver a possible new arara rule in my main tex document folder instead of in the arara rules path? Background is that the documents are part of a SVN repository, such that I do not know the absolute path where a collaborator checks the latex file out to.

Batch script for makeindex

This is the file create_glossaries.cmd

:: Purpose:         Create all glossaries for a tex document
:: Conventions:
::   - Acronyms:    - Input file extension:     acn*
::                  - Output file extension:    acr*
::                  - Log file extension:       alg*
::   - Glossary:    - Input file extension:     glo*
::                  - Output file extension:    gls*
::                  - Log file extension:       glg*
::   - Symbols :    - Input file extension:     syg*
::                  - Output file extension:    syi*
::                  - Log file extension:       slg*
:: Remarks:         - This script has to be physically present in the tex directory.
::                    A symbolic link does not work.
:: Author:          Martin Raedel, DLR-FA-STM, WiMi, 10.02.2016
:: @echo off verhindert Ausgabe Befehlszeilen bis Stapelverarbeitung beendet
@echo off
:: set variables - no spaces between variable name and = allowed
:: manual mode:
::set maintexname=Mixed-Dimensional-Coupling
:: automatic mode:
set glo_num=2
set glo_input_list[0]=acn
set glo_input_list[1]=glo
set glo_input_list[2]=syg
set glo_output_list[0]=acr
set glo_output_list[1]=gls
set glo_output_list[2]=syi
set glo_log_list[0]=alg
set glo_log_list[1]=glg
set glo_log_list[2]=slg
:: create glossaries
:: Acronyms:
::makeindex -s %maintexname%.ist -t %maintexname%.alg -o %maintexname%.acr %maintexname%.acn
:: Glossar:
::makeindex -s %maintexname%.ist -t %maintexname%.glg -o %maintexname%.gls %maintexname%.glo
:: Symbols:
::   manual:
::makeindex -s %maintexname%.ist -t %maintexname%.slg1 -o %maintexname%.syi1 %maintexname%.syg1
::   with automatic symbol input file search
setlocal EnableDelayedExpansion
FOR /L %%i IN (0, 1, %glo_num%) DO (
  set inputextension=!glo_input_list[%%i]!
  set outputextension=!glo_output_list[%%i]!
  set logextension=!glo_log_list[%%i]!
  ::echo "inputextension: !inputextension!"
  FOR %%f IN (*.!inputextension!*) DO (
    ::echo %%f
    set fullfilename=%%f
    set filename=%%~nf
    set fileextensionwithdot=%%~xf
    set fileextension=!fileextensionwithdot:~1!
    ::echo "fullfilename: !fullfilename! | fileextension: !fileextension! | !fileextension:~3,1!"
    IF DEFINED fileextension IF "!fileextension:~3,1!"=="" (
      ::echo 3 or less characters
      makeindex -s !filename!.ist -t !filename!.!logextension! -o !filename!.!outputextension! !filename!!fileextensionwithdot! >nul 2>&1
    ) ELSE (
      ::echo more than 3 characters
      set index=!fileextension:~3,1!
      ::echo !index!
      makeindex -s !filename!.ist -t !filename!.!logextension!!index! -o !filename!.!outputextension!!index! !filename!!fileextensionwithdot!>nul 2>&1

Solution to idea 1?!

I managed to get the first approach, calling the batch script from an own arara rule, working. I added this araraconfig.yaml to the main directory of my project.

- '.'

to find my own rule-file create_glossaries.yaml

identifier: create_glossaries
name: create_glossaries
- name: Create glossaries
  command: <arara> cmd /c create_glossaries.cmd
- identifier: name
  flag: <arara> @{parameters.name}
  default: "create_glossaries"

Where the argument is not used, but the file does not work without it.

  • Hi! I am in a bit of a hurry, I will take a closer look at your question later on. :) – Paulo Cereda Mar 17 at 20:34
  • I am really looking forward to it. Thanks for the great tool. Should I open an issue on Github? – raedma Mar 17 at 20:50
  • Hi, deeply sorry for the lack of recent updates. I am drowning with some work of lately, but I will try to tackle this question today. Deeply, deeply sorry... :( – Paulo Cereda Mar 31 at 10:12
  • @PauloCereda I know the feeling ;). No worries. The initial solution works. There is just the lack of platform independency. I'll add an issue in the arara GitHub repo, so this topic won't be forgotten. – raedma Apr 1 at 11:33
  • Is there any particular reason why you're not using the makeglossaries or makeglossarieslite rules? – Nicola Talbot Apr 1 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.