arara で複数のインデックスを取得するにはどうすればいいですか?

arara で複数のインデックスを取得するにはどうすればいいですか?

名前のインデックスも印刷されるようにするには、次のコマンドをどのように変更すればよいでしょうかarara? 現状では、メイン インデックスのみが取得されます。

% arara: pdflatex
% arara: bibtex
% arara: pdflatex
% arara: pdflatex
% arara: nomencl
% arara: makeindex
% arara: pdflatex
% arara: pdflatex
% !arara: indent: { overwrite: false, output: outputfile.tex, trace: true }

\documentclass{memoir}
\usepackage[backend=bibtex,style=numeric]{biblatex}
\addbibresource{mybib.bib}
\usepackage{nomencl}
\makenomenclature
\makeindex
\makeindex[names]

\begin{document}

\chapter{Area} \label{chap:area}
\section{Area of a circle} \label{sec:circle-area}

Consult \textcite{Archimedes200} and \textcite{EulerE1776}.
\index[names]{Archimedes}
\index[names]{Euler, Leonhard}

The area $A$ 
\nomenclature{$A$}{area}%
of a circle with radius $r$
\nomenclature{$r$}{radius of circle}%
is defined as
\begin{equation}
    A = \pi r^{2}.
\end{equation}
\index{area!of circle}
\index{area}
\index{circle!area of}

\printbibliography

\printnomenclature

\renewcommand{\indexname}{Index of Names}
\printindex[names]

\renewcommand{\indexname}{Index}
\printindex

\end{document}

ファイルはこちらですmybib.bib:

@article{Archimedes200,
  author = {Archimedes},
  title = {Pi's the limit},
  journal = {Syracuse J. Gastronom.\ Math.}, 
  year = {200BCE},
  volume = {10},
  pages={\textsc{CCCXV}--\textsc{CCCXIV}}
}
@article{EulerE1776,
  author = {Euler, Leonhard},
  title = {All about E},
  journal = {Math.\ Psychol.},
  year = {1776},
  volume = {4},
  pages={1--2718}
}

答え1

これを教えてくれた Paulo に感謝します。すべてのararaルールには と呼ばれる暗黙のパラメータがありfiles、これはファイル名の (コンマ区切りの) リストを受け取ります。araraは、このリストを反復処理し、リスト内の各項目にそのディレクティブを適用します。

もう 1 つのポイントは、BibTeX と MakeIndex の間に 2 回の pdfLaTeX 実行は必要ないということです。外部ツール用の補助ファイルを生成するには、最初の pdfLaTeX 実行で十分です。生成された参考文献/索引を含め、相互参照を整理するには、最後の 2 回の pdfLaTeX 実行が必要です。

ディレクティブのリストは次のように変更できます。

% arara: pdflatex
% arara: bibtex
% arara: makeindex
% arara: makeindex: { files: [ names ] }
% arara: pdflatex
% arara: pdflatex

そして、おそらく 2makeindex行を 1 行だけに置き換えます (メイン.texファイルが であると仮定しますmain.tex) % arara: makeindex: { files: [ main, names ] }

あるいは、arara賢く不要な手順を省略したい場合(説明ここ):

% arara: pdflatex: { draft: yes }
% arara: bibtex if changed (toFile('mybib.bib'))
% arara: --> || found ('log', 'Warning: Citation')
% arara: makeindex: { files: [ main, names ] } if changed ('idx')
% arara: pdflatex until !found('log', '\\(?(R|r)e\\)?run (to get|LaTeX)')

barbarabeeton がコメントで述べたように、もう 1 つのオプションは、pdfLaTeX 内からimakeidx実行されるパッケージです。は信頼できるプログラムであるため、通常は有効になっている制限付きシェル エスケープ内で実行できます。パッケージは、すでに複数のインデックスやその他の処理を行っています。makeindexmakeindeximakeidx

\usepackage{makeindex}これを使用するには、 をロードし、\makeindex[names]を に置き換えるだけです\makeindex[name=names]

ただし、repeatindex使用しているパッケージは互換性がないようですimakeidx... 理由を調べてみます。


または、クールな子供のように見せたい場合 (パラメータについて教えられる前にこれをすべてやった私のようにfiles:-)、難しい方法で行う場合は、ファイルに小さな変更を加えて、インデックス ファイルの基本名 (この場合は ) を取得し、現在のファイル名の代わりにそれを処理するオプションmakeindex.yamlを追加できます。basenamenames

まず、arguments:の行の下にmakeindex.yamlオプション自体を追加します。

- identifier: basename
  flag: >
    @{
      parameters.basename
    }

(どうやら Java は何らかの理由で のみの使用を好まないようですbase。そのため、より冗長な を使用しましたbasename。) このオプションはデフォルト値なしで設定し、空の場合には を使用しますgetBasename(file)

ここで、command:そのオプションを使用するようにセクションを変更します。

  command: >
    @{
        if (isEmpty(basename))
          { basename = getBasename(file); }
        infile = basename.concat('.').concat(input);
        outfile = [ '-o', basename.concat('.').concat(output) ];
        logfile = [ '-t', basename.concat('.').concat(log) ];
        return getCommand('makeindex', german, style, order, options,
                          logfile, infile, outfile);
    }

まず、basenameが空かどうかを確認します。空の場合は、 の現在のファイル名を使用しますgetBasename(file)。次に、通常どおりに進み、入力ファイル、出力ファイル、およびログ ファイルの拡張子を追加して、実行可能ファイルを呼び出しますmakeindex

makeindex.yaml(便宜上、この回答の下部にファイルの完全な修正バージョンがあります)

その後、ディレクティブを次のように変更できます。

% arara: pdflatex
% arara: bibtex
% arara: makeindex
% arara: makeindex: { basename: names }
% arara: pdflatex
% arara: pdflatex

pdflatex(前の2 つのルールは削除したことに注意してくださいmakeindex。これらは必要ありません。)

これでインデックスが正しくコンパイルされるはずです。


元のコピーで変更を加えなかった場合makeindex.yaml(実際にはない) の場合は、新しいmakeindex.yamlファイルを何らかのフォルダに保存し、次.araraconfig.yamlの内容を含むファイルを作成する必要があります。

paths:
- '/path/to/the/folder/'

これを.araraconfig.yaml現在の作業ディレクトリまたはフォルダに配置しますUSER_HOME(詳細については、arara マニュアルの第 4 章を参照してください)。makeindex.yamlファイルが現在の作業ディレクトリにある場合は、構成ファイルの 2 行目で使用できます- './'


完全なmakeindex.yamlファイル:

!config
# Arara, the cool TeX automation tool
# Copyright (c) 2018, Paulo Roberto Massa Cereda 
# All rights reserved.
#
# This rule is part of arara.
identifier: nmakeindex
name: MakeIndex
authors:
- Marco Daniel
- Paulo Cereda
commands:
- name: The MakeIndex software
  command: >
    @{
        if (isEmpty(basename))
          { basename = getBasename(file); }
        infile = basename.concat('.').concat(input);
        outfile = [ '-o', basename.concat('.').concat(output) ];
        logfile = [ '-t', basename.concat('.').concat(log) ];
        return getCommand('makeindex', german, style, order, options,
                          logfile, infile, outfile);
    }
arguments:
- identifier: basename
  flag: >
    @{
      parameters.basename
    }
- identifier: input
  flag: >
    @{
      parameters.input
    }
  default: idx
- identifier: output
  flag: >
    @{
      parameters.output
    }
  default: ind
- identifier: log
  flag: >
    @{
      parameters.log
    }
  default: ilg
- identifier: german
  flag: >
    @{
        isTrue(parameters.german, '-g')
    }
- identifier: order
  flag: >
    @{
        if ([ 'letter', 'word' ].contains(parameters.order)) {
            return isTrue(parameters.order == 'letter', '-l', '');
        }
        else {
            throwError('The provided order is invalid.');
        }
    }
- identifier: style
  flag: "@{ [ '-s', parameters.style ] }"
- identifier: options
  flag: >
    @{
        if (isList(parameters.options)) {
            return parameters.options;
        }
        else {
            throwError('I was expecting a list of options.');
        }
    }

関連情報