9

Does anyone have a rule which allows to call Pythontex from Arara? I'd like to run the following set of commands for example:

%!TEX TS-program = Arara
% arara: pdflatex
% arara: pythontex
% arara: pdflatex
1
  • 3
    It's not that hard to create new arara rules modeled after the existing ones (which can be found in /usr/local/texlive/2016/texmf-dist/scripts/arara/rules in TeXLive).
    – Alan Munn
    Commented Mar 10, 2017 at 20:45

3 Answers 3

4

It proved actually to be not-so-hard to create basic working rule for PythonTeX in 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.');
        }
    }
4
  • Nice job you did here! Commented Apr 14, 2020 at 18:29
  • 1
    Thank you Mr. Zeigenhagen! Actually, I am now consulting with arara developers about uppgrading/making the rule more confirmant among other officially supported. But they agreed to add them among other officially supported ruesl, so, yay! If result would be "better" rule, Ill edit post. But, this just plainly "works." Commented Apr 15, 2020 at 5:38
  • Is this rule up-to-date?
    – Diaa
    Commented Mar 19, 2022 at 3:11
  • I am not aware of a major change in PythonTeX behavior for some time, so it should be up to date for basic usage. Commented Mar 19, 2022 at 7:54
3

Based on an example from http://texwelt.de/wissen/fragen/4944/wie-kann-ich-arara-auf-das-nomentbl-paket-anwenden-um-ein-formelzeichenverzeichnis-zu-erstellen I managed to create a working version:

!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}

I have saved it under the name pythontex.yaml under <Drive>:\texlive\2016\texmf-dist\scripts\arara\rules, it seems to work as desired.

2

For Arara 4.x the following rule should work like the one given for 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}
4
  • 1
    Your rule proposition works flawlessly for arara 4.0 rev.2. Since there is growing ammount of officially supported rules in arara 5.1, would it be ok if I would propose your PythonTeX rule to be inclluded among officially supported rules? If you are not interested in maintaining it, I can offer assistance in that matter. Looking forward to your reply! Commented Apr 14, 2020 at 6:25
  • Sure go ahead, I'd love to see it among the officially supported rules. Commented Apr 14, 2020 at 12:54
  • 1
    Thank you mr. Zeigenhagen. I have actually started to migrate to arara 5.1; which introduces changes that make rule for pythontex to fail. I try make it work and post it here (until it gets among supported rules); if you would be interested in updating the rule for arara 5.1, Ill go ahead at once. Commented Apr 14, 2020 at 13:37
  • Please feel free to update it as you like. I am currently busy with other topics, so please maintain it if you like. :-) Commented Apr 14, 2020 at 13:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .