Pythontex 的 Arara 规则

Pythontex 的 Arara 规则

是否有人有允许从 Arara 拨打电话的规则Pythontex?例如,我想运行以下命令集:

%!TEX TS-program = Arara
% arara: pdflatex
% arara: pythontex
% arara: pdflatex

答案1

PythonTeX事实证明,创建基本工作规则并不难arara 5.1

pythontex.yaml

!config
# pythontex rule for arara
# author: Uwe Ziegenhagen, Tomas Krulis
# requires arara 5.0+
# According to: https://tex.stackexchange.com/questions/357881/arara-rule-for-pythontex
identifier: pythontex
name: pythontex
commands:
- name: PythonTeX and now for something completely different
  command: >
    @{
        return getCommand('pythontex', options, getBasename(reference))
     }
arguments:
- identifier: options
  flag: >
    @{
        if (isList(parameters.options)) {
            return parameters.options;
        }
        else {
            throwError('I was expecting a list of options.');
        }
    }

答案2

基于以下示例http://texwelt.de/wissen/fragen/4944/wie-kann-ich-arara-auf-das-nomentbl-paket-anwenden-um-ein-formelzeichenverzeichnis-zu-erstellen我设法创建了一个工作版本:

!config
# pythontex rule for arara
# author: Uwe Ziegenhagen
# requires arara 3.0+
identifier: pythontex
name: pythontex
command: <arara> pythontex @{options} "@{getBasename(file)}.pytxcode"
arguments: 
- identifier: style
  flag: <arara> @{parameters.style}
  default: pythontex
- identifier: options
  flag: <arara> @{parameters.options}

pythontex.yaml我已将其保存在以下名称下<Drive>:\texlive\2016\texmf-dist\scripts\arara\rules,它似乎可以按预期工作。

答案3

对于 Arara 4.x,以下规则应与 Arara 3.x 的规则类似

!config
# pythontex rule for arara
# author: Uwe Ziegenhagen
# requires arara 4.0+
identifier: pythontex
name: pythontex
commands:
- command: <arara> pythontex @{options} "@{getBasename(file)}.pytxcode"
arguments: 
- identifier: style
  flag: <arara> @{parameters.style}
  default: pythontex
- identifier: options
  flag: <arara> @{parameters.options}

相关内容