7

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 Mar 10 '17 at 20:45
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

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.');
        }
    }
2
  • Nice job you did here! – Uwe Ziegenhagen Apr 14 '20 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." – Tomáš Kruliš Apr 15 '20 at 5:38
1

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! – Tomáš Kruliš Apr 14 '20 at 6:25
  • Sure go ahead, I'd love to see it among the officially supported rules. – Uwe Ziegenhagen Apr 14 '20 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. – Tomáš Kruliš Apr 14 '20 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. :-) – Uwe Ziegenhagen Apr 14 '20 at 13:47

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.